Re: [net-next PATCH v3 06/14] net: dsa: qca8k: move mib init function to common code

From: Vladimir Oltean
Date: Mon Jul 25 2022 - 20:14:08 EST


On Sat, Jul 23, 2022 at 04:18:37PM +0200, Christian Marangi wrote:
> The same mib function is used by drivers based on qca8k family switch.
> Move it to common code to make it accessible also by other drivers.
>
> Signed-off-by: Christian Marangi <ansuelsmth@xxxxxxxxx>
> ---
> diff --git a/drivers/net/dsa/qca/qca8k-common.c b/drivers/net/dsa/qca/qca8k-common.c
> index 2f96f1d4b921..9e9e3f0b7179 100644
> --- a/drivers/net/dsa/qca/qca8k-common.c
> +++ b/drivers/net/dsa/qca/qca8k-common.c
> @@ -138,3 +138,39 @@ int qca8k_bulk_write(struct qca8k_priv *priv, u32 reg, u32 *val, int len)
>
> return 0;
> }
> +
> +int
> +qca8k_busy_wait(struct qca8k_priv *priv, u32 reg, u32 mask)

Can take up a single line.

> +{
> + u32 val;
> +
> + return regmap_read_poll_timeout(priv->regmap, reg, val, !(val & mask), 0,
> + QCA8K_BUSY_WAIT_TIMEOUT * USEC_PER_MSEC);
> +}