diff mbox series

use devm_platform_ioremap_resource() for irqchip drivers

Message ID 1571296423-208359-1-git-send-email-huangdaode@hisilicon.com (mailing list archive)
State New, archived
Headers show
Series use devm_platform_ioremap_resource() for irqchip drivers | expand

Commit Message

huangdaode Oct. 17, 2019, 7:13 a.m. UTC
From: Daode Huang <huangdaode@hislicon.com>

Use the new helper that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together

Signed-off-by: Daode Huang <huangdaode@hislicon.com>
---
 drivers/irqchip/irq-mvebu-icu.c   | 3 +--
 drivers/irqchip/irq-mvebu-pic.c   | 3 +--
 drivers/irqchip/irq-stm32-exti.c  | 3 +--
 drivers/irqchip/irq-ti-sci-inta.c | 3 +--
 drivers/irqchip/irq-ts4800.c      | 3 +--
 5 files changed, 5 insertions(+), 10 deletions(-)

Comments

Marc Zyngier Oct. 17, 2019, 8:23 a.m. UTC | #1
On 2019-10-17 08:13, Daode Huang wrote:
> From: Daode Huang <huangdaode@hislicon.com>
>
> Use the new helper that wraps the calls to platform_get_resource()
> and devm_ioremap_resource() together
>
> Signed-off-by: Daode Huang <huangdaode@hislicon.com>
> ---
>  drivers/irqchip/irq-mvebu-icu.c   | 3 +--
>  drivers/irqchip/irq-mvebu-pic.c   | 3 +--
>  drivers/irqchip/irq-stm32-exti.c  | 3 +--
>  drivers/irqchip/irq-ti-sci-inta.c | 3 +--
>  drivers/irqchip/irq-ts4800.c      | 3 +--
>  5 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/irqchip/irq-mvebu-icu.c
> b/drivers/irqchip/irq-mvebu-icu.c
> index 547045d..ddf9b0d 100644
> --- a/drivers/irqchip/irq-mvebu-icu.c
> +++ b/drivers/irqchip/irq-mvebu-icu.c
> @@ -357,8 +357,7 @@ static int mvebu_icu_probe(struct platform_device 
> *pdev)
>
>  	icu->dev = &pdev->dev;
>
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	icu->base = devm_ioremap_resource(&pdev->dev, res);
> +	icu->base = devm_platform_ioremap_resource(pdev, res);

void __iomem *devm_platform_ioremap_resource(struct platform_device 
*pdev,
                                              unsigned int index)

What could possibly go wrong? I'd suggest you start compiling (and 
possibly
testing) the code you change before sending patches...

         M.
huangdaode Oct. 17, 2019, 9:20 a.m. UTC | #2
Hi Marc
I am just doing the coccicheck using the command "make coccicheck M=drivers/irqchip/", and it report 
$ make coccicheck M=drivers/irqchip/
.......
drivers/irqchip//irq-mvebu-icu.c:361:1-10: WARNING: Use devm_platform_ioremap_resource for icu -> base
drivers/irqchip//irq-ts4800.c:105:1-11: WARNING: Use devm_platform_ioremap_resource for data -> base
drivers/irqchip//irq-mvebu-pic.c:134:1-10: WARNING: Use devm_platform_ioremap_resource for pic -> base
drivers/irqchip//irq-ti-sci-inta.c:571:1-11: WARNING: Use devm_platform_ioremap_resource for inta -> base
drivers/irqchip//irq-stm32-exti.c:853:1-16: WARNING: Use devm_platform_ioremap_resource for host_data -> base

so just fix the WARNING. 

And after  apply the patch, I do the compile, it's OK, but I lack of hardware to test it. 
That's the case. 

MBR.
Thanks

-----邮件原件-----
发件人: Marc Zyngier [mailto:maz@kernel.org] 
发送时间: 2019年10月17日 16:24
收件人: huangdaode <huangdaode@hisilicon.com>
抄送: jason@lakedaemon.net; andrew@lunn.ch; gregory.clement@bootlin.com; sebastian.hesselbarth@gmail.com; tglx@linutronix.de; mcoquelin.stm32@gmail.com; alexandre.torgue@st.com; nm@ti.com; t-kristo@ti.com; ssantosh@kernel.org; linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com
主题: Re: [PATCH] use devm_platform_ioremap_resource() for irqchip drivers

