Commit 4f7aa122 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

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: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9bab51bd
...@@ -101,11 +101,15 @@ dpll_msg_add_mode_supported(struct sk_buff *msg, struct dpll_device *dpll, ...@@ -101,11 +101,15 @@ dpll_msg_add_mode_supported(struct sk_buff *msg, struct dpll_device *dpll,
{ {
const struct dpll_device_ops *ops = dpll_device_ops(dpll); const struct dpll_device_ops *ops = dpll_device_ops(dpll);
enum dpll_mode mode; enum dpll_mode mode;
int ret;
if (!ops->mode_supported) /* No mode change is supported now, so the only supported mode is the
return 0; * one obtained by mode_get().
for (mode = DPLL_MODE_MANUAL; mode <= DPLL_MODE_MAX; mode++) */
if (ops->mode_supported(dpll, dpll_priv(dpll), mode, extack))
ret = ops->mode_get(dpll, dpll_priv(dpll), &mode, extack);
if (ret)
return ret;
if (nla_put_u32(msg, DPLL_A_MODE_SUPPORTED, mode)) if (nla_put_u32(msg, DPLL_A_MODE_SUPPORTED, mode))
return -EMSGSIZE; return -EMSGSIZE;
......
...@@ -512,31 +512,6 @@ ice_dpll_lock_status_get(const struct dpll_device *dpll, void *dpll_priv, ...@@ -512,31 +512,6 @@ ice_dpll_lock_status_get(const struct dpll_device *dpll, void *dpll_priv,
return 0; return 0;
} }
/**
* ice_dpll_mode_supported - check if dpll's working mode is supported
* @dpll: registered dpll pointer
* @dpll_priv: private data pointer passed on dpll registration
* @mode: mode to be checked for support
* @extack: error reporting
*
* Dpll subsystem callback. Provides information if working mode is supported
* by dpll.
*
* Return:
* * true - mode is supported
* * false - mode is not supported
*/
static bool ice_dpll_mode_supported(const struct dpll_device *dpll,
void *dpll_priv,
enum dpll_mode mode,
struct netlink_ext_ack *extack)
{
if (mode == DPLL_MODE_AUTOMATIC)
return true;
return false;
}
/** /**
* ice_dpll_mode_get - get dpll's working mode * ice_dpll_mode_get - get dpll's working mode
* @dpll: registered dpll pointer * @dpll: registered dpll pointer
...@@ -1197,7 +1172,6 @@ static const struct dpll_pin_ops ice_dpll_output_ops = { ...@@ -1197,7 +1172,6 @@ static const struct dpll_pin_ops ice_dpll_output_ops = {
static const struct dpll_device_ops ice_dpll_ops = { static const struct dpll_device_ops ice_dpll_ops = {
.lock_status_get = ice_dpll_lock_status_get, .lock_status_get = ice_dpll_lock_status_get,
.mode_supported = ice_dpll_mode_supported,
.mode_get = ice_dpll_mode_get, .mode_get = ice_dpll_mode_get,
}; };
......
...@@ -128,18 +128,9 @@ static int mlx5_dpll_device_mode_get(const struct dpll_device *dpll, ...@@ -128,18 +128,9 @@ static int mlx5_dpll_device_mode_get(const struct dpll_device *dpll,
return 0; return 0;
} }
static bool mlx5_dpll_device_mode_supported(const struct dpll_device *dpll,
void *priv,
enum dpll_mode mode,
struct netlink_ext_ack *extack)
{
return mode == DPLL_MODE_MANUAL;
}
static const struct dpll_device_ops mlx5_dpll_device_ops = { static const struct dpll_device_ops mlx5_dpll_device_ops = {
.lock_status_get = mlx5_dpll_device_lock_status_get, .lock_status_get = mlx5_dpll_device_lock_status_get,
.mode_get = mlx5_dpll_device_mode_get, .mode_get = mlx5_dpll_device_mode_get,
.mode_supported = mlx5_dpll_device_mode_supported,
}; };
static int mlx5_dpll_pin_direction_get(const struct dpll_pin *pin, static int mlx5_dpll_pin_direction_get(const struct dpll_pin *pin,
......
...@@ -4260,13 +4260,6 @@ static int ptp_ocp_dpll_mode_get(const struct dpll_device *dpll, void *priv, ...@@ -4260,13 +4260,6 @@ static int ptp_ocp_dpll_mode_get(const struct dpll_device *dpll, void *priv,
return 0; return 0;
} }
static bool ptp_ocp_dpll_mode_supported(const struct dpll_device *dpll,
void *priv, const enum dpll_mode mode,
struct netlink_ext_ack *extack)
{
return mode == DPLL_MODE_AUTOMATIC;
}
static int ptp_ocp_dpll_direction_get(const struct dpll_pin *pin, static int ptp_ocp_dpll_direction_get(const struct dpll_pin *pin,
void *pin_priv, void *pin_priv,
const struct dpll_device *dpll, const struct dpll_device *dpll,
...@@ -4350,7 +4343,6 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin, ...@@ -4350,7 +4343,6 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin,
static const struct dpll_device_ops dpll_ops = { static const struct dpll_device_ops dpll_ops = {
.lock_status_get = ptp_ocp_dpll_lock_status_get, .lock_status_get = ptp_ocp_dpll_lock_status_get,
.mode_get = ptp_ocp_dpll_mode_get, .mode_get = ptp_ocp_dpll_mode_get,
.mode_supported = ptp_ocp_dpll_mode_supported,
}; };
static const struct dpll_pin_ops dpll_pins_ops = { static const struct dpll_pin_ops dpll_pins_ops = {
......
...@@ -17,9 +17,6 @@ struct dpll_pin; ...@@ -17,9 +17,6 @@ struct dpll_pin;
struct dpll_device_ops { struct dpll_device_ops {
int (*mode_get)(const struct dpll_device *dpll, void *dpll_priv, int (*mode_get)(const struct dpll_device *dpll, void *dpll_priv,
enum dpll_mode *mode, struct netlink_ext_ack *extack); enum dpll_mode *mode, struct netlink_ext_ack *extack);
bool (*mode_supported)(const struct dpll_device *dpll, void *dpll_priv,
const enum dpll_mode mode,
struct netlink_ext_ack *extack);
int (*lock_status_get)(const struct dpll_device *dpll, void *dpll_priv, int (*lock_status_get)(const struct dpll_device *dpll, void *dpll_priv,
enum dpll_lock_status *status, enum dpll_lock_status *status,
struct netlink_ext_ack *extack); struct netlink_ext_ack *extack);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment