From: Guenter Roeck <linux@roeck-us.net>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Delphine CC Chiu" <Delphine_CC_Chiu@Wiwynn.com>,
"Jean Delvare" <jdelvare@suse.com>
Cc: linux-i2c@vger.kernel.org, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 1/2] hwmon: (pmbus/ltc4286) Improve device matching
Date: Wed, 10 Jul 2024 07:09:28 -0700 [thread overview]
Message-ID: <c98be2fa-bc08-45cb-bed6-3efeeefa8754@roeck-us.net> (raw)
In-Reply-To: <cf49bf8b0ba4e50e71e0b31471748b50d7b1a055.1720600141.git.u.kleine-koenig@baylibre.com>
On 7/10/24 01:35, Uwe Kleine-König wrote:
> The devices supported by this driver report the model name in their
> register space. The way this is evaluated allows longer strings than the
> driver's model list. Document this behaviour in a code comment to lessen
> the surprise for the next reader.
>
> Additionally emit the reported model name in case of a mismatch.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> drivers/hwmon/pmbus/ltc4286.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hwmon/pmbus/ltc4286.c b/drivers/hwmon/pmbus/ltc4286.c
> index 9e7ceeb7e789..2e5532300eff 100644
> --- a/drivers/hwmon/pmbus/ltc4286.c
> +++ b/drivers/hwmon/pmbus/ltc4286.c
> @@ -95,13 +95,19 @@ static int ltc4286_probe(struct i2c_client *client)
> "Failed to read manufacturer model\n");
> }
>
> - for (mid = ltc4286_id; mid->name[0]; mid++) {
> + for (mid = ltc4286_id; mid->name[0]; mid++)
> + /*
> + * Note that by limiting the comparison to strlen(mid->name)
> + * chars, the device reporting "lTc4286chocolade" is accepted,
> + * too.
> + */
This is misleading; the desired match is LTC4286 and all its variants (LTC4286[A-Z] and
whatever else the vendor can come up with), i.e., it is supposed to include all device
variants, and ignoring case since it is irrelevant. Referring to the odd string just
makes that look unnecessarily bad. I am not going to apply this patch, sorry.
Guenter
next prev parent reply other threads:[~2024-07-10 14:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-10 8:35 [PATCH 0/2] hwmon: (pmbus/ltc4286) two patches about device matching Uwe Kleine-König
2024-07-10 8:35 ` [PATCH 1/2] hwmon: (pmbus/ltc4286) Improve " Uwe Kleine-König
2024-07-10 14:09 ` Guenter Roeck [this message]
2024-07-10 15:48 ` Uwe Kleine-König
2024-07-10 19:16 ` Guenter Roeck
2024-07-11 6:58 ` Uwe Kleine-König
2024-07-10 8:35 ` [PATCH 2/2] hwmon: (pmbus/ltc4286) Drop unused i2c device ids Uwe Kleine-König
2024-07-10 14:11 ` Guenter Roeck
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=c98be2fa-bc08-45cb-bed6-3efeeefa8754@roeck-us.net \
--to=linux@roeck-us.net \
--cc=Delphine_CC_Chiu@Wiwynn.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
/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