Skip to contentSkip to conversation

i2c: qcom-geni: Simplify PM resume error handling

PATCH Applied Mukesh Kumar Savaliya 4 participants 6 messages Aug 5 – Sep 10

Subsystems (3)
lore
Share & tools
lore

Mukesh Kumar Savaliya

author maintainer
#0 lore raw

PATCH 1/1 i2c: qcom-geni: Simplify PM resume error handling

The driver currently logs pm_runtime_resume_and_get() failures with dev_err() and returns the error code separately.

Replace this with dev_err_probe(), which combines the dev_err() log message and the return value propagation into a single call, consistent with how all other error paths in this driver already report failures.

No functional change intended.

---
 drivers/i2c/busses/i2c-qcom-geni.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +2 -4
index d5c977e34994..96015e077b69 100644
@@ -994,10 +994,8 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c)
 	int ret;
 
 	ret = pm_runtime_resume_and_get(gi2c->se.dev);
-	if (ret < 0) {
-		dev_err(gi2c->se.dev, "error turning on device :%d\n", ret);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(gi2c->se.dev, ret, "error turning on device\n");
 
 	proto = geni_se_read_proto(&gi2c->se);
 	if (proto == GENI_SE_INVALID_PROTO) {
Signature · 1 line
2.43.0
#1 lore raw

Hi Mukesh

Quoted 19 lines · Mukesh Kumar Savaliya

The driver currently logs pm_runtime_resume_and_get() failures with dev_err() and returns the error code separately.

Replace this with dev_err_probe(), which combines the dev_err() log message and the return value propagation into a single call, consistent with how all other error paths in this driver already report failures.

No functional change intended.

---
  drivers/i2c/busses/i2c-qcom-geni.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +0 -0
index d5c977e34994..96015e077b69 100644

drivers/i2c/busses/i2c-qcom-geni.c static int geni_i2c_init(struct geni_i2c_dev *gi2c) · line 998

Quoted 9 lines
drivers/i2c/busses/i2c-qcom-geni.c +2 -4
@@ -994,10 +994,8 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c)
  	int ret;
 
  	ret = pm_runtime_resume_and_get(gi2c->se.dev);
-	if (ret < 0) {
-		dev_err(gi2c->se.dev, "error turning on device :%d\n", ret);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(gi2c->se.dev, ret, "error turning on device\n");

This change is not required, as this API will be used in the deep sleep use case to reinitialise the SE.

Thanks,

Praveen Talari

Quoted 3 lines
drivers/i2c/busses/i2c-qcom-geni.c +0 -0
  	proto = geni_se_read_proto(&gi2c->se);
  	if (proto == GENI_SE_INVALID_PROTO) {
author maintainer
#2 lore raw

Thanks Praveen for the review !

Quoted 17 lines · Praveen Talari

Hi Mukesh

Quoted 14 lines · Mukesh Kumar Savaliya

The driver currently logs pm_runtime_resume_and_get() failures with dev_err() and returns the error code separately.

Replace this with dev_err_probe(), which combines the dev_err() log message and the return value propagation into a single call, consistent with how all other error paths in this driver already report failures.

No functional change intended.

---
  drivers/i2c/busses/i2c-qcom-geni.c | 6 ++----

  1 file changed, 2 insertions(+), 4 deletions(-)
Quoted 17 lines
Quoted 5 lines
drivers/i2c/busses/i2c-qcom-geni.c +0 -0
index d5c977e34994..96015e077b69 100644

drivers/i2c/busses/i2c-qcom-geni.c static int geni_i2c_init(struct geni_i2c_dev *gi2c) · line 998

Quoted 9 lines
drivers/i2c/busses/i2c-qcom-geni.c +2 -4
@@ -994,10 +994,8 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c)
       int ret;
       ret = pm_runtime_resume_and_get(gi2c->se.dev);
-    if (ret < 0) {
-        dev_err(gi2c->se.dev, "error turning on device :%d\n", ret);
-        return ret;
-    }
+    if (ret < 0)
+        return dev_err_probe(gi2c->se.dev, ret, "error turning on 
 device\n");

This change is not required, as this API will be used in the deep sleep use case to reinitialise the SE.

I think this change is generic and does not appear to introduce any new functionality. Its more like a cleanup or modernization that aligns the PM handling with the pattern already used in the drivers probe path.

What exactly is getting broken during deep sleep with this change ? Could you elaborate on the specific suspend/resume issue that is getting disturbed ?

Quoted 3 lines
Quoted 3 lines
drivers/i2c/busses/i2c-qcom-geni.c +0 -0
       proto = geni_se_read_proto(&gi2c->se);
       if (proto == GENI_SE_INVALID_PROTO) {
Acked-by on v1 1/1
#3 lore raw
In reply to Mukesh Kumar Savaliya
Quoted 21 lines · Mukesh Kumar Savaliya

The driver currently logs pm_runtime_resume_and_get() failures with dev_err() and returns the error code separately.

Replace this with dev_err_probe(), which combines the dev_err() log message and the return value propagation into a single call, consistent with how all other error paths in this driver already report failures.

No functional change intended.

---
  drivers/i2c/busses/i2c-qcom-geni.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +0 -0
index d5c977e34994..96015e077b69 100644
@@ -994,10 +994,8 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c)
  	int ret;
 

drivers/i2c/busses/i2c-qcom-geni.c static int geni_i2c_init(struct geni_i2c_dev *gi2c) · line 1001

Quoted 10 lines
drivers/i2c/busses/i2c-qcom-geni.c +2 -4
  	ret = pm_runtime_resume_and_get(gi2c->se.dev);
-	if (ret < 0) {
-		dev_err(gi2c->se.dev, "error turning on device :%d\n", ret);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(gi2c->se.dev, ret, "error turning on device\n");
 
  	proto = geni_se_read_proto(&gi2c->se);
  	if (proto == GENI_SE_INVALID_PROTO) {
maintainer Reviewed-by on v1 1/1
#4 lore raw
In reply to Mukesh Kumar Savaliya
Quoted 21 lines · Mukesh Kumar Savaliya

The driver currently logs pm_runtime_resume_and_get() failures with dev_err() and returns the error code separately.

Replace this with dev_err_probe(), which combines the dev_err() log message and the return value propagation into a single call, consistent with how all other error paths in this driver already report failures.

No functional change intended.

---
 drivers/i2c/busses/i2c-qcom-geni.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +0 -0
index d5c977e34994..96015e077b69 100644
@@ -994,10 +994,8 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c)
 	int ret;
 

drivers/i2c/busses/i2c-qcom-geni.c static int geni_i2c_init(struct geni_i2c_dev *gi2c) · line 1001

Quoted 10 lines
drivers/i2c/busses/i2c-qcom-geni.c +2 -4
 	ret = pm_runtime_resume_and_get(gi2c->se.dev);
-	if (ret < 0) {
-		dev_err(gi2c->se.dev, "error turning on device :%d\n", ret);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(gi2c->se.dev, ret, "error turning on device\n");
 
 	proto = geni_se_read_proto(&gi2c->se);
 	if (proto == GENI_SE_INVALID_PROTO) {
maintainer Applied
#5 lore raw
In reply to Mukesh Kumar Savaliya

Hi Mukesh,

Quoted 10 lines · Mukesh Kumar Savaliya

The driver currently logs pm_runtime_resume_and_get() failures with dev_err() and returns the error code separately.

Replace this with dev_err_probe(), which combines the dev_err() log message and the return value propagation into a single call, consistent with how all other error paths in this driver already report failures.

No functional change intended.

merged to i2c/i2c.

Thanks,
Andi