Linux-PHY Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "AngeloGioacchino Del Regno" <angelogioacchino.delregno@collabora.com>
Cc: linux-phy@lists.infradead.org, vkoul@kernel.org,
	olteanv@gmail.com, neil.armstrong@linaro.org
Subject: Re: [PATCH v9 04/10] spmi: Implement spmi_subdevice_alloc_and_add() and devm variant
Date: Mon, 08 Jun 2026 10:43:22 +0000	[thread overview]
Message-ID: <20260608104323.3B15D1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260608100949.36309-5-angelogioacchino.delregno@collabora.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dev_set_name() uses the '%d' format specifier for a variable of type 'unsigned int', which will cause a -Wformat compiler warning.
--

commit 35ac69140b9b2d8a3b0e2aa01fe5f5ac3ffe4d02
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

spmi: Implement spmi_subdevice_alloc_and_add() and devm variant

This commit introduces functions for managing sub-devices of an SPMI
device, including spmi_subdevice_alloc_and_add() and its devm
variant. These allow complex PMICs with multiple sub-devices to be
properly modeled and managed via the SPMI bus.

> diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
> index 91a40ea8031ad..7945cacf6d655 100644
> --- a/drivers/spmi/spmi.c
> +++ b/drivers/spmi/spmi.c

[ ... ]

> @@ -428,6 +454,58 @@ struct spmi_device *spmi_device_alloc(struct spmi_controller *ctrl)
>  }
>  EXPORT_SYMBOL_GPL(spmi_device_alloc);
>  
> +/**
> + * spmi_subdevice_alloc_and_add(): Allocate and add a new SPMI sub-device
> + * @sparent:	SPMI parent device with previously registered SPMI controller
> + *
> + * Returns:
> + * Pointer to newly allocated SPMI sub-device for success or error pointer.
> + */
> +struct spmi_subdevice *spmi_subdevice_alloc_and_add(struct spmi_device *sparent)
> +{
> +	struct spmi_subdevice *sub_sdev;
> +	struct spmi_device *sdev;
> +	int ret;
> +
> +	sub_sdev = kzalloc(sizeof(*sub_sdev), GFP_KERNEL);
> +	if (!sub_sdev)
> +		return ERR_PTR(-ENOMEM);
> +
> +	sdev = &sub_sdev->sdev;
> +	sdev->ctrl = sparent->ctrl;
> +	sdev->usid = sparent->usid;
> +
> +	ret = ida_alloc(&spmi_subdevice_ida, GFP_KERNEL);
> +	if (ret < 0) {
> +		kfree(sub_sdev);
> +		return ERR_PTR(ret);
> +	}
> +	sub_sdev->devid = ret;
> +
> +	device_initialize(&sdev->dev);
> +	sdev->dev.parent = &sparent->dev;
> +	sdev->dev.bus = &spmi_bus_type;
> +	sdev->dev.type = &spmi_subdev_type;
> +
> +	ret = dev_set_name(&sdev->dev, "%u-%02x.%d.auto",
> +			   sdev->ctrl->nr, sdev->usid, sub_sdev->devid);

[Severity: Low]
This isn't a bug, but should this use %u instead of %d for the format
specifier? The devid field in struct spmi_subdevice is defined as an
unsigned int, which can cause a -Wformat compiler warning here.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260608100949.36309-1-angelogioacchino.delregno@collabora.com?part=4

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

  reply	other threads:[~2026-06-08 10:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08 10:09 [PATCH v9 00/10] SPMI: Implement sub-devices and migrate drivers AngeloGioacchino Del Regno
2026-06-08 10:09 ` [PATCH v9 01/10] spmi: Remove redundant dev_name() print in spmi_device_add() AngeloGioacchino Del Regno
2026-06-08 10:09 ` [PATCH v9 02/10] spmi: Print error status with %pe format AngeloGioacchino Del Regno
2026-06-08 10:37   ` sashiko-bot
2026-06-08 11:29     ` AngeloGioacchino Del Regno
2026-06-08 10:09 ` [PATCH v9 03/10] spmi: Remove unneeded goto in spmi_device_add() error path AngeloGioacchino Del Regno
2026-06-08 10:09 ` [PATCH v9 04/10] spmi: Implement spmi_subdevice_alloc_and_add() and devm variant AngeloGioacchino Del Regno
2026-06-08 10:43   ` sashiko-bot [this message]
2026-06-08 11:27     ` AngeloGioacchino Del Regno
2026-06-08 10:09 ` [PATCH v9 05/10] nvmem: qcom-spmi-sdam: Migrate to devm_spmi_subdevice_alloc_and_add() AngeloGioacchino Del Regno
2026-06-08 10:54   ` sashiko-bot
2026-06-08 11:32     ` AngeloGioacchino Del Regno
2026-06-08 10:09 ` [PATCH v9 06/10] power: reset: qcom-pon: " AngeloGioacchino Del Regno
2026-06-08 10:09 ` [PATCH v9 07/10] phy: qualcomm: eusb2-repeater: " AngeloGioacchino Del Regno
2026-06-08 10:09 ` [PATCH v9 08/10] misc: qcom-coincell: " AngeloGioacchino Del Regno
2026-06-08 11:09   ` sashiko-bot
2026-06-08 11:32     ` AngeloGioacchino Del Regno
2026-06-08 10:09 ` [PATCH v9 09/10] iio: adc: qcom-spmi-iadc: " AngeloGioacchino Del Regno
2026-06-08 10:09 ` [PATCH v9 10/10] iio: adc: qcom-spmi-iadc: Remove regmap R/W wrapper functions AngeloGioacchino Del Regno

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=20260608104323.3B15D1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox