WSL2-Linux-Kernel/drivers/hwmon
Adam Wujek 1047d4ac66 hwmon: (pmbus) Check PEC support before reading other registers
[ Upstream commit d1baf7a3a3 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-09 10:23:02 +02:00
..
occ hwmon: (occ) Fix P10 VRM temp sensors 2021-10-02 04:35:09 -07:00
pmbus hwmon: (pmbus) Check PEC support before reading other registers 2022-06-09 10:23:02 +02:00
Kconfig hwmon: (ltq-cputemp) restrict it to SOC_XWAY 2022-05-18 10:26:50 +02:00
Makefile hwmon: add driver for Aquacomputer D5 Next 2021-08-28 08:53:30 -07:00
abituguru.c
abituguru3.c
acpi_power_meter.c
ad7314.c
ad7414.c
ad7418.c
adc128d818.c
adcxx.c
adm1021.c
adm1025.c
adm1026.c
adm1029.c
adm1031.c
adm1177.c
adm9240.c hwmon: (adm9240) Fix writes into inX_max attributes 2021-05-12 18:53:11 -07:00
ads7828.c
ads7871.c
adt7x10.c
adt7x10.h
adt7310.c
adt7410.c
adt7411.c
adt7462.c
adt7470.c hwmon: (adt7470) Fix warning on module removal 2022-05-12 12:30:11 +02:00
adt7475.c
aht10.c
amc6821.c
applesmc.c
aquacomputer_d5next.c hwmon: add driver for Aquacomputer D5 Next 2021-08-28 08:53:30 -07:00
as370-hwmon.c
asb100.c
asc7621.c
aspeed-pwm-tacho.c
asus_atk0110.c
atxp1.c
axi-fan-control.c hwmon: (axi-fan-control) Support temperature vs pwm points 2021-08-17 14:54:26 -07:00
bt1-pvt.c hwmon: (bt1-pvt) Remove redundant error printing in pvt_request_regs() 2021-06-17 04:21:45 -07:00
bt1-pvt.h
coretemp.c
corsair-cpro.c hwmon: (corsair-cpro) Fix fall-through warnings for Clang 2021-05-17 19:50:23 -05:00
corsair-psu.c hwmon: (corsair-psu) fix plain integer used as NULL pointer 2021-12-17 10:30:12 +01:00
da9052-hwmon.c
da9055-hwmon.c
dell-smm-hwmon.c hwmon: (dell-smm) Speed up setting of fan speed 2022-02-16 12:56:39 +01:00
dme1737.c
drivetemp.c
ds620.c
ds1621.c
emc6w201.c
emc1403.c
emc2103.c
f71805f.c
f71882fg.c hwmon: (f71882fg) Fix negative temperature 2022-05-18 10:26:51 +02:00
f75375s.c
fam15h_power.c hwmon: Replace deprecated CPU-hotplug functions. 2021-08-17 14:54:26 -07:00
fschmd.c
ftsteutates.c
g760a.c
g762.c
gl518sm.c
gl520sm.c
gpio-fan.c
gsc-hwmon.c
hih6130.c
hwmon-vid.c
hwmon.c hwmon: Handle failure to register sensor with thermal zone correctly 2022-03-02 11:47:54 +01:00
i5k_amb.c
i5500_temp.c
ibmaem.c
ibmpex.c
ibmpowernv.c
iio_hwmon.c
ina2xx.c
ina209.c
ina3221.c hwmon: (ina3221) use CVRF only for single-shot conversion 2021-06-17 04:21:46 -07:00
intel-m10-bmc-hwmon.c hwmon: intel-m10-bmc-hwmon: add n5010 sensors 2021-08-17 14:54:25 -07:00
it87.c
jc42.c
k8temp.c
k10temp.c hwmon: (k10temp) Remove residues of current and voltage 2021-09-12 17:56:36 -07:00
lineage-pem.c
lm63.c
lm70.c hwmon: (lm70) Use SPI_MODE_X_MASK 2021-06-17 04:21:44 -07:00
lm73.c
lm75.c hwmon: (lm75) Add TI TMP1075 support 2021-06-17 04:21:44 -07:00
lm75.h
lm77.c
lm78.c
lm80.c Revert "hwmon: (lm80) fix a missing check of bus read in lm80 probe" 2021-05-13 17:30:01 +02:00
lm83.c
lm85.c
lm87.c
lm90.c hwmon: (lm90) Fix sysfs and udev notifications 2022-02-01 17:27:12 +01:00
lm92.c
lm93.c
lm95234.c
lm95241.c
lm95245.c
lochnagar-hwmon.c
ltc2945.c
ltc2947-core.c hwmon: (ltc2947) Properly handle errors when looking for the external clock 2021-09-24 05:02:24 -07:00
ltc2947-i2c.c
ltc2947-spi.c
ltc2947.h
ltc2990.c
ltc2992.c hwmon: (ltc2992) Put fwnode in error case during ->probe() 2021-05-10 08:02:15 -07:00
ltc4151.c
ltc4215.c
ltc4222.c
ltc4245.c
ltc4260.c
ltc4261.c
ltq-cputemp.c
max127.c
max197.c
max1111.c
max1619.c
max1668.c
max6621.c hwmon: (max6621) Fix fall-through warnings for Clang 2021-05-17 19:50:37 -05:00
max6639.c
max6642.c
max6650.c
max6697.c
max16065.c
max31722.c hwmon: (max31722) Remove non-standard ACPI device IDs 2021-06-17 04:21:44 -07:00
max31730.c
max31790.c hwmon: (max31790) Detect and report zero fan speed 2021-06-17 04:21:46 -07:00
mc13783-adc.c
mcp3021.c
menf21bmc_hwmon.c
mlxreg-fan.c hwmon: (mlxreg-fan) Return non-zero value when fan current state is enforced from sysfs 2021-09-16 14:48:20 -07:00
mr75203.c hwmon: (mr75203) fix wrong power-up delay value 2022-01-27 11:03:48 +01:00
nct6683.c
nct6775.c
nct7802.c
nct7904.c
npcm750-pwm-fan.c
nsa320-hwmon.c
ntc_thermistor.c hwmon: (ntc_thermistor) Use library interpolation 2021-08-17 14:54:25 -07:00
nzxt-kraken2.c
pc87360.c
pc87427.c
pcf8591.c
powr1220.c
pwm-fan.c hwmon: (pwm-fan) Ensure the fan going on in .probe() 2021-12-14 10:57:14 +01:00
raspberrypi-hwmon.c
s3c-hwmon.c
sbrmi.c hwmon: Add support for SB-RMI power module 2021-08-17 14:54:25 -07:00
sbtsi_temp.c
sch56xx-common.c hwmon: (sch56xx-common) Replace WDOG_ACTIVE with WDOG_HW_RUNNING 2022-04-08 14:23:07 +02:00
sch56xx-common.h hwmon: (sch56xx) Use devres functions for watchdog 2021-06-17 04:21:44 -07:00
sch5627.c hwmon: (sch56xx) Use devres functions for watchdog 2021-06-17 04:21:44 -07:00
sch5636.c hwmon: (sch56xx) Use devres functions for watchdog 2021-06-17 04:21:44 -07:00
scmi-hwmon.c
scpi-hwmon.c hwmon: (scpi-hwmon) shows the negative temperature properly 2021-06-09 11:51:30 -07:00
sht3x.c
sht4x.c hwmon: (sht4x) Fix sht4x_read_values return value 2021-06-17 04:21:45 -07:00
sht15.c
sht21.c
shtc1.c
sis5595.c
sl28cpld-hwmon.c
smm665.c
smsc47b397.c
smsc47m1.c
smsc47m192.c
sparx5-temp.c
stts751.c
tc74.c
tc654.c
thmc50.c
tmp102.c
tmp103.c
tmp108.c
tmp401.c hwmon: (tmp401) Add OF device ID table 2022-05-18 10:26:47 +02:00
tmp421.c hwmon: (tmp421) fix rounding for negative values 2021-09-24 05:00:53 -07:00
tmp513.c
tps23861.c hwmon: (tps23861) correct shunt LSB values 2021-06-10 08:40:09 -07:00
ultra45_env.c
vexpress-hwmon.c
via-cputemp.c
via686a.c
vt1211.c
vt8231.c
w83l785ts.c
w83l786ng.c
w83627ehf.c hwmon: (w83627ehf) Make DEVICE_ATTR_RO static 2021-08-17 14:54:25 -07:00
w83627hf.c
w83773g.c
w83781d.c hwmon: (w83781d) Match on device tree compatibles 2021-08-17 14:54:26 -07:00
w83791d.c hwmon: (w83791d) Fix NULL pointer dereference by removing unnecessary structure field 2021-10-02 05:11:52 -07:00
w83792d.c hwmon: (w83792d) Fix NULL pointer dereference by removing unnecessary structure field 2021-10-02 05:12:05 -07:00
w83793.c hwmon: (w83793) Fix NULL pointer dereference by removing unnecessary structure field 2021-10-02 05:14:11 -07:00
w83795.c
wm831x-hwmon.c
wm8350-hwmon.c
xgene-hwmon.c