Commit 32a8d362 authored by Wolfram Sang's avatar Wolfram Sang Committed by Alexandre Belloni
Browse files

hwmon: (spd5118) Use generic parity calculation

parent c320592f
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -291,12 +291,6 @@ static umode_t spd5118_is_visible(const void *_data, enum hwmon_sensor_types typ
	}
}

static inline bool spd5118_parity8(u8 w)
{
	w ^= w >> 4;
	return (0x6996 >> (w & 0xf)) & 1;
}

/*
 * Bank and vendor id are 8-bit fields with seven data bits and odd parity.
 * Vendor IDs 0 and 0x7f are invalid.
@@ -304,7 +298,7 @@ static inline bool spd5118_parity8(u8 w)
 */
static bool spd5118_vendor_valid(u8 bank, u8 id)
{
	if (!spd5118_parity8(bank) || !spd5118_parity8(id))
	if (parity8(bank) == 0 || parity8(id) == 0)
		return false;

	id &= 0x7f;