All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] ata: pata_pxa: Use platform_get_irq() to get the interrupt
@ 2022-03-09  5:50 cgel.zte
  2022-03-09  6:24 ` Damien Le Moal
  0 siblings, 1 reply; 8+ messages in thread
From: cgel.zte @ 2022-03-09  5:50 UTC (permalink / raw)
  To: s.shtylyov
  Cc: damien.lemoal, linux-ide, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

v1->v2:
	- Use more specific in the subject: ata: pata_pxa:
	- Switch to returning 'irq'
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/ata/pata_pxa.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
index 41430f79663c..340b274d0cad 100644
--- a/drivers/ata/pata_pxa.c
+++ b/drivers/ata/pata_pxa.c
@@ -164,10 +164,10 @@ static int pxa_ata_probe(struct platform_device *pdev)
 	struct resource *cmd_res;
 	struct resource *ctl_res;
 	struct resource *dma_res;
-	struct resource *irq_res;
 	struct pata_pxa_pdata *pdata = dev_get_platdata(&pdev->dev);
 	struct dma_slave_config	config;
 	int ret = 0;
+	int irq;
 
 	/*
 	 * Resource validation, three resources are needed:
@@ -205,9 +205,9 @@ static int pxa_ata_probe(struct platform_device *pdev)
 	/*
 	 * IRQ pin
 	 */
-	irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (unlikely(irq_res == NULL))
-		return -EINVAL;
+	irq = platform_get_irq(pdev, 0);
+	if (unlikely(irq < 0))
+		return irq;
 
 	/*
 	 * Allocate the host
@@ -287,7 +287,7 @@ static int pxa_ata_probe(struct platform_device *pdev)
 	/*
 	 * Activate the ATA host
 	 */
-	ret = ata_host_activate(host, irq_res->start, ata_sff_interrupt,
+	ret = ata_host_activate(host, irq, ata_sff_interrupt,
 				pdata->irq_flags, &pxa_ata_sht);
 	if (ret)
 		dma_release_channel(data->dma_chan);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH V2] ata: pata_pxa: Use platform_get_irq() to get the interrupt
  2022-03-09  5:50 [PATCH V2] ata: pata_pxa: Use platform_get_irq() to get the interrupt cgel.zte
@ 2022-03-09  6:24 ` Damien Le Moal
  2022-03-09  7:28   ` [PATCH V3] " cgel.zte
  0 siblings, 1 reply; 8+ messages in thread
From: Damien Le Moal @ 2022-03-09  6:24 UTC (permalink / raw)
  To: cgel.zte, s.shtylyov; +Cc: linux-ide, linux-kernel, Minghao Chi, Zeal Robot

On 3/9/22 14:50, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> allocation of IRQ resources in DT core code, this causes an issue
> when using hierarchical interrupt domains using "interrupts" property
> in the node as this bypasses the hierarchical setup and messes up the
> irq chaining.
> 
> In preparation for removal of static setup of IRQ resource from DT core
> code use platform_get_irq().
> 
> v1->v2:
> 	- Use more specific in the subject: ata: pata_pxa:
> 	- Switch to returning 'irq'
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>  drivers/ata/pata_pxa.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
> index 41430f79663c..340b274d0cad 100644
> --- a/drivers/ata/pata_pxa.c
> +++ b/drivers/ata/pata_pxa.c
> @@ -164,10 +164,10 @@ static int pxa_ata_probe(struct platform_device *pdev)
>  	struct resource *cmd_res;
>  	struct resource *ctl_res;
>  	struct resource *dma_res;
> -	struct resource *irq_res;
>  	struct pata_pxa_pdata *pdata = dev_get_platdata(&pdev->dev);
>  	struct dma_slave_config	config;
>  	int ret = 0;
> +	int irq;
>  
>  	/*
>  	 * Resource validation, three resources are needed:
> @@ -205,9 +205,9 @@ static int pxa_ata_probe(struct platform_device *pdev)
>  	/*
>  	 * IRQ pin
>  	 */
> -	irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -	if (unlikely(irq_res == NULL))
> -		return -EINVAL;
> +	irq = platform_get_irq(pdev, 0);
> +	if (unlikely(irq < 0))

Please drop the unlikely() here. Not needed. This is not the hot path.

> +		return irq;
>  
>  	/*
>  	 * Allocate the host
> @@ -287,7 +287,7 @@ static int pxa_ata_probe(struct platform_device *pdev)
>  	/*
>  	 * Activate the ATA host
>  	 */
> -	ret = ata_host_activate(host, irq_res->start, ata_sff_interrupt,
> +	ret = ata_host_activate(host, irq, ata_sff_interrupt,
>  				pdata->irq_flags, &pxa_ata_sht);
>  	if (ret)
>  		dma_release_channel(data->dma_chan);


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH V3] ata: pata_pxa: Use platform_get_irq() to get the interrupt
  2022-03-09  6:24 ` Damien Le Moal
