Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Akshay Gupta" <Akshay.Gupta@amd.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v4 1/8] hwmon/misc: amd-sbi: Move core sbtsi support from hwmon to misc
Date: Fri, 10 Jul 2026 11:26:35 +0000	[thread overview]
Message-ID: <20260710112635.EE0161F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260710111642.850022-2-Akshay.Gupta@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Using the I2C client address directly as the auxiliary device instance ID causes sysfs name collisions and probe failures if identical devices reside at the same address on different I2C buses.
--

--- Patch [1]: [PATCH v4 1/8] hwmon/misc: amd-sbi: Move core sbtsi support from hwmon to misc ---
commit 00ce49f593f00850072fde683389c8cb1954ee34
Author: Prathima <Prathima.Lk@amd.com>

hwmon/misc: amd-sbi: Move core sbtsi support from hwmon to misc

This commit moves the SBTSI core functionality out of the hwmon-only path
and into drivers/misc/amd-sbi so it can be reused. It creates an auxiliary
device for the hwmon driver to bind to and adds the appropriate build
dependencies.

> diff --git a/drivers/misc/amd-sbi/tsi.c b/drivers/misc/amd-sbi/tsi.c
> new file mode 100644
> index 0000000000000..67d08df28429d
> --- /dev/null
> +++ b/drivers/misc/amd-sbi/tsi.c

[ ... ]

> +static int sbtsi_create_hwmon_adev(struct device *dev, u8 dev_addr)
> +{
> +	struct auxiliary_device *adev;
> +	int ret;
> +
> +	adev = kzalloc_obj(*adev);
> +	if (!adev)
> +		return -ENOMEM;
> +
> +	adev->name = AMD_SBTSI_AUX_HWMON;
> +	adev->id = dev_addr;

[Severity: Medium]
Could using the I2C client address directly as the auxiliary device instance
ID cause sysfs name collisions and probe failures if identical devices reside
at the same address on different I2C buses?

If multiple sensors are present on different I2C buses but share the same I2C
address, the driver assigns them identical auxiliary device IDs. The auxiliary
bus subsystem aggregates all devices into a single virtual namespace
(/sys/bus/auxiliary/devices/amd-sbtsi.temp-sensor.<id>), so device_add()
could return -EEXIST and cause subsequent probes to fail.

While the comments below mention that multi-socket systems provide unique I2C
addresses even across different buses, relying on platform-specific hardware
strapping assumptions for globally unique software identifiers can be fragile.

Would it make sense to use the IDA framework here to dynamically allocate
globally unique instance IDs?

> +	adev->dev.parent = dev;
> +	adev->dev.release = sbtsi_adev_release;
> +
> +	ret = auxiliary_device_init(adev);

[ ... ]

> +static int sbtsi_i2c_probe(struct i2c_client *client)
> +{
> +	struct device *dev = &client->dev;
> +	struct sbtsi_data *data;
> +	int err;

[ ... ]

> +	dev_set_drvdata(dev, data);
> +	/* In a multi-socket system, devices that are otherwise identical do not
> +	 * share the same static address; each instance resides at a unique I2C
> +	 * client address on the same or different bus. Use the I2C client
> +	 * address as the auxiliary device instance ID to ensure each socket
> +	 * receives a distinct auxiliary device name.
> +	 */
> +	return sbtsi_create_hwmon_adev(dev, client->addr);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260710111642.850022-1-Akshay.Gupta@amd.com?part=1

  reply	other threads:[~2026-07-10 11:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 11:16 [PATCH v4 0/8] misc: amd-sbi: Refactor SBTSI driver with I3C support and ioctl interface Akshay Gupta
2026-07-10 11:16 ` [PATCH v4 1/8] hwmon/misc: amd-sbi: Move core sbtsi support from hwmon to misc Akshay Gupta
2026-07-10 11:26   ` sashiko-bot [this message]
2026-07-10 14:26   ` Guenter Roeck
2026-07-10 11:16 ` [PATCH v4 2/8] hwmon: sbtsi_temp: Refactor temperature register access into helpers Akshay Gupta
2026-07-10 11:30   ` sashiko-bot
2026-07-10 14:27   ` Guenter Roeck
2026-07-10 11:16 ` [PATCH v4 3/8] hwmon/misc: amd-sbi: Move sbtsi register transfer to core abstraction Akshay Gupta
2026-07-10 11:25   ` sashiko-bot
2026-07-10 14:28   ` Guenter Roeck
2026-07-10 11:16 ` [PATCH v4 4/8] misc: amd-sbi: Consolidate Common SBTSI Probe Path Akshay Gupta
2026-07-10 11:25   ` sashiko-bot
2026-07-10 11:16 ` [PATCH v4 5/8] misc: amd-sbi: Add support for SB-TSI over I3C Akshay Gupta
2026-07-10 11:34   ` sashiko-bot
2026-07-10 11:16 ` [PATCH v4 6/8] misc: amd-sbi: Add SBTSI ioctl register transfer interface Akshay Gupta
2026-07-10 11:28   ` sashiko-bot
2026-07-10 11:16 ` [PATCH v4 7/8] hwmon: Add mutex protecting for sbtsi read/write through hwmon Akshay Gupta
2026-07-10 11:37   ` sashiko-bot
2026-07-10 14:28   ` Guenter Roeck
2026-07-10 11:16 ` [PATCH v4 8/8] docs: misc: amd-sbi: Document SBTSI userspace interface Akshay Gupta
2026-07-10 11:35   ` 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=20260710112635.EE0161F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Akshay.Gupta@amd.com \
    --cc=linux-hwmon@vger.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