linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmod: (pmbus) disable PEC if not enabled
@ 2022-04-19 20:53 Adam Wujek
  2022-04-19 22:00 ` Guenter Roeck
  2022-04-20  1:00 ` Guenter Roeck
  0 siblings, 2 replies; 8+ messages in thread
From: Adam Wujek @ 2022-04-19 20:53 UTC (permalink / raw)
  Cc: Adam Wujek, Guenter Roeck, Jean Delvare, linux-hwmon, linux-kernel

Explicitly disable PEC when the client does not support it.
Without the explicit disable, when the device with the PEC support is removed
later when a device without PEC support is inserted into the same address,
the driver uses the old value of client->flags which contains the I2C_CLIENT_PEC
flag. As a consequence the PEC is used when it should not.

Signed-off-by: Adam Wujek <dev_public@wujek.eu>
---
 drivers/hwmon/pmbus/pmbus_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 82c3754e21e3..f8ca36759b0a 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -2014,6 +2014,8 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
 	ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
 	if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
 		client->flags |= I2C_CLIENT_PEC;
+	else
+		client->flags &= ~I2C_CLIENT_PEC;

 	pmbus_clear_faults(client);

--
2.17.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-04-20 14:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 20:53 [PATCH] hwmod: (pmbus) disable PEC if not enabled Adam Wujek
2022-04-19 22:00 ` Guenter Roeck
2022-04-19 22:10   ` wujek dev
2022-04-19 23:46     ` Guenter Roeck
2022-04-20  1:00 ` Guenter Roeck
2022-04-20 12:54   ` Adam Wujek
2022-04-20 13:55     ` Guenter Roeck
2022-04-20 14:51       ` [v3 PATCH] hwmon: " Adam Wujek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).