lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJhJPsUDmQgunCk_Fbe5vFtBzE6Yy6m6Q0oRcXmpWRTu4nqQ0A@mail.gmail.com>
Date: Thu, 19 Jun 2025 13:48:42 +0800
From: Keguang Zhang <keguang.zhang@...il.com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>, 
	Alexandre Torgue <alexandre.torgue@...s.st.com>, Andrew Lunn <andrew+netdev@...n.ch>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, linux-arm-kernel@...ts.infradead.org, 
	linux-mips@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com, 
	Maxime Coquelin <mcoquelin.stm32@...il.com>, netdev@...r.kernel.org, 
	Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next 1/2] net: stmmac: loongson1: provide match data struct

Reviewed-by: Keguang Zhang <keguang.zhang@...il.com>
Tested-by: Keguang Zhang <keguang.zhang@...il.com> # on LS1B & LS1C

On Wed, Jun 18, 2025 at 6:41 PM Russell King (Oracle)
<rmk+kernel@...linux.org.uk> wrote:
>
> Provide a structure for match data rather than using the function
> pointer as match data. This allows stronger type-checking for the
> function itself, and allows extensions to the match data.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
>  .../ethernet/stmicro/stmmac/dwmac-loongson1.c | 24 ++++++++++++++-----
>  1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
> index 3e86810717d3..78d9540be10c 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson1.c
> @@ -46,6 +46,10 @@ struct ls1x_dwmac {
>         struct regmap *regmap;
>  };
>
> +struct ls1x_data {
> +       int (*init)(struct platform_device *pdev, void *bsp_priv);
> +};
> +
>  static int ls1b_dwmac_syscon_init(struct platform_device *pdev, void *priv)
>  {
>         struct ls1x_dwmac *dwmac = priv;
> @@ -143,9 +147,9 @@ static int ls1x_dwmac_probe(struct platform_device *pdev)
>  {
>         struct plat_stmmacenet_data *plat_dat;
>         struct stmmac_resources stmmac_res;
> +       const struct ls1x_data *data;
>         struct regmap *regmap;
>         struct ls1x_dwmac *dwmac;
> -       int (*init)(struct platform_device *pdev, void *priv);
>         int ret;
>
>         ret = stmmac_get_platform_resources(pdev, &stmmac_res);
> @@ -159,8 +163,8 @@ static int ls1x_dwmac_probe(struct platform_device *pdev)
>                 return dev_err_probe(&pdev->dev, PTR_ERR(regmap),
>                                      "Unable to find syscon\n");
>
> -       init = of_device_get_match_data(&pdev->dev);
> -       if (!init) {
> +       data = of_device_get_match_data(&pdev->dev);
> +       if (!data) {
>                 dev_err(&pdev->dev, "No of match data provided\n");
>                 return -EINVAL;
>         }
> @@ -175,21 +179,29 @@ static int ls1x_dwmac_probe(struct platform_device *pdev)
>                                      "dt configuration failed\n");
>
>         plat_dat->bsp_priv = dwmac;
> -       plat_dat->init = init;
> +       plat_dat->init = data->init;
>         dwmac->plat_dat = plat_dat;
>         dwmac->regmap = regmap;
>
>         return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
>  }
>
> +static const struct ls1x_data ls1b_dwmac_data = {
> +       .init = ls1b_dwmac_syscon_init,
> +};
> +
> +static const struct ls1x_data ls1c_dwmac_data = {
> +       .init = ls1c_dwmac_syscon_init,
> +};
> +
>  static const struct of_device_id ls1x_dwmac_match[] = {
>         {
>                 .compatible = "loongson,ls1b-gmac",
> -               .data = &ls1b_dwmac_syscon_init,
> +               .data = &ls1b_dwmac_data,
>         },
>         {
>                 .compatible = "loongson,ls1c-emac",
> -               .data = &ls1c_dwmac_syscon_init,
> +               .data = &ls1c_dwmac_data,
>         },
>         { }
>  };
> --
> 2.30.2
>


-- 
Best regards,

Keguang Zhang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