Re: [PATCH net-next v3 4/5] net: stmmac: add support for RZ/N1 GMAC
From: Serge Semin
Date: Tue Apr 16 2024 - 10:48:20 EST
On Mon, Apr 15, 2024 at 11:18:44AM +0200, Romain Gantois wrote:
> [...]
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
> new file mode 100644
> index 0000000000000..e85524c2017cf
> --- /dev/null
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
> @@ -0,0 +1,88 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2024 Schneider-Electric
> + *
> + * Clément Léger <clement.leger@xxxxxxxxxxx>
> + */
> +
> +#include <linux/of.h>
> +#include <linux/pcs-rzn1-miic.h>
> +#include <linux/phylink.h>
> +#include <linux/platform_device.h>
> +
> +#include "stmmac_platform.h"
> +#include "stmmac.h"
> +
> +static int rzn1_dwmac_pcs_init(struct stmmac_priv *priv,
> + struct mac_device_info *hw)
AFAICS hw is unused, and the mac_device_info instance is reached via
the priv pointer. What about dropping the unused argument then?
> +{
> + struct device_node *np = priv->device->of_node;
> + struct device_node *pcs_node;
> + struct phylink_pcs *pcs;
> +
> + pcs_node = of_parse_phandle(np, "pcs-handle", 0);
> +
> + if (pcs_node) {
> + pcs = miic_create(priv->device, pcs_node);
> + of_node_put(pcs_node);
> + if (IS_ERR(pcs))
> + return PTR_ERR(pcs);
> +
> + priv->hw->phylink_pcs = pcs;
> + }
> +
> + return 0;
> +}
> +
> +static void rzn1_dwmac_pcs_exit(struct stmmac_priv *priv,
> + struct mac_device_info *hw)
ditto.
-Serge(y)
> +{
> + if (priv->hw->phylink_pcs)
> + miic_destroy(priv->hw->phylink_pcs);
> +}
> +
> [...]