public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] eeprom: at24: Use pm_runtime_resume_and_get to simplify the code
@ 2023-12-20 15:11 Heiner Kallweit
  2024-01-05  9:22 ` Bartosz Golaszewski
  0 siblings, 1 reply; 5+ messages in thread
From: Heiner Kallweit @ 2023-12-20 15:11 UTC (permalink / raw)
  To: Bartosz Golaszewski, Arnd Bergmann, Greg Kroah-Hartman
  Cc: linux-i2c@vger.kernel.org

Use helper pm_runtime_resume_and_get() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/misc/eeprom/at24.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 5712bf1c3..070673368 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -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.
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] eeprom: at24: Use pm_runtime_resume_and_get to simplify the code
  2023-12-20 15:11 [PATCH] eeprom: at24: Use pm_runtime_resume_and_get to simplify the code Heiner Kallweit
@ 2024-01-05  9:22 ` Bartosz Golaszewski
  2024-01-05  9:32   ` Heiner Kallweit
  0 siblings, 1 reply; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-01-05  9:22 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-i2c@vger.kernel.org

On Wed, Dec 20, 2023 at 4:11 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> Use helper pm_runtime_resume_and_get() to simplify the code.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---

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.

Bart

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] eeprom: at24: Use pm_runtime_resume_and_get to simplify the code
  2024-01-05  9:22 ` Bartosz Golaszewski
@ 2024-01-05  9:32   ` Heiner Kallweit
  2024-01-05  9:35     ` Bartosz Golaszewski
  0 siblings, 1 reply; 5+ messages in thread
From: Heiner Kallweit @ 2024-01-05  9:32 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-i2c@vger.kernel.org

On 05.01.2024 10:22, Bartosz Golaszewski wrote:
> On Wed, Dec 20, 2023 at 4:11 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>>
>> Use helper pm_runtime_resume_and_get() to simplify the code.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
> 
> 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"

> Bart
Heiner


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] eeprom: at24: Use pm_runtime_resume_and_get to simplify the code
  2024-01-05  9:32   ` Heiner Kallweit
@ 2024-01-05  9:35     ` Bartosz Golaszewski
  2024-01-05  9:37       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Bartosz Golaszewski @ 2024-01-05  9:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Heiner Kallweit
  Cc: Arnd Bergmann, linux-i2c@vger.kernel.org, Wolfram Sang

On Fri, Jan 5, 2024 at 10:32 AM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> On 05.01.2024 10:22, Bartosz Golaszewski wrote:
> > On Wed, Dec 20, 2023 at 4:11 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:
> >>
> >> Use helper pm_runtime_resume_and_get() to simplify the code.
> >>
> >> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> >> ---
> >
> > 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"
>
> > Bart
> Heiner
>

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

Bart

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] eeprom: at24: Use pm_runtime_resume_and_get to simplify the code
  2024-01-05  9:35     ` Bartosz Golaszewski
@ 2024-01-05  9:37       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2024-01-05  9:37 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Heiner Kallweit, Arnd Bergmann, linux-i2c@vger.kernel.org,
	Wolfram Sang

On Fri, Jan 05, 2024 at 10:35:18AM +0100, Bartosz Golaszewski wrote:
> On Fri, Jan 5, 2024 at 10:32 AM Heiner Kallweit <hkallweit1@gmail.com> wrote:
> >
> > On 05.01.2024 10:22, Bartosz Golaszewski wrote:
> > > On Wed, Dec 20, 2023 at 4:11 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:
> > >>
> > >> Use helper pm_runtime_resume_and_get() to simplify the code.
> > >>
> > >> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> > >> ---
> > >
> > > 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"
> >
> > > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-05  9:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-20 15:11 [PATCH] eeprom: at24: Use pm_runtime_resume_and_get to simplify the code Heiner Kallweit
2024-01-05  9:22 ` Bartosz Golaszewski
2024-01-05  9:32   ` Heiner Kallweit
2024-01-05  9:35     ` Bartosz Golaszewski
2024-01-05  9:37       ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox