Re: [PATCH 05/14] Input: samsung-keypad - use devm to disable runtime PM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 19, 2024 at 02:54:39PM +0200, Krzysztof Kozlowski wrote:
> On Sun, Aug 18, 2024 at 09:58:02PM -0700, Dmitry Torokhov wrote:
> > To make sure that runtime PM is disabled at the right time relative
> > to all other devm-managed resources use devm_add_action_or_reset()
> > to register a handler that will disable it.
> > 
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> > ---
> >  drivers/input/keyboard/samsung-keypad.c | 24 +++++++++++++-----------
> >  1 file changed, 13 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c
> > index 7adcd2657bca..924327de4d8f 100644
> > --- a/drivers/input/keyboard/samsung-keypad.c
> > +++ b/drivers/input/keyboard/samsung-keypad.c
> > @@ -310,6 +310,13 @@ samsung_keypad_parse_dt(struct device *dev)
> >  }
> >  #endif
> >  
> > +static void samsung_disable_runtime_pm(void *data)
> > +{
> > +	struct samsung_keypad *keypad = data;
> > +
> > +	pm_runtime_disable(&keypad->pdev->dev);
> > +}
> > +
> >  static int samsung_keypad_probe(struct platform_device *pdev)
> >  {
> >  	const struct samsung_keypad_platdata *pdata;
> > @@ -420,11 +427,16 @@ static int samsung_keypad_probe(struct platform_device *pdev)
> >  
> >  	device_init_wakeup(&pdev->dev, pdata->wakeup);
> >  	platform_set_drvdata(pdev, keypad);
> > +
> >  	pm_runtime_enable(&pdev->dev);
> > +	error = devm_add_action_or_reset(&pdev->dev, samsung_disable_runtime_pm,
> > +					 keypad);
> > +	if (error)
> > +		return error;
> 
> I think you are open-coding devm_pm_runtime_enable().

Ah, I didn't realize we had it. Thanks!

-- 
Dmitry




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux