Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Andy Chung" <Andy.Chung@amd.com>
Cc: conor+dt@kernel.org, robh@kernel.org,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 3/4] hwmon: (kb9002) Add driver for Kandou KB9002 retimer
Date: Wed, 15 Jul 2026 09:17:23 +0000	[thread overview]
Message-ID: <20260715091724.18BC21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715-kb9002-upstream-v2-3-2fd390383da5@amd.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The driver implements its own internal mutex for locking hardware accesses instead of using the hwmon subsystem's `hwmon_lock()` API.
- [Low] The `i2c_device_id` array is initialized using a positional instead of a named initializer.
--

--- Patch [3]: [PATCH v2 3/4] hwmon: (kb9002) Add driver for Kandou KB9002 retimer ---
commit 59c6448090144292eb629f4257436694b1eaaa0d
Author: Andy Chung <Andy.Chung@amd.com>

hwmon: (kb9002) Add driver for Kandou KB9002 retimer
    
The Kandou KB9002 is an 8-lane PCIe 5.0 retimer that exposes an SMBus
target with mandatory PEC. Add a hwmon driver reporting the firmware
aggregated maximum die temperature as temp1_input, with the firmware
version and boot status under debugfs.

> diff --git a/drivers/hwmon/kb9002.c b/drivers/hwmon/kb9002.c
> new file mode 100644
> index 0000000000000..94c7d95b3fff5
> --- /dev/null
> +++ b/drivers/hwmon/kb9002.c
[ ... ]
> +struct kb9002_data {
> +	struct i2c_client *client;
> +	struct mutex lock;	/* serialises register accesses */
> +};
[ ... ]
> +static int kb9002_fw_read(struct kb9002_data *data, u16 reg, u32 *val)
> +{
> +	struct i2c_client *client = data->client;
> +	u8 addr[2];
> +	u8 rbuf[I2C_SMBUS_BLOCK_MAX];
> +	int ret;
> +
> +	put_unaligned_le16(reg, addr);
> +
> +	mutex_lock(&data->lock);

[Severity: Medium]
Is this custom mutex necessary? The hwmon subsystem guidelines state that
drivers should use hwmon_lock() and hwmon_unlock() to serialize operations
for attributes registered by other means.

By using a custom internal mutex, does the driver bypass the standard
subsystem synchronization architecture and introduce inefficient double-locking
on sysfs reads, which are already protected by the hwmon core?

[ ... ]
> +static const struct i2c_device_id kb9002_id[] = {
> +	{ KB9002_DEV_NAME },
> +	{ }
> +};

[Severity: Low]
This isn't a bug, but does this array initialization bypass the I2C
subsystem guidelines? 

The I2C client initialization rules request that initialized arrays of type
struct i2c_device_id use named initializers rather than positional
initializers.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715-kb9002-upstream-v2-0-2fd390383da5@amd.com?part=3

  reply	other threads:[~2026-07-15  9:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  9:08 [PATCH v2 0/4] hwmon: Add Kandou KB9002 PCIe retimer driver Andy Chung via B4 Relay
2026-07-15  9:08 ` [PATCH v2 1/4] dt-bindings: Add vendor prefix for Kandou Andy Chung via B4 Relay
2026-07-15  9:10   ` sashiko-bot
2026-07-15  9:08 ` [PATCH v2 2/4] dt-bindings: hwmon: Add Kandou KB9002 Andy Chung via B4 Relay
2026-07-15  9:16   ` sashiko-bot
2026-07-15  9:08 ` [PATCH v2 3/4] hwmon: (kb9002) Add driver for Kandou KB9002 retimer Andy Chung via B4 Relay
2026-07-15  9:17   ` sashiko-bot [this message]
2026-07-15  9:08 ` [PATCH v2 4/4] hwmon: (kb9002) Add documentation Andy Chung via B4 Relay
2026-07-15  9:19   ` 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=20260715091724.18BC21F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Andy.Chung@amd.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-hwmon@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