Skip to contentSkip to conversation

gnss: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync

PATCH In review [email protected] 2 participants 2 messages Apr 19, 2022 – Apr 20, 2022 Gnss

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gnss: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync

From: Minghao Chi <[email protected]>

Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and pm_runtime_put_noidle. This change is just to simplify the code, no actual functional changes.

---
 drivers/gnss/serial.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gnss/serial.c +2 -4
index 5d8e9bfb24d0..afa7a08d718e 100644
@@ -32,11 +32,9 @@ static int gnss_serial_open(struct gnss_device *gdev)
 	serdev_device_set_baudrate(serdev, gserial->speed);
 	serdev_device_set_flow_control(serdev, false);
 
-	ret = pm_runtime_get_sync(&serdev->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(&serdev->dev);
+	ret = pm_runtime_resume_and_get(&serdev->dev);
+	if (ret < 0)
 		goto err_close;
-	}
 
 	return 0;
 
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 19 lines · On Tue, Apr 19, 2022 at 11:06:42AM +0000, [email protected] wrote:

From: Minghao Chi <[email protected]>

Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and pm_runtime_put_noidle. This change is just to simplify the code, no actual functional changes.

---
 drivers/gnss/serial.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gnss/serial.c +0 -0
index 5d8e9bfb24d0..afa7a08d718e 100644
@@ -32,11 +32,9 @@ static int gnss_serial_open(struct gnss_device *gdev)
 	serdev_device_set_baudrate(serdev, gserial->speed);
 	serdev_device_set_flow_control(serdev, false);

drivers/gnss/serial.c static int gnss_serial_open(struct gnss_device *gdev) · line 39

Quoted 10 lines
drivers/gnss/serial.c +2 -4
 
-	ret = pm_runtime_get_sync(&serdev->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(&serdev->dev);
+	ret = pm_runtime_resume_and_get(&serdev->dev);
+	if (ret < 0)
 		goto err_close;
-	}
 
 	return 0;

Same comments apply here:

https://lore.kernel.org/lkml/[email protected]/T/#t

Johan