linux-bl808/drivers/hwmon/pmbus
Adam Wujek d1baf7a3a3 hwmon: (pmbus) Check PEC support before reading other registers
Make sure that the support of PEC is determined before the read of other
registers. Otherwise the validation of PEC can trigger an error on the read
of STATUS_BYTE or STATUS_WORD registers.

The problematic scenario is the following. A device with enabled PEC
support is up and running and a kernel driver is loaded.
Then the driver is unloaded (or device unbound), the HW device
is reconfigured externally (e.g. by i2cset) to advertise itself as not
supporting PEC. Without the move of the code, at the second load of
the driver (or bind) the STATUS_BYTE or STATUS_WORD register is always
read with PEC enabled, which is likely to cause a read error resulting
with fail of a driver load (or bind).

Signed-off-by: Adam Wujek <dev_public@wujek.eu>
Link: https://lore.kernel.org/r/20220519233334.438621-1-dev_public@wujek.eu
Fixes: 75d2b2b06b ("hwmon: (pmbus) disable PEC if not enabled")
Fixes: 4e5418f787 ("hwmon: (pmbus_core) Check adapter PEC support")
[groeck: Added Fixes: tags, dropped continuation line]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2022-05-22 11:32:32 -07:00
..
adm1266.c
adm1275.c
bel-pfe.c
bpa-rs600.c
delta-ahe50dc-fan.c
dps920ab.c
fsp-3y.c
ibm-cffps.c
inspur-ipsps.c
ir35221.c
ir36021.c
ir38064.c
irps5401.c
isl68137.c
Kconfig hwmon: (pmbus) Add support for Infineon Digital Multi-phase xdp152 family controllers 2022-05-22 11:32:20 -07:00
lm25066.c
ltc2978.c hwmon: (pmbus/ltc2978) Add chip specific write_byte_data 2022-05-20 10:57:06 -07:00
ltc3815.c
Makefile hwmon: (pmbus) Add support for Infineon Digital Multi-phase xdp152 family controllers 2022-05-22 11:32:20 -07:00
max8688.c
max15301.c
max16064.c
max16601.c
max20730.c
max20751.c
max31785.c
max34440.c
mp2888.c
mp2975.c
mp5023.c
pim4328.c
pli1209bc.c
pm6764tr.c
pmbus.c
pmbus.h
pmbus_core.c hwmon: (pmbus) Check PEC support before reading other registers 2022-05-22 11:32:32 -07:00
pxe1610.c
q54sj108a2.c
stpddc60.c
tps40422.c
tps53679.c
ucd9000.c
ucd9200.c
xdpe152c4.c hwmon: (pmbus) Add support for Infineon Digital Multi-phase xdp152 family controllers 2022-05-22 11:32:20 -07:00
xdpe12284.c
zl6100.c