Re: [PATCH] i2c: omap: Improve error reporting for problems during .remove()

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

 



Hello Tony,

On Thu, Apr 13, 2023 at 08:12:22AM +0300, Tony Lindgren wrote:
> * Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> [230406 08:23]:
> > --- a/drivers/i2c/busses/i2c-omap.c
> > +++ b/drivers/i2c/busses/i2c-omap.c
> > @@ -1525,14 +1525,17 @@ static int omap_i2c_remove(struct platform_device *pdev)
> >  	int ret;
> >  
> >  	i2c_del_adapter(&omap->adapter);
> > -	ret = pm_runtime_resume_and_get(&pdev->dev);
> > +
> > +	ret = pm_runtime_get_sync(&pdev->dev);
> 
> It's better to use pm_runtime_resume_and_get() nowadays in general as
> it does pm_runtime_put_noidle() on errors.

Sticking to pm_runtime_resume_and_get() complicates the change however,
because the function calls pm_runtime_put_sync() already. So with
pm_runtime_resume_and_get() I'd need

	if (ret >= 0)
		pm_runtime_put_sync(&pdev->dev);

instead of a plain

	pm_runtime_put_sync(&pdev->dev);

.

> Not sure if there are changes needed here, maybe warn and return early
> if needed?

The idea of "return early" in a remove callback is exactly what I want
to get rid of.

See
https://lore.kernel.org/linux-spi/20230317084232.142257-3-u.kleine-koenig@xxxxxxxxxxxxxx
for an example.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux