All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: "Stefan Dösinger" <stefandoesinger@gmail.com>,
	vkoul@kernel.org, devicetree@vger.kernel.org,
	mfd@lists.linux.dev, olteanv@gmail.com, conor+dt@kernel.org,
	neil.armstrong@linaro.org, linux-phy@lists.infradead.org,
	robh@kernel.org
Subject: Re: [PATCH v8 04/12] mfd: zx297520v3: Add a clock and reset MFD driver
Date: Thu, 6 Aug 2026 15:31:03 +0100	[thread overview]
Message-ID: <20260806143103.GN2869284@google.com> (raw)
In-Reply-To: <20260727184155.2F0A61F000E9@smtp.kernel.org>

On Mon, 27 Jul 2026, sashiko-bot@kernel.org wrote:

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Platform data for child devices (`mfd_cell` arrays) is improperly passed as complex pointers via the `.data` field of the `of_device_id` match table.
> --
> 
> --- Patch [4]: [PATCH v8 04/12] mfd: zx297520v3: Add a clock and reset MFD driver ---
> commit 997b3ee44abc6ec239c36327d1c3fd90393542dd
> Author: Stefan Dösinger <stefandoesinger@gmail.com>
> 
> mfd: zx297520v3: Add a clock and reset MFD driver
> 
> This driver registers child devices for the zx297520v3 clock and reset
> controllers. The clk-zx297520v3 and reset-zte-zx297520v3 submitted in
> the next patches will drive the respective functionalities.
> 
> > diff --git a/drivers/mfd/zte-zx297520v3-crm.c b/drivers/mfd/zte-zx297520v3-crm.c
> > new file mode 100644
> > index 0000000000000..3a4f6cd0756e3
> > --- /dev/null
> > +++ b/drivers/mfd/zte-zx297520v3-crm.c
> 
> [ ... ]
> 
> > +static int zx297520v3_crm_probe(struct platform_device *pdev)
> > +{
> > +	const struct zx297520v3_crm_data *data;
> > +
> > +	data = of_device_get_match_data(&pdev->dev);
> > +	if (!data)
> > +		return -ENODEV;
> > +
> > +	return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, data->cells,
> > +				    data->num_cells, NULL, 0, NULL);
> > +}
> > +
> > +static const struct of_device_id of_match_zx297520v3_crm[] = {
> > +	{ .compatible = "zte,zx297520v3-topcrm", .data = &zx297520v3_topcrm_data },
> > +	{ .compatible = "zte,zx297520v3-matrixcrm", .data = &zx297520v3_matrixcrm_data },
> > +	{ .compatible = "zte,zx297520v3-lspcrm", .data = &zx297520v3_lspcrm_data },
> 
> [Severity: Medium]
> Does passing platform data for child devices via the .data field as complex
> pointers violate MFD subsystem architecture guidelines?
> 
> Instead of mapping compatible strings directly to zx297520v3_crm_data pointers
> via the .data field, should this use an ID enum or integer ID, and have
> zx297520v3_crm_probe() switch on the ID to select the correct static const
> mfd_cell array?

This is correct.  You must not pass one device registration's (MFD) data
through another (OF).  Use a defined integer instead and match in a
switch() statement.  There are lots of examples of this.

-- 
Lee Jones

WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: "Stefan Dösinger" <stefandoesinger@gmail.com>,
	vkoul@kernel.org, devicetree@vger.kernel.org,
	mfd@lists.linux.dev, olteanv@gmail.com, conor+dt@kernel.org,
	neil.armstrong@linaro.org, linux-phy@lists.infradead.org,
	robh@kernel.org
Subject: Re: [PATCH v8 04/12] mfd: zx297520v3: Add a clock and reset MFD driver
Date: Thu, 6 Aug 2026 15:31:03 +0100	[thread overview]
Message-ID: <20260806143103.GN2869284@google.com> (raw)
In-Reply-To: <20260727184155.2F0A61F000E9@smtp.kernel.org>

On Mon, 27 Jul 2026, sashiko-bot@kernel.org wrote:

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Platform data for child devices (`mfd_cell` arrays) is improperly passed as complex pointers via the `.data` field of the `of_device_id` match table.
> --
> 
> --- Patch [4]: [PATCH v8 04/12] mfd: zx297520v3: Add a clock and reset MFD driver ---
> commit 997b3ee44abc6ec239c36327d1c3fd90393542dd
> Author: Stefan Dösinger <stefandoesinger@gmail.com>
> 
> mfd: zx297520v3: Add a clock and reset MFD driver
> 
> This driver registers child devices for the zx297520v3 clock and reset
> controllers. The clk-zx297520v3 and reset-zte-zx297520v3 submitted in
> the next patches will drive the respective functionalities.
> 
> > diff --git a/drivers/mfd/zte-zx297520v3-crm.c b/drivers/mfd/zte-zx297520v3-crm.c
> > new file mode 100644
> > index 0000000000000..3a4f6cd0756e3
> > --- /dev/null
> > +++ b/drivers/mfd/zte-zx297520v3-crm.c
> 
> [ ... ]
> 
> > +static int zx297520v3_crm_probe(struct platform_device *pdev)
> > +{
> > +	const struct zx297520v3_crm_data *data;
> > +
> > +	data = of_device_get_match_data(&pdev->dev);
> > +	if (!data)
> > +		return -ENODEV;
> > +
> > +	return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, data->cells,
> > +				    data->num_cells, NULL, 0, NULL);
> > +}
> > +
> > +static const struct of_device_id of_match_zx297520v3_crm[] = {
> > +	{ .compatible = "zte,zx297520v3-topcrm", .data = &zx297520v3_topcrm_data },
> > +	{ .compatible = "zte,zx297520v3-matrixcrm", .data = &zx297520v3_matrixcrm_data },
> > +	{ .compatible = "zte,zx297520v3-lspcrm", .data = &zx297520v3_lspcrm_data },
> 
> [Severity: Medium]
> Does passing platform data for child devices via the .data field as complex
> pointers violate MFD subsystem architecture guidelines?
> 
> Instead of mapping compatible strings directly to zx297520v3_crm_data pointers
> via the .data field, should this use an ID enum or integer ID, and have
> zx297520v3_crm_probe() switch on the ID to select the correct static const
> mfd_cell array?

This is correct.  You must not pass one device registration's (MFD) data
through another (OF).  Use a defined integer instead and match in a
switch() statement.  There are lots of examples of this.

-- 
Lee Jones

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2026-08-06 14:31 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 18:24 [PATCH v8 00/12] ZTE zx297520v3 clock bindings and driver Stefan Dösinger
2026-07-27 18:24 ` Stefan Dösinger
2026-07-27 18:24 ` [PATCH v8 01/12] dt-bindings: clk: zte: Add zx297520v3 top clock and reset controller Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 18:32   ` sashiko-bot
2026-07-27 18:32     ` sashiko-bot
2026-07-28  6:27   ` Krzysztof Kozlowski
2026-07-28  6:27     ` Krzysztof Kozlowski
2026-07-28 18:10     ` Stefan Dösinger
2026-07-28 18:10       ` Stefan Dösinger
2026-07-30  6:19       ` Krzysztof Kozlowski
2026-07-30  6:19         ` Krzysztof Kozlowski
2026-07-27 18:24 ` [PATCH v8 02/12] dt-bindings: clk: zte: Add zx297520v3 matrix " Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 18:34   ` sashiko-bot
2026-07-27 18:34     ` sashiko-bot
2026-07-28  6:31   ` Krzysztof Kozlowski
2026-07-28  6:31     ` Krzysztof Kozlowski
2026-07-27 18:24 ` [PATCH v8 03/12] dt-bindings: clk: zte: Add zx297520v3 LSP " Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 18:36   ` sashiko-bot
2026-07-27 18:36     ` sashiko-bot
2026-07-27 18:24 ` [PATCH v8 04/12] mfd: zx297520v3: Add a clock and reset MFD driver Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 18:41   ` sashiko-bot
2026-07-27 18:41     ` sashiko-bot
2026-08-06 14:31     ` Lee Jones [this message]
2026-08-06 14:31       ` Lee Jones
2026-08-06 18:33       ` Stefan Dösinger
2026-08-06 18:33         ` Stefan Dösinger
2026-07-27 18:24 ` [PATCH v8 05/12] clk: zte: Add Clock registration infrastructure Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 18:52   ` sashiko-bot
2026-07-27 18:52     ` sashiko-bot
2026-07-28 13:38   ` Brian Masney
2026-07-28 13:38     ` Brian Masney
2026-07-28 13:53     ` Brian Masney
2026-07-28 13:53       ` Brian Masney
2026-07-28 21:25       ` Stefan Dösinger
2026-07-28 21:25         ` Stefan Dösinger
2026-07-30 17:38         ` Brian Masney
2026-07-30 17:38           ` Brian Masney
2026-07-27 18:24 ` [PATCH v8 06/12] clk: zte: Add regmap-based clocks Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 19:03   ` sashiko-bot
2026-07-27 19:03     ` sashiko-bot
2026-07-28 13:42   ` Brian Masney
2026-07-28 13:42     ` Brian Masney
2026-07-27 18:24 ` [PATCH v8 07/12] clk: zte: Add zx PLL support infrastructure Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 19:15   ` sashiko-bot
2026-07-27 19:15     ` sashiko-bot
2026-07-27 18:24 ` [PATCH v8 08/12] clk: zte: Introduce a driver for zx297520v3 top clocks Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 19:29   ` sashiko-bot
2026-07-27 19:29     ` sashiko-bot
2026-07-27 18:24 ` [PATCH v8 09/12] clk: zte: Introduce a driver for zx297520v3 matrix clocks Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 19:41   ` sashiko-bot
2026-07-27 19:41     ` sashiko-bot
2026-07-27 18:24 ` [PATCH v8 10/12] clk: zte: Introduce a driver for zx297520v3 LSP clocks Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 19:46   ` sashiko-bot
2026-07-27 19:46     ` sashiko-bot
2026-07-27 18:24 ` [PATCH v8 11/12] reset: zte: Add a zx297520v3 reset driver Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 19:59   ` sashiko-bot
2026-07-27 19:59     ` sashiko-bot
2026-07-27 18:24 ` [PATCH v8 12/12] ARM: dts: zte: Declare zx297520v3 CRM device nodes Stefan Dösinger
2026-07-27 18:24   ` Stefan Dösinger
2026-07-27 20:13   ` sashiko-bot
2026-07-27 20:13     ` sashiko-bot

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=20260806143103.GN2869284@google.com \
    --to=lee@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=mfd@lists.linux.dev \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=stefandoesinger@gmail.com \
    --cc=vkoul@kernel.org \
    /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.