netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Jack Ping CHNG <jchng@maxlinear.com>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org
Cc: davem@davemloft.net, andrew+netdev@lunn.ch, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, yzhu@maxlinear.com,
	sureshnagaraj@maxlinear.com
Subject: Re: [PATCH net-next v2 2/2] net: maxlinear: Add support for MxL LGM SoC
Date: Wed, 27 Aug 2025 14:33:50 +0200	[thread overview]
Message-ID: <bb08014c-c85d-48cd-98d3-0a3fe8f890c6@kernel.org> (raw)
In-Reply-To: <20250826031044.563778-3-jchng@maxlinear.com>

On 26/08/2025 05:10, Jack Ping CHNG wrote:
> Introduce the build system integration and initial implementation for the

Nothing improved - do not describe how kernel works, builds. We all know
Kconfig.

Describe the driver and hardware.

> MaxLinear LGM SoC Ethernet driver. This patch adds Kconfig and Makefile

Please do not use "This commit/patch/change", but imperative mood. See
longer explanation here:
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95


...

> +
> +static int mxl_eth_probe(struct platform_device *pdev)
> +{
> +	struct mxl_eth_drvdata *drvdata;
> +	struct reset_control *rst;
> +	struct net_device *ndev;
> +	struct device_node *np;
> +	int ret, i;
> +
> +	drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
> +	if (!drvdata)
> +		return -ENOMEM;
> +
> +	drvdata->clks = devm_clk_get_enabled(&pdev->dev, "ethif");
> +	if (IS_ERR(drvdata->clks))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->clks),

That's correct...

> +				     "failed to get/enable clock\n");
> +
> +	rst = devm_reset_control_get_optional(&pdev->dev, NULL);
> +	if (IS_ERR(rst)) {
> +		dev_err(&pdev->dev,
> +			"failed to get optional reset control: %ld\n",
> +			PTR_ERR(rst));


But here nothing improved.

Please look how ALL DRIVERS do it? What syntax they use?

Do your homework and really work on this driver. If I pointed issue on
clocks, YOU MUST fix it everywhere, not just clocks.


> +		ret = PTR_ERR(rst);
> +		goto err_cleanup;
> +	}
> +
> +	if (rst) {
> +		ret = reset_control_assert(rst);
> +		if (ret)
> +			goto err_cleanup;
> +
> +		udelay(1);
> +
> +		ret = reset_control_deassert(rst);
> +		if (ret)
> +			goto err_cleanup;
> +	}
> +
> +	platform_set_drvdata(pdev, drvdata);
> +
> +	i = 0;
> +	for_each_available_child_of_node(pdev->dev.of_node, np) {
> +		if (!of_device_is_compatible(np, "mxl,eth-mac"))
> +			continue;
> +
> +		ret = mxl_eth_create_ndev(pdev, np, &ndev);
> +		if (ret)
> +			goto err_cleanup;

You leak of node. Use scoped loop.

> +
> +		drvdata->ndevs[i++] = ndev;
> +		if (i >= MXL_NUM_PORT)
> +			break;
> +	}
> +
> +	return 0;
> +
> +err_cleanup:
> +	mxl_eth_cleanup(drvdata);
> +	return ret;
> +}
> +
> +static void mxl_eth_remove(struct platform_device *pdev)
> +{
> +	struct mxl_eth_drvdata *drvdata = platform_get_drvdata(pdev);
> +
> +	mxl_eth_cleanup(drvdata);
> +}
> +
> +/* Device Tree match table */
> +static const struct of_device_id mxl_eth_of_match[] = {
> +	{ .compatible = "mxl,lgm-eth" },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, mxl_eth_of_match);
> +
> +/* Platform driver struct */
> +static struct platform_driver mxl_eth_drv = {
> +	.probe    = mxl_eth_probe,
> +	.remove   = mxl_eth_remove,
> +	.driver = {
> +		.name = KBUILD_MODNAME,
> +		.of_match_table = mxl_eth_of_match,
> +	},
> +};
> +
> +module_platform_driver(mxl_eth_drv);
> +
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("Ethernet driver for MxL SoC");


Best regards,
Krzysztof

      parent reply	other threads:[~2025-08-27 12:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26  3:10 [PATCH net-next v2 0/2] Add MxL Ethernet driver & devicetree binding Jack Ping CHNG
2025-08-26  3:10 ` [PATCH net-next v2 1/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC Jack Ping CHNG
2025-08-26 12:45   ` Andrew Lunn
2025-08-26 13:05   ` Rob Herring (Arm)
2025-08-27 12:33   ` Krzysztof Kozlowski
2025-08-26  3:10 ` [PATCH net-next v2 2/2] net: maxlinear: Add support for MxL LGM SoC Jack Ping CHNG
2025-08-26 13:03   ` Andrew Lunn
2025-08-27 10:41     ` Jack Ping Chng
2025-08-27 12:16       ` Andrew Lunn
2025-08-26 13:09   ` Jakub Kicinski
2025-08-27 12:33   ` Krzysztof Kozlowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb08014c-c85d-48cd-98d3-0a3fe8f890c6@kernel.org \
    --to=krzk@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=jchng@maxlinear.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=sureshnagaraj@maxlinear.com \
    --cc=yzhu@maxlinear.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).