Skip to content

Commit 32a8d36

Browse files
Wolfram Sangalexandrebelloni
authored andcommitted
hwmon: (spd5118) Use generic parity calculation
Make use of the new generic helper for calculating the parity. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com> Link: https://lore.kernel.org/r/20250107090204.6593-3-wsa+renesas@sang-engineering.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent c320592 commit 32a8d36

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

drivers/hwmon/spd5118.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,20 +291,14 @@ static umode_t spd5118_is_visible(const void *_data, enum hwmon_sensor_types typ
291291
}
292292
}
293293

294-
static inline bool spd5118_parity8(u8 w)
295-
{
296-
w ^= w >> 4;
297-
return (0x6996 >> (w & 0xf)) & 1;
298-
}
299-
300294
/*
301295
* Bank and vendor id are 8-bit fields with seven data bits and odd parity.
302296
* Vendor IDs 0 and 0x7f are invalid.
303297
* See Jedec standard JEP106BJ for details and a list of assigned vendor IDs.
304298
*/
305299
static bool spd5118_vendor_valid(u8 bank, u8 id)
306300
{
307-
if (!spd5118_parity8(bank) || !spd5118_parity8(id))
301+
if (parity8(bank) == 0 || parity8(id) == 0)
308302
return false;
309303

310304
id &= 0x7f;

0 commit comments

Comments
 (0)