All of lore.kernel.org
 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 1/2] net: maxlinear: Add build support for MxL SoC
Date: Fri, 22 Aug 2025 11:42:40 +0200	[thread overview]
Message-ID: <a596db6b-bbc5-4670-ac9f-e6822bad83fa@kernel.org> (raw)
In-Reply-To: <20250822090809.1464232-2-jchng@maxlinear.com>

On 22/08/2025 11:08, Jack Ping CHNG wrote:
> Add build infrastructure for MxL network driver.
> Ethernet driver to initialize and create network devices.

Please wrap commit message according to Linux coding style / submission
process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597

What is a "build support for a driver/soc"? Confusing.


...

> + */
> +#include <linux/clk.h>
> +#include <linux/etherdevice.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/netdevice.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/reset.h>
> +
> +#define ETH_TX_TIMEOUT		(10 * HZ)
> +#define MXL_NUM_TX_RING		8
> +#define MXL_NUM_RX_RING		8
> +#define MXL_NUM_PORT		2
> +
> +static const char * const clk_names = "ethif";

Drop, pretty useless.

...

> +
> +static void mxl_eth_cleanup(struct mxl_eth_drvdata *pdata)
> +{
> +	int i;
> +
> +	for (i = 0; i < MXL_NUM_PORT && pdata->ndevs[i]; i++) {
> +		unregister_netdev(pdata->ndevs[i]);
> +		pdata->ndevs[i] = NULL;
> +	}
> +
> +	if (!IS_ERR(pdata->clks))

Hm? Why?

> +		clk_disable_unprepare(pdata->clks);
> +}
> +
> +static int mxl_eth_probe(struct platform_device *pdev)
> +{
> +	struct mxl_eth_drvdata *pdata;
> +	struct reset_control *rst;
> +	struct net_device *ndev;
> +	struct device_node *np;
> +	int ret, i;
> +
> +	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> +	if (!pdata)
> +		return -ENOMEM;
> +
> +	pdata->clks = devm_clk_get(&pdev->dev, clk_names);
> +	if (IS_ERR(pdata->clks)) {
> +		dev_err(&pdev->dev, "failed to get %s\n", clk_names);

You are sending us some 10 year old coding style. This is supposed to be
dev_err_probe and devm_get_clk_enabled.

I think my second talk for OSSE 25 about static analyzers is also
suitable...

> +		return PTR_ERR(pdata->clks);
> +	}
> +
> +	ret = clk_prepare_enable(pdata->clks);

> +	if (ret) {
> +		dev_err(&pdev->dev, "failed to enable %s\n", clk_names);
> +		return ret;
> +	}
> +
> +	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));
> +		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, pdata);
> +
> +	i = 0;
> +	for_each_available_child_of_node(pdev->dev.of_node, np) {
> +		if (!of_device_is_compatible(np, "mxl,eth-mac"))
> +			continue;
> +
> +		if (!of_device_is_available(np))

Redundant.


Best regards,
Krzysztof

  reply	other threads:[~2025-08-22  9:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22  9:08 [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding Jack Ping CHNG
2025-08-22  9:08 ` [PATCH net-next 1/2] net: maxlinear: Add build support for MxL SoC Jack Ping CHNG
2025-08-22  9:42   ` Krzysztof Kozlowski [this message]
2025-08-22 14:58   ` Andrew Lunn
2025-08-22  9:08 ` [PATCH net-next 2/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC Jack Ping CHNG
2025-08-22  9:39   ` Krzysztof Kozlowski
2025-08-22 12:58   ` Rob Herring (Arm)
2025-08-22 15:06 ` [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding Andrew Lunn

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=a596db6b-bbc5-4670-ac9f-e6822bad83fa@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.