On 2019-10-17 08:13, Daode Huang wrote:
> From: Daode Huang <huangdaode@hislicon.com>
>
> Use the new helper that wraps the calls to platform_get_resource() and 
> devm_ioremap_resource() together
>
> Signed-off-by: Daode Huang <huangdaode@hislicon.com>
> ---
>  drivers/irqchip/irq-mvebu-icu.c   | 3 +--
>  drivers/irqchip/irq-mvebu-pic.c   | 3 +--
>  drivers/irqchip/irq-stm32-exti.c  | 3 +--  
> drivers/irqchip/irq-ti-sci-inta.c | 3 +--
>  drivers/irqchip/irq-ts4800.c      | 3 +--
>  5 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/irqchip/irq-mvebu-icu.c 
> b/drivers/irqchip/irq-mvebu-icu.c index 547045d..ddf9b0d 100644
> --- a/drivers/irqchip/irq-mvebu-icu.c
> +++ b/drivers/irqchip/irq-mvebu-icu.c
> @@ -357,8 +357,7 @@ static int mvebu_icu_probe(struct platform_device
> *pdev)
>
>  	icu->dev = &pdev->dev;
>
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	icu->base = devm_ioremap_resource(&pdev->dev, res);
> +	icu->base = devm_platform_ioremap_resource(pdev, res);

void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
                                              unsigned int index)

What could possibly go wrong? I'd suggest you start compiling (and possibly
testing) the code you change before sending patches...

         M.
--
Jazz is not dead. It just smells funny...
Yue Haibing Oct. 17, 2019, 9:24 a.m. UTC | #3
On 2019/10/17 17:20, huangdaode wrote:
> Hi Marc
> I am just doing the coccicheck using the command "make coccicheck M=drivers/irqchip/", and it report 
> $ make coccicheck M=drivers/irqchip/
> .......
> drivers/irqchip//irq-mvebu-icu.c:361:1-10: WARNING: Use devm_platform_ioremap_resource for icu -> base
> drivers/irqchip//irq-ts4800.c:105:1-11: WARNING: Use devm_platform_ioremap_resource for data -> base
> drivers/irqchip//irq-mvebu-pic.c:134:1-10: WARNING: Use devm_platform_ioremap_resource for pic -> base
> drivers/irqchip//irq-ti-sci-inta.c:571:1-11: WARNING: Use devm_platform_ioremap_resource for inta -> base
> drivers/irqchip//irq-stm32-exti.c:853:1-16: WARNING: Use devm_platform_ioremap_resource for host_data -> base
> 
> so just fix the WARNING. 
> 
> And after  apply the patch, I do the compile, it's OK, but I lack of hardware to test it. 
> That's the case. 
> 
> MBR.
> Thanks
> 
> -----邮件原件-----
> 发件人: Marc Zyngier [mailto:maz@kernel.org] 
> 发送时间: 2019年10月17日 16:24
> 收件人: huangdaode <huangdaode@hisilicon.com>
> 抄送: jason@lakedaemon.net; andrew@lunn.ch; gregory.clement@bootlin.com; sebastian.hesselbarth@gmail.com; tglx@linutronix.de; mcoquelin.stm32@gmail.com; alexandre.torgue@st.com; nm@ti.com; t-kristo@ti.com; ssantosh@kernel.org; linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; linux-stm32@st-md-mailman.stormreply.com
> 主题: Re: [PATCH] use devm_platform_ioremap_resource() for irqchip drivers
> 
> On 2019-10-17 08:13, Daode Huang wrote:
>> From: Daode Huang <huangdaode@hislicon.com>
>>
>> Use the new helper that wraps the calls to platform_get_resource() and 
>> devm_ioremap_resource() together
>>
>> Signed-off-by: Daode Huang <huangdaode@hislicon.com>
>> ---
>>  drivers/irqchip/irq-mvebu-icu.c   | 3 +--
>>  drivers/irqchip/irq-mvebu-pic.c   | 3 +--
>>  drivers/irqchip/irq-stm32-exti.c  | 3 +--  
>> drivers/irqchip/irq-ti-sci-inta.c | 3 +--
>>  drivers/irqchip/irq-ts4800.c      | 3 +--
>>  5 files changed, 5 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/irqchip/irq-mvebu-icu.c 
>> b/drivers/irqchip/irq-mvebu-icu.c index 547045d..ddf9b0d 100644
>> --- a/drivers/irqchip/irq-mvebu-icu.c
>> +++ b/drivers/irqchip/irq-mvebu-icu.c
>> @@ -357,8 +357,7 @@ static int mvebu_icu_probe(struct platform_device
>> *pdev)
>>
>>  	icu->dev = &pdev->dev;
>>
>> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> -	icu->base = devm_ioremap_resource(&pdev->dev, res);
>> +	icu->base = devm_platform_ioremap_resource(pdev, res);