@ 2022-03-09  7:28   ` cgel.zte
  2022-03-09  7:31     ` Damien Le Moal
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: cgel.zte @ 2022-03-09  7:28 UTC (permalink / raw)
  To: damien.lemoal
  Cc: cgel.zte, chi.minghao, linux-ide, linux-kernel, s.shtylyov, zealci

From: Minghao Chi <chi.minghao@zte.com.cn>

platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
allocation of IRQ resources in DT core code, this causes an issue
when using hierarchical interrupt domains using "interrupts" property
in the node as this bypasses the hierarchical setup and messes up the
irq chaining.

In preparation for removal of static setup of IRQ resource from DT core
code use platform_get_irq().

v1->v2:
    - Use more specific in the subject: ata: pata_pxa:
    - Switch to returning 'irq'
v2->v3:
    - drop the unlikely()

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/ata/pata_pxa.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
index 41430f79663c..985f42c4fd70 100644
--- a/drivers/ata/pata_pxa.c
+++ b/drivers/ata/pata_pxa.c
@@ -164,10 +164,10 @@ static int pxa_ata_probe(struct platform_device *pdev)
 	struct resource *cmd_res;
 	struct resource *ctl_res;
 	struct resource *dma_res;
-	struct resource *irq_res;
 	struct pata_pxa_pdata *pdata = dev_get_platdata(&pdev->dev);
 	struct dma_slave_config	config;
 	int ret = 0;
+	int irq;
 
 	/*
 	 * Resource validation, three resources are needed:
@@ -205,9 +205,9 @@ static int pxa_ata_probe(struct platform_device *pdev)
 	/*
 	 * IRQ pin
 	 */
-	irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (unlikely(irq_res == NULL))
-		return -EINVAL;
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
 
 	/*
 	 * Allocate the host
@@ -287,7 +287,7 @@ static int pxa_ata_probe(struct platform_device *pdev)
 	/*
 	 * Activate the ATA host
 	 */
