[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220420125421.415716-1-dev_public@wujek.eu>
Date: Wed, 20 Apr 2022 12:54:45 +0000
From: Adam Wujek <dev_public@...ek.eu>
To: unlisted-recipients:; (no To-header on input)
Cc: Adam Wujek <dev_public@...ek.eu>,
Guenter Roeck <linux@...ck-us.net>,
Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] hwmod: (pmbus) disable PEC if not enabled
Explicitly disable PEC when the client does not support it.
The problematic scenario is the following. A device with enabled PEC
support is up and running, a kernel driver 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 a new code, at the second load of the driver
(or bind) the "flags" variable is not updated to avoid PEC usage. As a
consequence the further communication with the device is done with
the PEC enabled, which is wrong.
Signed-off-by: Adam Wujek <dev_public@...ek.eu>
---
drivers/hwmon/pmbus/pmbus_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index b2618b1d529e..0af7a3d74f47 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -2334,7 +2334,8 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
client->flags |= I2C_CLIENT_PEC;
}
}
- }
+ } else
+ client->flags &= ~I2C_CLIENT_PEC;
/*
* Check if the chip is write protected. If it is, we can not clear
--
2.25.1
Powered by blists - more mailing lists