It should be :

+	icu->base = devm_platform_ioremap_resource(pdev, 0);

> 
> void __iomem *devm_platform_ioremap_resource(struct platform_device *pdev,
>                                               unsigned int index)
> 
> What could possibly go wrong? I'd suggest you start compiling (and possibly
> testing) the code you change before sending patches...
> 
>          M.
> --
> Jazz is not dead. It just smells funny...
>
diff mbox series

Patch

diff --git a/drivers/irqchip/irq-mvebu-icu.c b/drivers/irqchip/irq-mvebu-icu.c
index 547045d..ddf9b0d 100644
--- a/drivers/irqchip/irq-mvebu-icu.c
+++ b/drivers/irqchip/irq-mvebu-icu.c
@@ -357,8 +357,7 @@  static int mvebu_icu_probe(struct platform_device *pdev)
 
 	icu->dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	icu->base = devm_ioremap_resource(&pdev->dev, res);
+	icu->base = devm_platform_ioremap_resource(pdev, res);
 	if (IS_ERR(icu->base)) {
 		dev_err(&pdev->dev, "Failed to map icu base address.\n");
 		return PTR_ERR(icu->base);
diff --git a/drivers/irqchip/irq-mvebu-pic.c b/drivers/irqchip/irq-mvebu-pic.c
index eec6395..0c3520d 100644
--- a/drivers/irqchip/irq-mvebu-pic.c
+++ b/drivers/irqchip/irq-mvebu-pic.c
@@ -130,8 +130,7 @@  static int mvebu_pic_probe(struct platform_device *pdev)
 	if (!pic)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	pic->base = devm_ioremap_resource(&pdev->dev, res);
+	pic->base = devm_platform_ioremap_resource(pdev, res);
 	if (IS_ERR(pic->base))
 		return PTR_ERR(pic->base);
 
diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index e00f2fa..7f5500e 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -849,8 +849,7 @@  static int stm32_exti_probe(struct platform_device *pdev)
 	if (!host_data->chips_data)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	host_data->base = devm_ioremap_resource(dev, res);
+	host_data->base = devm_platform_ioremap_resource(pdev, res);
 	if (IS_ERR(host_data->base)) {
 		dev_err(dev, "Unable to map registers\n");
 		return PTR_ERR(host_data->base);
diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c
index ef4d625..d2ad3cc 100644
--- a/drivers/irqchip/irq-ti-sci-inta.c
+++ b/drivers/irqchip/irq-ti-sci-inta.c
@@ -567,8 +567,7 @@  static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev)
 		return PTR_ERR(inta->global_event);
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	inta->base = devm_ioremap_resource(dev, res);
+	inta->base = devm_platform_ioremap_resource(pdev, res);
 	if (IS_ERR(inta->base))
 		return -ENODEV;
 
diff --git a/drivers/irqchip/irq-ts4800.c b/drivers/irqchip/irq-ts4800.c
index 2325fb3..f1cefa9 100644
--- a/drivers/irqchip/irq-ts4800.c
+++ b/drivers/irqchip/irq-ts4800.c
@@ -101,8 +101,7 @@  static int ts4800_ic_probe(struct platform_device *pdev)
 	if (!data)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	data->base = devm_ioremap_resource(&pdev->dev, res);
+	data->base = devm_platform_ioremap_resource(pdev, res);
 	if (IS_ERR(data->base))
 		return PTR_ERR(data->base);