-	ret = ata_host_activate(host, irq_res->start, ata_sff_interrupt,
+	ret = ata_host_activate(host, irq, ata_sff_interrupt,
 				pdata->irq_flags, &pxa_ata_sht);
 	if (ret)
 		dma_release_channel(data->dma_chan);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH V3] ata: pata_pxa: Use platform_get_irq() to get the interrupt
  2022-03-09  7:28   ` [PATCH V3] " cgel.zte
@ 2022-03-09  7:31     ` Damien Le Moal
  2022-03-09  8:55       ` Sergei Shtylyov
  2022-03-09  8:51     ` Sergey Shtylyov
  2022-03-10  2:21     ` Damien Le Moal
  2 siblings, 1 reply; 8+ messages in thread
From: Damien Le Moal @ 2022-03-09  7:31 UTC (permalink / raw)
  To: cgel.zte; +Cc: chi.minghao, linux-ide, linux-kernel, s.shtylyov, zealci

On 3/9/22 16:28, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> allocation of IRQ resources in DT core code, this causes an issue
> when using hierarchical interrupt domains using "interrupts" property
> in the node as this bypasses the hierarchical setup and messes up the
> irq chaining.
> 
> In preparation for removal of static setup of IRQ resource from DT core
> code use platform_get_irq().
> 
> v1->v2:
>     - Use more specific in the subject: ata: pata_pxa:
>     - Switch to returning 'irq'
> v2->v3:
>     - drop the unlikely()

Looks good. FYI, the changelog above should be placed under the "---"
after your Signed-off-by so that it does not stay as part of the commit
message. No need to resend, I will remove this when applying.

Sergey,

Review OK ?

> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>  drivers/ata/pata_pxa.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
> index 41430f79663c..985f42c4fd70 100644
> --- a/drivers/ata/pata_pxa.c
> +++ b/drivers/ata/pata_pxa.c
> @@ -164,10 +164,10 @@ static int pxa_ata_probe(struct platform_device *pdev)
>  	struct resource *cmd_res;
>  	struct resource *ctl_res;
>  	struct resource *dma_res;
> -	struct resource *irq_res;
>  	struct pata_pxa_pdata *pdata = dev_get_platdata(&pdev->dev);
>  	struct dma_slave_config	config;
>  	int ret = 0;
> +	int irq;
>  
>  	/*
>  	 * Resource validation, three resources are needed:
> @@ -205,9 +205,9 @@ static int pxa_ata_probe(struct platform_device *pdev)
>  	/*
>  	 * IRQ pin
>  	 */
> -	irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -	if (unlikely(irq_res == NULL))
> -		return -EINVAL;
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq < 0)
> +		return irq;
>  
>  	/*
>  	 * Allocate the host
> @@ -287,7 +287,7 @@ static int pxa_ata_probe(struct platform_device *pdev)
>  	/*
>  	 * Activate the ATA host
>  	 */
> -	ret = ata_host_activate(host, irq_res->start, ata_sff_interrupt,
> +	ret = ata_host_activate(host, irq, ata_sff_interrupt,
>  				pdata->irq_flags, &pxa_ata_sht);
>  	if (ret)
>  		dma_release_channel(data->dma_chan);


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V3] ata: pata_pxa: Use platform_get_irq() to get the interrupt
  2022-03-09  7:28   ` [PATCH V3] " cgel.zte
  2022-03-09  7:31     ` Damien Le Moal
@ 2022-03-09  8:51     ` Sergey Shtylyov
  2022-03-10  2:21     ` Damien Le Moal
  2 siblings, 0 replies; 8+ messages in thread
From: Sergey Shtylyov @ 2022-03-09  8:51 UTC (permalink / raw)
  To: cgel.zte, damien.lemoal; +Cc: chi.minghao, linux-ide, linux-kernel, zealci

On 09.03.2022 10:28, cgel.zte@gmail.com wrote:

> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> allocation of IRQ resources in DT core code, this causes an issue
> when using hierarchical interrupt domains using "interrupts" property
> in the node as this bypasses the hierarchical setup and messes up the
> irq chaining.
> 
> In preparation for removal of static setup of IRQ resource from DT core
> code use platform_get_irq().
> 
> v1->v2:
>      - Use more specific in the subject: ata: pata_pxa:
>      - Switch to returning 'irq'
> v2->v3:
>      - drop the unlikely()
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]

MBR, Sergey

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V3] ata: pata_pxa: Use platform_get_irq() to get the interrupt
  2022-03-09  7:31     ` Damien Le Moal
@ 2022-03-09  8:55       ` Sergei Shtylyov
  2022-03-09  9:00         ` Sergey Shtylyov
  0 siblings, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2022-03-09  8:55 UTC (permalink / raw)
  To: Damien Le Moal, cgel.zte
  Cc: chi.minghao, linux-ide, linux-kernel, s.shtylyov, zealci

On 09.03.2022 10:31, Damien Le Moal wrote:

