Re: [PATCH net-next v3 3/8] net: dsa: realtek: common realtek-dsa module

Alvin Šipraga
2024-01-11T10:10:05Z

On Thu, Jan 11, 2024 at 11:41:48AM +0200, Vladimir Oltean wrote:
> diff --git a/drivers/net/dsa/realtek/realtek-common.h b/drivers/net/dsa/realtek/realtek-common.h
> index 518d091ff496..71fc43d8d90a 100644
> --- a/drivers/net/dsa/realtek/realtek-common.h
> +++ b/drivers/net/dsa/realtek/realtek-common.h
> @@ -5,11 +5,16 @@
>
> #include <linux/regmap.h>
>
> +struct realtek_common_info {
> + int (*reg_read)(void *ctx, u32 reg, u32 *val);
> + int (*reg_write)(void *ctx, u32 reg, u32 val);
> +};
> +

Yes, this is good. Makes it easier to expand later if necessary, too.

> void realtek_common_lock(void *ctx);
> void realtek_common_unlock(void *ctx);
> struct realtek_priv *
> -realtek_common_probe(struct device *dev, struct regmap_config rc,
> - struct regmap_config rc_nolock);
> +realtek_common_probe(struct device *dev,
> + const struct realtek_common_info *info);
> int realtek_common_register_switch(struct realtek_priv *priv);
> void realtek_common_remove(struct realtek_priv *priv);