Re: [net-next PATCH 04/14] net: phy: at803x: move qca83xx stats out of generic at803x_priv struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 29, 2023 at 03:12:09AM +0100, Christian Marangi wrote:
> Introduce a specific priv struct for qca83xx PHYs to store hw stats
> data and a specific probe to allocate this alternative priv struct.
> 
> This also have the benefits of reducing memory allocated for every other
> at803x PHY since only qca83xx currently supports storing hw stats.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@xxxxxxxxx>
> ---
>  drivers/net/phy/at803x.c | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index 4ff41d70fc47..3b7baa4bb637 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -301,6 +301,10 @@ static struct at803x_hw_stat qca83xx_hw_stats[] = {
>  	{ "eee_wake_errors", 0x16, GENMASK(15, 0), MMD},
>  };
>  
> +struct qca83xx_priv {
> +	u64 stats[ARRAY_SIZE(qca83xx_hw_stats)];
> +};
> +
>  struct at803x_priv {
>  	int flags;
>  	u16 clk_25m_reg;
> @@ -311,7 +315,6 @@ struct at803x_priv {
>  	bool is_1000basex;
>  	struct regulator_dev *vddio_rdev;
>  	struct regulator_dev *vddh_rdev;
> -	u64 stats[ARRAY_SIZE(qca83xx_hw_stats)];
>  };

I agree with Russell here, this is the wrong way to go.

Maybe keep at803x_priv for all the common private members which are
shared by all variants. Add a qca83xx_priv which includes this:

struct qca83xx_priv {
	struct at803x_priv at803_priv;
	u64 stats[ARRAY_SIZE(qca83xx_hw_stats)];
};

	Andrew




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux