Skip to contentSkip to conversation

eeprom: at24: Use pm_runtime_resume_and_get to simplify the code

PATCH In review Heiner Kallweit 3 participants 5 messages Dec 20, 2023 – Jan 5, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eeprom: at24: Use pm_runtime_resume_and_get to simplify the code

Use helper pm_runtime_resume_and_get() to simplify the code.

---
 drivers/misc/eeprom/at24.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/misc/eeprom/at24.c +4 -10
index 5712bf1c3..070673368 100644
@@ -440,12 +440,9 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
 	if (off + count > at24->byte_len)
 		return -EINVAL;
 
-	ret = pm_runtime_get_sync(dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret)
 		return ret;
-	}
-
 	/*
 	 * Read data from chip, protecting against concurrent updates
 	 * from this host, but not from other I2C masters.
@@ -487,12 +484,9 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
 	if (off + count > at24->byte_len)
 		return -EINVAL;
 
-	ret = pm_runtime_get_sync(dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret)
 		return ret;
-	}
-
 	/*
 	 * Write data to chip, protecting against concurrent updates
 	 * from this host, but not from other I2C masters.
Signature · 1 line
2.43.0
#2 lore raw
Quoted 10 lines · Bartosz Golaszewski
Quoted 5 lines · Heiner Kallweit

Use helper pm_runtime_resume_and_get() to simplify the code.

---

This looks good, but I had already sent out my PR to Wolfram when you sent it, so I'll queue it for v6.9.

I just received an automated note from Greg that he applied this patch via the char-misc tree. The same applies to "eeprom: at24: Probe for DDR3 thermal sensor in the SPD case"

Quoted 1 line

Bart

Heiner

#3 lore raw
Quoted 12 lines · Heiner Kallweit
Quoted 10 lines · Bartosz Golaszewski
Quoted 5 lines · Heiner Kallweit

Use helper pm_runtime_resume_and_get() to simplify the code.

---

This looks good, but I had already sent out my PR to Wolfram when you sent it, so I'll queue it for v6.9.

Quoted 7 lines

I just received an automated note from Greg that he applied this patch via the char-misc tree. The same applies to "eeprom: at24: Probe for DDR3 thermal sensor in the SPD case"

Quoted 1 line

Bart

Heiner

Huh? Greg, I typically pick up patches for at24 and send them through the I2C tree (as per the MAINTAINERS file).

Bart

#4 lore raw
Quoted 17 lines · Bartosz Golaszewski
Quoted 16 lines · Heiner Kallweit
Quoted 10 lines · Bartosz Golaszewski
Quoted 5 lines · Heiner Kallweit

Use helper pm_runtime_resume_and_get() to simplify the code.

---

This looks good, but I had already sent out my PR to Wolfram when you sent it, so I'll queue it for v6.9.

I just received an automated note from Greg that he applied this patch via the char-misc tree. The same applies to "eeprom: at24: Probe for DDR3 thermal sensor in the SPD case"

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Bart

Heiner

Huh? Greg, I typically pick up patches for at24 and send them through the I2C tree (as per the MAINTAINERS file).

Sorry about that, I caught this in my sweep of patches sent to me. As you wanted it applied anyway, all should be good, git can handle the merge just fine.

thanks,

greg k-h