Skip to content

Commit 4f7aa12

Browse files
Jiri Pirkodavem330
authored andcommitted
dpll: remove leftover mode_supported() op and use mode_get() instead
Mode supported is currently reported to the user exactly the same, as the current mode. That's because mode changing is not implemented. Remove the leftover mode_supported() op and use mode_get() to fill up the supported mode exposed to user. One, if even, mode changing is going to be introduced, this could be very easily taken back. In the meantime, prevent drivers form implementing this in wrong way (as for example recent netdevsim implementation attempt intended to do). Signed-off-by: Jiri Pirko <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9bab51b commit 4f7aa12

File tree

5 files changed

+10
-52
lines changed

5 files changed

+10
-52
lines changed

drivers/dpll/dpll_netlink.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,17 @@ dpll_msg_add_mode_supported(struct sk_buff *msg, struct dpll_device *dpll,
101101
{
102102
const struct dpll_device_ops *ops = dpll_device_ops(dpll);
103103
enum dpll_mode mode;
104+
int ret;
104105

105-
if (!ops->mode_supported)
106-
return 0;
107-
for (mode = DPLL_MODE_MANUAL; mode <= DPLL_MODE_MAX; mode++)
108-
if (ops->mode_supported(dpll, dpll_priv(dpll), mode, extack))
109-
if (nla_put_u32(msg, DPLL_A_MODE_SUPPORTED, mode))
110-
return -EMSGSIZE;
106+
/* No mode change is supported now, so the only supported mode is the
107+
* one obtained by mode_get().
108+
*/
109+
110+
ret = ops->mode_get(dpll, dpll_priv(dpll), &mode, extack);
111+
if (ret)
112+
return ret;
113+
if (nla_put_u32(msg, DPLL_A_MODE_SUPPORTED, mode))
114+
return -EMSGSIZE;
111115

112116
return 0;
113117
}

drivers/net/ethernet/intel/ice/ice_dpll.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -512,31 +512,6 @@ ice_dpll_lock_status_get(const struct dpll_device *dpll, void *dpll_priv,
512512
return 0;
513513
}
514514

515-
/**
516-
* ice_dpll_mode_supported - check if dpll's working mode is supported
517-
* @dpll: registered dpll pointer
518-
* @dpll_priv: private data pointer passed on dpll registration
519-
* @mode: mode to be checked for support
520-
* @extack: error reporting
521-
*
522-
* Dpll subsystem callback. Provides information if working mode is supported
523-
* by dpll.
524-
*
525-
* Return:
526-
* * true - mode is supported
527-
* * false - mode is not supported
528-
*/
529-
static bool ice_dpll_mode_supported(const struct dpll_device *dpll,
530-
void *dpll_priv,
531-
enum dpll_mode mode,
532-
struct netlink_ext_ack *extack)
533-
{
534-
if (mode == DPLL_MODE_AUTOMATIC)
535-
return true;
536-
537-
return false;
538-
}
539-
540515
/**
541516
* ice_dpll_mode_get - get dpll's working mode
542517
* @dpll: registered dpll pointer
@@ -1197,7 +1172,6 @@ static const struct dpll_pin_ops ice_dpll_output_ops = {
11971172

11981173
static const struct dpll_device_ops ice_dpll_ops = {
11991174
.lock_status_get = ice_dpll_lock_status_get,
1200-
.mode_supported = ice_dpll_mode_supported,
12011175
.mode_get = ice_dpll_mode_get,
12021176
};
12031177

drivers/net/ethernet/mellanox/mlx5/core/dpll.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,9 @@ static int mlx5_dpll_device_mode_get(const struct dpll_device *dpll,
128128
return 0;
129129
}
130130

131-
static bool mlx5_dpll_device_mode_supported(const struct dpll_device *dpll,
132-
void *priv,
133-
enum dpll_mode mode,
134-
struct netlink_ext_ack *extack)
135-
{
136-
return mode == DPLL_MODE_MANUAL;
137-
}
138-
139131
static const struct dpll_device_ops mlx5_dpll_device_ops = {
140132
.lock_status_get = mlx5_dpll_device_lock_status_get,
141133
.mode_get = mlx5_dpll_device_mode_get,
142-
.mode_supported = mlx5_dpll_device_mode_supported,
143134
};
144135

145136
static int mlx5_dpll_pin_direction_get(const struct dpll_pin *pin,

drivers/ptp/ptp_ocp.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4260,13 +4260,6 @@ static int ptp_ocp_dpll_mode_get(const struct dpll_device *dpll, void *priv,
42604260
return 0;
42614261
}
42624262

4263-
static bool ptp_ocp_dpll_mode_supported(const struct dpll_device *dpll,
4264-
void *priv, const enum dpll_mode mode,
4265-
struct netlink_ext_ack *extack)
4266-
{
4267-
return mode == DPLL_MODE_AUTOMATIC;
4268-
}
4269-
42704263
static int ptp_ocp_dpll_direction_get(const struct dpll_pin *pin,
42714264
void *pin_priv,
42724265
const struct dpll_device *dpll,
@@ -4350,7 +4343,6 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin,
43504343
static const struct dpll_device_ops dpll_ops = {
43514344
.lock_status_get = ptp_ocp_dpll_lock_status_get,
43524345
.mode_get = ptp_ocp_dpll_mode_get,
4353-
.mode_supported = ptp_ocp_dpll_mode_supported,
43544346
};
43554347

43564348
static const struct dpll_pin_ops dpll_pins_ops = {

include/linux/dpll.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ struct dpll_pin;
1717
struct dpll_device_ops {
1818
int (*mode_get)(const struct dpll_device *dpll, void *dpll_priv,
1919
enum dpll_mode *mode, struct netlink_ext_ack *extack);
20-
bool (*mode_supported)(const struct dpll_device *dpll, void *dpll_priv,
21-
const enum dpll_mode mode,
22-
struct netlink_ext_ack *extack);
2320
int (*lock_status_get)(const struct dpll_device *dpll, void *dpll_priv,
2421
enum dpll_lock_status *status,
2522
struct netlink_ext_ack *extack);

0 commit comments

Comments
 (0)