>> From: Minghao Chi <chi.minghao@zte.com.cn>
>>
>> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
>> allocation of IRQ resources in DT core code, this causes an issue
>> when using hierarchical interrupt domains using "interrupts" property
>> in the node as this bypasses the hierarchical setup and messes up the
>> irq chaining.
>>
>> In preparation for removal of static setup of IRQ resource from DT core
>> code use platform_get_irq().
>>
>> v1->v2:
>>      - Use more specific in the subject: ata: pata_pxa:
>>      - Switch to returning 'irq'
>> v2->v3:
>>      - drop the unlikely()
> 
> Looks good. FYI, the changelog above should be placed under the "---"
> after your Signed-off-by so that it does not stay as part of the commit
> message. No need to resend, I will remove this when applying.
> 
> Sergey,
> 
> Review OK ?

    Yes.
    Although, strictly speaking, we still need to check for IRQ0 as well...

MBR, Sergey

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V3] ata: pata_pxa: Use platform_get_irq() to get the interrupt
  2022-03-09  8:55       ` Sergei Shtylyov
@ 2022-03-09  9:00         ` Sergey Shtylyov
  0 siblings, 0 replies; 8+ messages in thread
From: Sergey Shtylyov @ 2022-03-09  9:00 UTC (permalink / raw)
  To: Sergei Shtylyov, Damien Le Moal, cgel.zte
  Cc: chi.minghao, linux-ide, linux-kernel, zealci

On 09.03.2022 11:55, Sergei Shtylyov wrote:

>>> From: Minghao Chi <chi.minghao@zte.com.cn>
>>>
>>> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
>>> allocation of IRQ resources in DT core code, this causes an issue
>>> when using hierarchical interrupt domains using "interrupts" property
>>> in the node as this bypasses the hierarchical setup and messes up the
>>> irq chaining.
>>>
>>> In preparation for removal of static setup of IRQ resource from DT core
>>> code use platform_get_irq().
>>>
>>> v1->v2:
>>>      - Use more specific in the subject: ata: pata_pxa:
>>>      - Switch to returning 'irq'
>>> v2->v3:
>>>      - drop the unlikely()
>>
>> Looks good. FYI, the changelog above should be placed under the "---"
>> after your Signed-off-by so that it does not stay as part of the commit
>> message. No need to resend, I will remove this when applying.
>>
>> Sergey,
>>
>> Review OK ?
> 
>     Yes.

    Ugh, replied from the wrong account. I had provided my Reviewed-by: tag 
already...

>     Although, strictly speaking, we still need to check for IRQ0 as well...

    The platform_get_irq() patch preventing IRQ0 hasn't landed still...

MBR, Sergey

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V3] ata: pata_pxa: Use platform_get_irq() to get the interrupt
  2022-03-09  7:28   ` [PATCH V3] " cgel.zte
  2022-03-09  7:31     ` Damien Le Moal
  2022-03-09  8:51     ` Sergey Shtylyov
@ 2022-03-10  2:21     ` Damien Le Moal
  2 siblings, 0 replies; 8+ messages in thread
From: Damien Le Moal @ 2022-03-10  2:21 UTC (permalink / raw)
  To: cgel.zte; +Cc: chi.minghao, linux-ide, linux-kernel, s.shtylyov, zealci

On 3/9/22 16:28, cgel.zte@gmail.com wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
> 
> platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static
> allocation of IRQ resources in DT core code, this causes an issue
> when using hierarchical interrupt domains using "interrupts" property
> in the node as this bypasses the hierarchical setup and messes up the
> irq chaining.
> 
> In preparation for removal of static setup of IRQ resource from DT core
> code use platform_get_irq().
> 
> v1->v2:
>     - Use more specific in the subject: ata: pata_pxa:
>     - Switch to returning 'irq'
> v2->v3:
>     - drop the unlikely()
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>

Applied to for-5.18 (without commit message fix). Thanks !


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-10  2:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09  5:50 [PATCH V2] ata: pata_pxa: Use platform_get_irq() to get the interrupt cgel.zte
2022-03-09  6:24 ` Damien Le Moal
2022-03-09  7:28   ` [PATCH V3] " cgel.zte
2022-03-09  7:31     ` Damien Le Moal
2022-03-09  8:55       ` Sergei Shtylyov
2022-03-09  9:00         ` Sergey Shtylyov
2022-03-09  8:51     ` Sergey Shtylyov
2022-03-10  2:21     ` Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.