diff mbox series

[1/3] hwmon: pmbus: Reduce clear fault page invocations

Message ID 20230817092527.808631-1-Naresh.Solanki@9elements.com (mailing list archive)
State Accepted
Headers show
Series [1/3] hwmon: pmbus: Reduce clear fault page invocations | expand

Commit Message

Naresh Solanki Aug. 17, 2023, 9:25 a.m. UTC
From: Patrick Rudolph <patrick.rudolph@9elements.com>

Observing I2C traffic revealed consecutive transmission of CLEAR_FAULT
commands. While this doesn't cause issues, it extends driver probe time.

Avoid invoking pmbus_clear_fault_page for virtual registers, as they're
managed by the driver, not the chip.

TEST: Verified using an I2C bus analyzer that only one CLEAR_FAULT
      command is send instead 5 in a row.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
---
 drivers/hwmon/pmbus/pmbus_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


base-commit: fc8df28be7155ddcf8731b4c85fd3372811ba5ac

Comments

Guenter Roeck Aug. 19, 2023, 12:17 p.m. UTC | #1
On Thu, Aug 17, 2023 at 11:25:24AM +0200, Naresh Solanki wrote:
> From: Patrick Rudolph <patrick.rudolph@9elements.com>
> 
> Observing I2C traffic revealed consecutive transmission of CLEAR_FAULT
> commands. While this doesn't cause issues, it extends driver probe time.
> 
> Avoid invoking pmbus_clear_fault_page for virtual registers, as they're
> managed by the driver, not the chip.
> 
> TEST: Verified using an I2C bus analyzer that only one CLEAR_FAULT
>       command is send instead 5 in a row.
> 
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/pmbus/pmbus_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> 
> base-commit: fc8df28be7155ddcf8731b4c85fd3372811ba5ac
> 
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 69a4e62b6c8d..cbfabdd69056 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -561,7 +561,8 @@ static bool pmbus_check_register(struct i2c_client *client,
>  		rv = pmbus_check_status_cml(client);
>  	if (rv < 0 && (data->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK))
>  		data->read_status(client, -1);
> -	pmbus_clear_fault_page(client, -1);
> +	if (reg < PMBUS_VIRT_BASE)
> +		pmbus_clear_fault_page(client, -1);
>  	return rv >= 0;
>  }
>
diff mbox series

Patch

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 69a4e62b6c8d..cbfabdd69056 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -561,7 +561,8 @@  static bool pmbus_check_register(struct i2c_client *client,
 		rv = pmbus_check_status_cml(client);
 	if (rv < 0 && (data->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK))
 		data->read_status(client, -1);
-	pmbus_clear_fault_page(client, -1);
+	if (reg < PMBUS_VIRT_BASE)
+		pmbus_clear_fault_page(client, -1);
 	return rv >= 0;
 }