printf: Remove unused 'bprintf'
[drm/drm-misc.git] / include / linux / phylib_stubs.h
blob1279f48c8a7077ae495f861e5471146b636a2b37
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Stubs for the Network PHY library
4 */
6 #include <linux/rtnetlink.h>
8 struct kernel_hwtstamp_config;
9 struct netlink_ext_ack;
10 struct phy_device;
12 #if IS_ENABLED(CONFIG_PHYLIB)
14 extern const struct phylib_stubs *phylib_stubs;
16 struct phylib_stubs {
17 int (*hwtstamp_get)(struct phy_device *phydev,
18 struct kernel_hwtstamp_config *config);
19 int (*hwtstamp_set)(struct phy_device *phydev,
20 struct kernel_hwtstamp_config *config,
21 struct netlink_ext_ack *extack);
24 static inline int phy_hwtstamp_get(struct phy_device *phydev,
25 struct kernel_hwtstamp_config *config)
27 /* phylib_register_stubs() and phylib_unregister_stubs()
28 * also run under rtnl_lock().
30 ASSERT_RTNL();
32 if (!phylib_stubs)
33 return -EOPNOTSUPP;
35 return phylib_stubs->hwtstamp_get(phydev, config);
38 static inline int phy_hwtstamp_set(struct phy_device *phydev,
39 struct kernel_hwtstamp_config *config,
40 struct netlink_ext_ack *extack)
42 /* phylib_register_stubs() and phylib_unregister_stubs()
43 * also run under rtnl_lock().
45 ASSERT_RTNL();
47 if (!phylib_stubs)
48 return -EOPNOTSUPP;
50 return phylib_stubs->hwtstamp_set(phydev, config, extack);
53 #else
55 static inline int phy_hwtstamp_get(struct phy_device *phydev,
56 struct kernel_hwtstamp_config *config)
58 return -EOPNOTSUPP;
61 static inline int phy_hwtstamp_set(struct phy_device *phydev,
62 struct kernel_hwtstamp_config *config,
63 struct netlink_ext_ack *extack)
65 return -EOPNOTSUPP;
68 #endif