lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM6PR04MB56237A9E5A332422D82FB30DF3689@AM6PR04MB5623.eurprd04.prod.outlook.com>
Date:   Fri, 19 Mar 2021 07:03:19 +0000
From:   Clark Wang <xiaoning.wang@....com>
To:     Aisheng Dong <aisheng.dong@....com>,
        "shawnguo@...nel.org" <shawnguo@...nel.org>,
        "s.hauer@...gutronix.de" <s.hauer@...gutronix.de>
CC:     "kernel@...gutronix.de" <kernel@...gutronix.de>,
        "festevam@...il.com" <festevam@...il.com>,
        dl-linux-imx <linux-imx@....com>,
        "sumit.semwal@...aro.org" <sumit.semwal@...aro.org>,
        "christian.koenig@....com" <christian.koenig@....com>,
        "linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 04/11] i2c: imx-lpi2c: manage irq resource request/release
 in runtime pm


> -----Original Message-----
> From: Aisheng Dong <aisheng.dong@....com>
> Sent: Friday, March 19, 2021 12:54
> To: Clark Wang <xiaoning.wang@....com>; shawnguo@...nel.org;
> s.hauer@...gutronix.de
> Cc: kernel@...gutronix.de; festevam@...il.com; dl-linux-imx <linux-
> imx@....com>; sumit.semwal@...aro.org; christian.koenig@....com;
> linux-i2c@...r.kernel.org; linux-arm-kernel@...ts.infradead.org; linux-
> kernel@...r.kernel.org
> Subject: RE: [PATCH 04/11] i2c: imx-lpi2c: manage irq resource
> request/release in runtime pm
> 
> > From: Clark Wang <xiaoning.wang@....com>
> > Sent: Wednesday, March 17, 2021 2:54 PM
> >
> > Manage irq resource request/release in runtime pm to save irq domain's
> > power.
> >
> > Signed-off-by: Frank Li <Frank.Li@....com>
> > Signed-off-by: Fugang Duan <fugang.duan@....com>
> > Reviewed-by: Frank Li <Frank.Li@....com>
> > ---
> >  drivers/i2c/busses/i2c-imx-lpi2c.c | 26 ++++++++++++++------------
> >  1 file changed, 14 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c
> > b/drivers/i2c/busses/i2c-imx-lpi2c.c
> > index 664fcc0dba51..e718bb6b2387 100644
> > --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
> > +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
> > @@ -94,6 +94,7 @@ enum lpi2c_imx_pincfg {
> >
> >  struct lpi2c_imx_struct {
> >  	struct i2c_adapter	adapter;
> > +	int			irq;
> >  	struct clk		*clk_per;
> >  	struct clk		*clk_ipg;
> >  	void __iomem		*base;
> > @@ -543,7 +544,7 @@ static int lpi2c_imx_probe(struct platform_device
> > *pdev)  {
> >  	struct lpi2c_imx_struct *lpi2c_imx;
> >  	unsigned int temp;
> > -	int irq, ret;
> > +	int ret;
> >
> >  	lpi2c_imx = devm_kzalloc(&pdev->dev, sizeof(*lpi2c_imx),
> GFP_KERNEL);
> >  	if (!lpi2c_imx)
> > @@ -553,9 +554,9 @@ static int lpi2c_imx_probe(struct platform_device
> > *pdev)
> >  	if (IS_ERR(lpi2c_imx->base))
> >  		return PTR_ERR(lpi2c_imx->base);
> >
> > -	irq = platform_get_irq(pdev, 0);
> > -	if (irq < 0)
> > -		return irq;
> > +	lpi2c_imx->irq = platform_get_irq(pdev, 0);
> > +	if (lpi2c_imx->irq < 0)
> > +		return lpi2c_imx->irq;
> >
> >  	lpi2c_imx->adapter.owner	= THIS_MODULE;
> >  	lpi2c_imx->adapter.algo		= &lpi2c_imx_algo;
> > @@ -581,14 +582,6 @@ static int lpi2c_imx_probe(struct platform_device
> > *pdev)
> >  	if (ret)
> >  		lpi2c_imx->bitrate = I2C_MAX_STANDARD_MODE_FREQ;
> >
> > -	ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr,
> > -			       IRQF_NO_SUSPEND,
> > -			       pdev->name, lpi2c_imx);
> > -	if (ret) {
> > -		dev_err(&pdev->dev, "can't claim irq %d\n", irq);
> > -		return ret;
> > -	}
> > -
> >  	i2c_set_adapdata(&lpi2c_imx->adapter, lpi2c_imx);
> >  	platform_set_drvdata(pdev, lpi2c_imx);
> >
> > @@ -640,6 +633,7 @@ static int __maybe_unused
> > lpi2c_runtime_suspend(struct device *dev)  {
> >  	struct lpi2c_imx_struct *lpi2c_imx = dev_get_drvdata(dev);
> >
> > +	devm_free_irq(dev, lpi2c_imx->irq, lpi2c_imx);
> >  	clk_disable_unprepare(lpi2c_imx->clk_ipg);
> >  	clk_disable_unprepare(lpi2c_imx->clk_per);
> >  	pinctrl_pm_select_idle_state(dev);
> > @@ -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?

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


Download attachment "smime.p7s" of type "application/pkcs7-signature" (9583 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