diff mbox series

fsi: i2cr: Reduce status checks for read operations

Message ID 20250221162404.2122888-1-eajames@linux.ibm.com
State New
Headers show
Series fsi: i2cr: Reduce status checks for read operations | expand

Commit Message

Eddie James Feb. 21, 2025, 4:24 p.m. UTC
As an optimization, only check the status register if the eight
byte i2c read operation returns 0xffffffffffffffff. This indicates
that the I2C Responder operation failed and the status register
will provide the reason. Otherwise, the operation was successful,
so no status check is necessary.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 drivers/fsi/fsi-master-i2cr.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Ninad Palsule Feb. 25, 2025, 2:45 p.m. UTC | #1
Hi Eddie,


>   
> -	ret = i2cr_check_status(i2cr->client);
> -	if (ret)
> -		goto unlock;
> +	if (*data == 0xffffffffffffffffull) {
> +		ret = i2cr_check_status(i2cr->client);
> +		if (ret)
> +			goto unlock;
> +	}
>   
>   	trace_i2cr_read(i2cr->client, command, data);

Reviewed-by: Ninad Palsule <ninad@linux.ibm.com>
diff mbox series

Patch

diff --git a/drivers/fsi/fsi-master-i2cr.c b/drivers/fsi/fsi-master-i2cr.c
index 40f1f4d231e52..9bb5c008995e1 100644
--- a/drivers/fsi/fsi-master-i2cr.c
+++ b/drivers/fsi/fsi-master-i2cr.c
@@ -145,9 +145,11 @@  int fsi_master_i2cr_read(struct fsi_master_i2cr *i2cr, u32 addr, u64 *data)
 	if (ret)
 		goto unlock;
 
-	ret = i2cr_check_status(i2cr->client);
-	if (ret)
-		goto unlock;
+	if (*data == 0xffffffffffffffffull) {
+		ret = i2cr_check_status(i2cr->client);
+		if (ret)
+			goto unlock;
+	}
 
 	trace_i2cr_read(i2cr->client, command, data);