[PATCH RESEND v6 5/5] hwmon: (pmbus/core): Notify regulator events

From: Naresh Solanki
Date: Wed Dec 14 2022 - 03:07:57 EST


Notify regulator events in PMBus irq handler.

Signed-off-by: Naresh Solanki <Naresh.Solanki@xxxxxxxxxxxxx>
---
drivers/hwmon/pmbus/pmbus_core.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 22176f266891..c8fae2a9502d 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -3154,7 +3154,7 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata)
{
struct pmbus_data *data = pdata;
struct i2c_client *client = to_i2c_client(data->dev);
- int i, status, ret, event;
+ int i, j, status, ret, event;

for (i = 0; i < data->info->pages; i++) {

@@ -3163,6 +3163,15 @@ static irqreturn_t pmbus_fault_handler(int irq, void *pdata)
if (ret)
return ret;

+ if (event) {
+ for (j = 0; j < data->info->num_regulators; j++) {
+ if (i == rdev_get_id(data->rdevs[i])) {
+ regulator_notifier_call_chain(data->rdevs[i], event, NULL);
+ ret = IRQ_HANDLED;
+ }
+ }
+ }
+
mutex_lock(&data->update_lock);
status = pmbus_read_status_word(client, i);
if (status < 0) {
--
2.37.3