linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops
@ 2017-09-14  2:37 Masahiro Yamada
  2017-09-14 16:59 ` David Daney
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Masahiro Yamada @ 2017-09-14  2:37 UTC (permalink / raw)
  To: linux-gpio, Linus Walleij, David Daney
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Masahiro Yamada,
	linux-kernel

This driver implements .alloc() hook, so .map() is not used.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/gpio/gpio-thunderx.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
index 57efb25..b5adb79 100644
--- a/drivers/gpio/gpio-thunderx.c
+++ b/drivers/gpio/gpio-thunderx.c
@@ -417,18 +417,6 @@ static struct irq_chip thunderx_gpio_irq_chip = {
 	.flags			= IRQCHIP_SET_TYPE_MASKED
 };
 
-static int thunderx_gpio_irq_map(struct irq_domain *d, unsigned int irq,
-				 irq_hw_number_t hwirq)
-{
-	struct thunderx_gpio *txgpio = d->host_data;
-
-	if (hwirq >= txgpio->chip.ngpio)
-		return -EINVAL;
-	if (!thunderx_gpio_is_gpio_nowarn(txgpio, hwirq))
-		return -EPERM;
-	return 0;
-}
-
 static int thunderx_gpio_irq_translate(struct irq_domain *d,
 				       struct irq_fwspec *fwspec,
 				       irq_hw_number_t *hwirq,
@@ -455,7 +443,6 @@ static int thunderx_gpio_irq_alloc(struct irq_domain *d, unsigned int virq,
 }
 
 static const struct irq_domain_ops thunderx_gpio_irqd_ops = {
-	.map		= thunderx_gpio_irq_map,
 	.alloc		= thunderx_gpio_irq_alloc,
 	.translate	= thunderx_gpio_irq_translate
 };
-- 
2.7.4

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

* Re: [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops
  2017-09-14  2:37 [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops Masahiro Yamada
@ 2017-09-14 16:59 ` David Daney
  2017-09-15  1:48   ` Masahiro Yamada
  2017-09-21 11:30 ` Linus Walleij
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: David Daney @ 2017-09-14 16:59 UTC (permalink / raw)
  To: Masahiro Yamada, linux-gpio, Linus Walleij, David Daney
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, linux-kernel

On 09/13/2017 07:37 PM, Masahiro Yamada wrote:
> This driver implements .alloc() hook, so .map() is not used.
> 

Have you tested this?

I will have to test this on a real system next week before I can really 
comment on it.

David.



> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>   drivers/gpio/gpio-thunderx.c | 13 -------------
>   1 file changed, 13 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
> index 57efb25..b5adb79 100644
> --- a/drivers/gpio/gpio-thunderx.c
> +++ b/drivers/gpio/gpio-thunderx.c
> @@ -417,18 +417,6 @@ static struct irq_chip thunderx_gpio_irq_chip = {
>   	.flags			= IRQCHIP_SET_TYPE_MASKED
>   };
>   
> -static int thunderx_gpio_irq_map(struct irq_domain *d, unsigned int irq,
> -				 irq_hw_number_t hwirq)
> -{
> -	struct thunderx_gpio *txgpio = d->host_data;
> -
> -	if (hwirq >= txgpio->chip.ngpio)
> -		return -EINVAL;
> -	if (!thunderx_gpio_is_gpio_nowarn(txgpio, hwirq))
> -		return -EPERM;
> -	return 0;
> -}
> -
>   static int thunderx_gpio_irq_translate(struct irq_domain *d,
>   				       struct irq_fwspec *fwspec,
>   				       irq_hw_number_t *hwirq,
> @@ -455,7 +443,6 @@ static int thunderx_gpio_irq_alloc(struct irq_domain *d, unsigned int virq,
>   }
>   
>   static const struct irq_domain_ops thunderx_gpio_irqd_ops = {
> -	.map		= thunderx_gpio_irq_map,
>   	.alloc		= thunderx_gpio_irq_alloc,
>   	.translate	= thunderx_gpio_irq_translate
>   };
> 

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

* Re: [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops
  2017-09-14 16:59 ` David Daney
@ 2017-09-15  1:48   ` Masahiro Yamada
  0 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2017-09-15  1:48 UTC (permalink / raw)
  To: David Daney
  Cc: linux-gpio, Linus Walleij, David Daney, Thomas Gleixner,
	Jason Cooper, Marc Zyngier, Linux Kernel Mailing List

Hi David,

2017-09-15 1:59 GMT+09:00 David Daney <ddaney@caviumnetworks.com>:
> On 09/13/2017 07:37 PM, Masahiro Yamada wrote:
>>
>> This driver implements .alloc() hook, so .map() is not used.
>>
>
> Have you tested this?


No.  I do not have access to this hardware.

It is just, in my understanding,
.alloc() and .map() are exclusive.



> I will have to test this on a real system next week before I can really
> comment on it.
>
> David.
>
>
>
>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>>   drivers/gpio/gpio-thunderx.c | 13 -------------
>>   1 file changed, 13 deletions(-)
>>
>> diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
>> index 57efb25..b5adb79 100644
>> --- a/drivers/gpio/gpio-thunderx.c
>> +++ b/drivers/gpio/gpio-thunderx.c
>> @@ -417,18 +417,6 @@ static struct irq_chip thunderx_gpio_irq_chip = {
>>         .flags                  = IRQCHIP_SET_TYPE_MASKED
>>   };
>>   -static int thunderx_gpio_irq_map(struct irq_domain *d, unsigned int
>> irq,
>> -                                irq_hw_number_t hwirq)
>> -{
>> -       struct thunderx_gpio *txgpio = d->host_data;
>> -
>> -       if (hwirq >= txgpio->chip.ngpio)
>> -               return -EINVAL;
>> -       if (!thunderx_gpio_is_gpio_nowarn(txgpio, hwirq))
>> -               return -EPERM;
>> -       return 0;
>> -}
>> -
>>   static int thunderx_gpio_irq_translate(struct irq_domain *d,
>>                                        struct irq_fwspec *fwspec,
>>                                        irq_hw_number_t *hwirq,
>> @@ -455,7 +443,6 @@ static int thunderx_gpio_irq_alloc(struct irq_domain
>> *d, unsigned int virq,
>>   }
>>     static const struct irq_domain_ops thunderx_gpio_irqd_ops = {
>> -       .map            = thunderx_gpio_irq_map,
>>         .alloc          = thunderx_gpio_irq_alloc,
>>         .translate      = thunderx_gpio_irq_translate
>>   };
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops
  2017-09-14  2:37 [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops Masahiro Yamada
  2017-09-14 16:59 ` David Daney
@ 2017-09-21 11:30 ` Linus Walleij
  2017-09-21 21:54 ` David Daney
  2017-09-22 13:32 ` Linus Walleij
  3 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2017-09-21 11:30 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-gpio, David Daney, Thomas Gleixner, Jason Cooper,
	Marc Zyngier, linux-kernel

On Thu, Sep 14, 2017 at 4:37 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:

> This driver implements .alloc() hook, so .map() is not used.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Waiting for David to test this patch before applying.

Yours,
Linus Walleij

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

* Re: [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops
  2017-09-14  2:37 [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops Masahiro Yamada
  2017-09-14 16:59 ` David Daney
  2017-09-21 11:30 ` Linus Walleij
@ 2017-09-21 21:54 ` David Daney
  2017-10-08 13:39   ` Masahiro Yamada
  2017-09-22 13:32 ` Linus Walleij
  3 siblings, 1 reply; 7+ messages in thread
From: David Daney @ 2017-09-21 21:54 UTC (permalink / raw)
  To: Masahiro Yamada, linux-gpio, Linus Walleij, David Daney
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, linux-kernel

On 09/13/2017 07:37 PM, Masahiro Yamada wrote:
> This driver implements .alloc() hook, so .map() is not used.

Although this comment is true for this driver, it is unclear to me if 
the statement is true in the general case.


> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Tested-by: David Daney <david.daney@cavium.com>

> ---
> 
>   drivers/gpio/gpio-thunderx.c | 13 -------------
>   1 file changed, 13 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
> index 57efb25..b5adb79 100644
> --- a/drivers/gpio/gpio-thunderx.c
> +++ b/drivers/gpio/gpio-thunderx.c
> @@ -417,18 +417,6 @@ static struct irq_chip thunderx_gpio_irq_chip = {
>   	.flags			= IRQCHIP_SET_TYPE_MASKED
>   };
>   
> -static int thunderx_gpio_irq_map(struct irq_domain *d, unsigned int irq,
> -				 irq_hw_number_t hwirq)
> -{
> -	struct thunderx_gpio *txgpio = d->host_data;
> -
> -	if (hwirq >= txgpio->chip.ngpio)
> -		return -EINVAL;
> -	if (!thunderx_gpio_is_gpio_nowarn(txgpio, hwirq))
> -		return -EPERM;
> -	return 0;
> -}
> -
>   static int thunderx_gpio_irq_translate(struct irq_domain *d,
>   				       struct irq_fwspec *fwspec,
>   				       irq_hw_number_t *hwirq,
> @@ -455,7 +443,6 @@ static int thunderx_gpio_irq_alloc(struct irq_domain *d, unsigned int virq,
>   }
>   
>   static const struct irq_domain_ops thunderx_gpio_irqd_ops = {
> -	.map		= thunderx_gpio_irq_map,
>   	.alloc		= thunderx_gpio_irq_alloc,
>   	.translate	= thunderx_gpio_irq_translate
>   };
> 

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

* Re: [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops
  2017-09-14  2:37 [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops Masahiro Yamada
                   ` (2 preceding siblings ...)
  2017-09-21 21:54 ` David Daney
@ 2017-09-22 13:32 ` Linus Walleij
  3 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2017-09-22 13:32 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-gpio, David Daney, Thomas Gleixner, Jason Cooper,
	Marc Zyngier, linux-kernel

On Thu, Sep 14, 2017 at 4:37 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:

> This driver implements .alloc() hook, so .map() is not used.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Patch applied with David's Tested-by.

Yours,
Linus Walleij

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

* Re: [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops
  2017-09-21 21:54 ` David Daney
@ 2017-10-08 13:39   ` Masahiro Yamada
  0 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2017-10-08 13:39 UTC (permalink / raw)
  To: David Daney
  Cc: linux-gpio, Linus Walleij, David Daney, Thomas Gleixner,
	Jason Cooper, Marc Zyngier, Linux Kernel Mailing List

2017-09-22 6:54 GMT+09:00 David Daney <ddaney@caviumnetworks.com>:
> On 09/13/2017 07:37 PM, Masahiro Yamada wrote:
>>
>> This driver implements .alloc() hook, so .map() is not used.
>
>
> Although this comment is true for this driver, it is unclear to me if the
> statement is true in the general case.

If a driver implements .alloc() hook,
irq_domain_check_hierarchy() sets IRQ_DOMAIN_FLAG_HIERARCHY flag.


If you see kernel/irq/irqdomain.c,
alloc/map is selected by irq_domain_is_hierarchy().



-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2017-10-08 13:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-14  2:37 [PATCH] gpio: thunderx: remove unused .map() hook from irq_domain_ops Masahiro Yamada
2017-09-14 16:59 ` David Daney
2017-09-15  1:48   ` Masahiro Yamada
2017-09-21 11:30 ` Linus Walleij
2017-09-21 21:54 ` David Daney
2017-10-08 13:39   ` Masahiro Yamada
2017-09-22 13:32 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).