From: Guenter Roeck <linux@roeck-us.net>
To: linux-hwmon@vger.kernel.org
Cc: Rob Herring <robh@kernel.org>,
linux-kernel@vger.kernel.org,
Peter Yin <peteryin.openbmc@gmail.com>,
Potin Lai <potin.lai.pt@gmail.com>,
Daniel Matyas <daniel.matyas@analog.com>,
Andrew Davis <afd@ti.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 2/4] hwmon: (nct6775) Let enum kinds start with index 0
Date: Mon, 10 Jun 2024 11:10:44 -0700 [thread overview]
Message-ID: <20240610181046.1991436-3-linux@roeck-us.net> (raw)
In-Reply-To: <20240610181046.1991436-1-linux@roeck-us.net>
Commit 10a0575ea09d ("hwmon: (nct6775-i2c) Use i2c_get_match_data()")
introduced calling i2c_get_match_data() to the nct6775 driver. As part
of that commit, enum kinds was changed to start with 1, based on
Adjust the 'kinds' enum to not use 0, so that no match data can be
distinguished from a valid enum value.
The patch had to be fixed later with commit 2792fc8f8c83 ("hwmon:
(nct6775-core) Explicitly initialize nct6775_device_names indexes") and
commit efe86092ab31 ("hwmon: (nct6775-platform) Explicitly initialize
nct6775_sio_names indexes").
Various patches submitted later show that the change from 0 to 1 is
not really necessary. As it turns out, it is perfectly fine as long as
there is an i2c_device_id array with the same data as in the of_device_id
array. This data is used as fallback if the data pointer in struct
of_device_id is NULL (0).
Let enum chips start with 0 to avoid confusion against other drivers
where the enum starts with 0 and i2c_get_match_data() is used as well.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/nct6775.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/nct6775.h b/drivers/hwmon/nct6775.h
index d31e7a030216..296eff99d003 100644
--- a/drivers/hwmon/nct6775.h
+++ b/drivers/hwmon/nct6775.h
@@ -4,7 +4,7 @@
#include <linux/types.h>
-enum kinds { nct6106 = 1, nct6116, nct6775, nct6776, nct6779, nct6791, nct6792,
+enum kinds { nct6106, nct6116, nct6775, nct6776, nct6779, nct6791, nct6792,
nct6793, nct6795, nct6796, nct6797, nct6798, nct6799 };
enum pwm_enable { off, manual, thermal_cruise, speed_cruise, sf3, sf4 };
--
2.39.2
next prev parent reply other threads:[~2024-06-10 18:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 18:10 [PATCH 0/4] hwmon: Update handling of chip-id enums Guenter Roeck
2024-06-10 18:10 ` [PATCH 1/4] hwmon: (pmbus/lm25066) Let enum chips start with index 0 Guenter Roeck
2024-06-10 18:10 ` Guenter Roeck [this message]
2024-06-10 18:10 ` [PATCH 3/4] hwmon: (pmbus/mp2856) " Guenter Roeck
2024-06-10 18:10 ` [PATCH 4/4] hwmon: (pmbus/max31827) Explain why enum chips must not start with 0 Guenter Roeck
2024-06-11 9:07 ` Nuno Sá
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=20240610181046.1991436-3-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=afd@ti.com \
--cc=daniel.matyas@analog.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peteryin.openbmc@gmail.com \
--cc=potin.lai.pt@gmail.com \
--cc=robh@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