[PATCH 04/11] i2c: imx-lpi2c: manage irq resource request/release in runtime pm

Aisheng Dong aisheng.dong at nxp.com
Fri Mar 19 10:12:12 GMT 2021


> > > @@ -665,6 +659,14 @@ static int __maybe_unused
> > > lpi2c_runtime_resume(struct device *dev)
> > >  		dev_err(dev, "can't enable I2C ipg clock, ret=%d\n", ret);
> > >  	}
> > >
> > > +	ret = devm_request_irq(dev, lpi2c_imx->irq, lpi2c_imx_isr,
> >
> > I guess unnecessary to use devm in rpm
> 
> devm_request_irq() will use device resource management.
> Other resource like clk and struct space are all managed by devres.
> Maybe we can still use devm_ to let devres manage irq here?
> 

devm_xxx is usually used to auto free resources when probe fail,
driver unbound / device unregister and etc. Not for runtime pm.
I may prefer using request_irq/free_irq directly in runtime.

BTW, current lpi2c_imx_remove seems didn't ensure the device is
In runtime suspend state after removing.
If framework can't guarantee, the driver has to do it.
Anyway, that's another issue and need a separate patch.

Regards
Aisheng

> Thanks.
> 
> Best Regards,
> Clark Wang
> 
> 
> >
> > > +			       IRQF_NO_SUSPEND,
> > > +			       dev_name(dev), lpi2c_imx);
> > > +	if (ret) {
> > > +		dev_err(dev, "can't claim irq %d\n", lpi2c_imx->irq);
> > > +		return ret;
> > > +	}
> > > +
> > >  	return ret;
> > >  }
> > >
> > > --
> > > 2.25.1



More information about the linux-arm-kernel mailing list