Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jisheng Zhang" <jszhang@kernel.org>
Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-gpio@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 06/13] soc: synaptics: add SL2610 system controller support
Date: Sun, 15 Nov 2026 10:56:35 +0000	[thread overview]
Message-ID: <sashiko-outbox-215428@kernel.org> (raw)
In-Reply-To: <20261115102401.3520-7-jszhang@kernel.org>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Low] soc: synaptics: new MFD driver sl2610-syscon placed outside
  drivers/mfd
- [Low] soc: synaptics: MFD used for single-function AVIO and CPU clock
  blocks
- [Low] soc: synaptics: mfd_cell arrays passed via match data in
  sl2610_syscon_probe()
--

commit 13fffaa081530baa348dec7822fd2e447d70af16
Author: Jisheng Zhang <jszhang@kernel.org>

soc: synaptics: add SL2610 system controller support

This commit adds a driver for the Synaptics SL2610 system control blocks to
register their clock, reset, and pin controller child devices via MFD.

> diff --git a/drivers/soc/synaptics/Kconfig b/drivers/soc/synaptics/Kconfig
> new file mode 100644
> index 0000000000000..9f0324a1a3b7a
> --- /dev/null
> +++ b/drivers/soc/synaptics/Kconfig
> @@ -0,0 +1,14 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +config SOC_SL2610_SYSCON
> +	tristate "Synaptics SL2610 system controller"
> +	depends on ARCH_BERLIN || COMPILE_TEST
> +	depends on OF && HAS_IOMEM
> +	select MFD_CORE
> +	select MFD_SYSCON

[Severity: Low]
Should this driver live under drivers/mfd/ instead of drivers/soc/synaptics/?

sl2610-syscon.c does not implement any SoC bus or SoC-specific service and
only calls devm_mfd_add_devices() to instantiate MFD child devices.  New core
MFD drivers and new calls to devm_mfd_add_devices() belong in drivers/mfd/.

> diff --git a/drivers/soc/synaptics/sl2610-syscon.c b/drivers/soc/synaptics/sl2610-syscon.c
> new file mode 100644
> index 0000000000000..c6fc2955ac0de
> --- /dev/null
> +++ b/drivers/soc/synaptics/sl2610-syscon.c
> @@ -0,0 +1,84 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (C) 2026 Synaptics Incorporated
> + */
> +
> +#include <linux/mfd/core.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +struct sl2610_syscon_data {
> +	const struct mfd_cell *cells;
> +	unsigned int num_cells;
> +};
> +
> +static const struct mfd_cell sl2610_soc_cells[] = {
> +	MFD_CELL_NAME("sl2610-soc-clk"),
> +	MFD_CELL_NAME("sl2610-soc-reset"),
> +	MFD_CELL_NAME("sl2610-soc-pinctrl"),
> +};
> +
> +static const struct mfd_cell sl2610_mcu_cells[] = {
> +	MFD_CELL_NAME("sl2610-mcu-clk"),
> +	MFD_CELL_NAME("sl2610-mcu-reset"),
> +	MFD_CELL_NAME("sl2610-mcu-pinctrl"),
> +};
> +
> +static const struct mfd_cell sl2610_avio_cells[] = {
> +	MFD_CELL_NAME("sl2610-avio-clk"),
> +};
> +
> +static const struct mfd_cell sl2610_cpu_cells[] = {
> +	MFD_CELL_NAME("sl2610-cpu-clk"),
> +};

[Severity: Low]
Why use MFD for the single-function AVIO and CPU clock blocks?

sl2610_avio_cells and sl2610_cpu_cells each register only a single clock
child device, and per the syna,sl2610-soc-syscon binding neither block
provides reset or pinctrl functions.  MFD is intended for devices that
register multiple children across different subsystems, whereas the clock
driver can bind directly to syna,sl2610-avio-syscon and
syna,sl2610-cpu-syscon while keeping shared regmap access through the
generic syscon compatible.

