treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / net / dsa / sja1105 / sja1105_tas.h
blobb226c3dfd5b16822ae862b7f97b22295987c94e0
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
3 */
4 #ifndef _SJA1105_TAS_H
5 #define _SJA1105_TAS_H
7 #include <net/pkt_sched.h>
9 #if IS_ENABLED(CONFIG_NET_DSA_SJA1105_TAS)
11 enum sja1105_tas_state {
12 SJA1105_TAS_STATE_DISABLED,
13 SJA1105_TAS_STATE_ENABLED_NOT_RUNNING,
14 SJA1105_TAS_STATE_RUNNING,
17 enum sja1105_ptp_op {
18 SJA1105_PTP_NONE,
19 SJA1105_PTP_CLOCKSTEP,
20 SJA1105_PTP_ADJUSTFREQ,
23 struct sja1105_tas_data {
24 struct tc_taprio_qopt_offload *offload[SJA1105_NUM_PORTS];
25 enum sja1105_tas_state state;
26 enum sja1105_ptp_op last_op;
27 struct work_struct tas_work;
28 s64 earliest_base_time;
29 s64 oper_base_time;
30 u64 max_cycle_time;
31 bool enabled;
34 int sja1105_setup_tc_taprio(struct dsa_switch *ds, int port,
35 struct tc_taprio_qopt_offload *admin);
37 void sja1105_tas_setup(struct dsa_switch *ds);
39 void sja1105_tas_teardown(struct dsa_switch *ds);
41 void sja1105_tas_clockstep(struct dsa_switch *ds);
43 void sja1105_tas_adjfreq(struct dsa_switch *ds);
45 #else
47 /* C doesn't allow empty structures, bah! */
48 struct sja1105_tas_data {
49 u8 dummy;
52 static inline int sja1105_setup_tc_taprio(struct dsa_switch *ds, int port,
53 struct tc_taprio_qopt_offload *admin)
55 return -EOPNOTSUPP;
58 static inline void sja1105_tas_setup(struct dsa_switch *ds) { }
60 static inline void sja1105_tas_teardown(struct dsa_switch *ds) { }
62 static inline void sja1105_tas_clockstep(struct dsa_switch *ds) { }
64 static inline void sja1105_tas_adjfreq(struct dsa_switch *ds) { }
66 #endif /* IS_ENABLED(CONFIG_NET_DSA_SJA1105_TAS) */
68 #endif /* _SJA1105_TAS_H */