> +
> +static const struct sl2610_syscon_data sl2610_soc_data = {
> +	.cells = sl2610_soc_cells,
> +	.num_cells = ARRAY_SIZE(sl2610_soc_cells),
> +};
> +
> +static const struct sl2610_syscon_data sl2610_mcu_data = {
> +	.cells = sl2610_mcu_cells,
> +	.num_cells = ARRAY_SIZE(sl2610_mcu_cells),
> +};
> +
> +static const struct sl2610_syscon_data sl2610_avio_data = {
> +	.cells = sl2610_avio_cells,
> +	.num_cells = ARRAY_SIZE(sl2610_avio_cells),
> +};
> +
> +static const struct sl2610_syscon_data sl2610_cpu_data = {
> +	.cells = sl2610_cpu_cells,
> +	.num_cells = ARRAY_SIZE(sl2610_cpu_cells),
> +};
> +
> +static int sl2610_syscon_probe(struct platform_device *pdev)
> +{
> +	const struct sl2610_syscon_data *data = device_get_match_data(&pdev->dev);
> +
> +	return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
> +				    data->cells, data->num_cells, NULL, 0, NULL);
> +}
> +
> +static const struct of_device_id sl2610_syscon_of_match[] = {
> +	{ .compatible = "syna,sl2610-soc-syscon", .data = &sl2610_soc_data },
> +	{ .compatible = "syna,sl2610-mcu-syscon", .data = &sl2610_mcu_data },
> +	{ .compatible = "syna,sl2610-avio-syscon", .data = &sl2610_avio_data },
> +	{ .compatible = "syna,sl2610-cpu-syscon", .data = &sl2610_cpu_data },
> +	{ }
> +};

[Severity: Low]
This isn't a bug in normal DT probing, but MFD drivers should not pass
mfd_cell arrays through the .data field of of_device_id tables.  In addition,
if the driver is bound without an OF match (such as via sysfs
driver_override), device_get_match_data() returns NULL and
sl2610_syscon_probe() dereferences a NULL data pointer.

Could sl2610_syscon_of_match store an enum or integer ID in .data and select
the static const mfd_cell array with a switch statement (and a default error
return) in sl2610_syscon_probe()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261115102401.3520-1-jszhang@kernel.org?part=6

  reply	other threads:[~2026-11-15 10:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 10:23 [PATCH v2 00/13] arm64: add Synaptics SL2610 SoCs and RDK boards Jisheng Zhang
2026-11-15 10:23 ` [PATCH v2 01/13] arm64: kconfig: let ARCH_BERLIN cover Synaptics arm64 SoCs Jisheng Zhang
2026-11-15 10:23 ` [PATCH v2 02/13] pinctrl: berlin: use u16 instead of u8 for the offset Jisheng Zhang
2026-11-15 10:23 ` [PATCH v2 03/13] pinctrl: berlin: enable module build support Jisheng Zhang
2026-11-15 10:58   ` sashiko-bot
2026-11-15 10:23 ` [PATCH v2 04/13] pinctrl: berlin: add optional pinconf support Jisheng Zhang
2026-11-15 11:01   ` sashiko-bot
2026-11-15 10:23 ` [PATCH v2 05/13] dt-bindings: soc: synaptics: add SL2610 system controllers Jisheng Zhang
2026-11-15 10:58   ` sashiko-bot
2026-11-15 10:23 ` [PATCH v2 06/13] soc: synaptics: add SL2610 system controller support Jisheng Zhang
2026-11-15 10:56   ` sashiko-bot [this message]
2026-11-15 10:23 ` [PATCH v2 07/13] reset: add Synaptics SL2610 reset " Jisheng Zhang
2026-11-15 11:12   ` sashiko-bot
2026-11-15 10:23 ` [PATCH v2 08/13] pinctrl: berlin: add Synaptics SL2610 pin " Jisheng Zhang
2026-11-15 10:57   ` sashiko-bot
2026-11-15 10:23 ` [PATCH v2 09/13] clk: berlin: add Synaptics clock controller helpers Jisheng Zhang
2026-11-15 11:05   ` sashiko-bot
2026-11-15 10:23 ` [PATCH v2 10/13] clk: berlin: add Synaptics SL2610 clocks and PLLs Jisheng Zhang
2026-11-15 11:04   ` sashiko-bot
2026-11-15 10:23 ` [PATCH v2 11/13] dt-bindings: arm: berlin: add Synaptics SL2610 SoCs and RDK boards Jisheng Zhang
2026-11-15 10:23 ` [PATCH v2 12/13] arm64: dts: synaptics: add SL2610 family SoCs Jisheng Zhang
2026-11-15 11:13   ` sashiko-bot
2026-11-15 10:23 ` [PATCH v2 13/13] arm64: dts: synaptics: add SL2610 family RDK boards Jisheng Zhang
2026-11-15 11:05   ` 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=sashiko-outbox-215428@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jszhang@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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