All of lore.kernel.org
 help / color / mirror / Atom feed
From: zonque@gmail.com (Daniel Mack)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] GPIO: gpio-pxa: simplify pxa_gpio_to_irq() and pxa_irq_to_chip()
Date: Sun, 05 Aug 2012 13:56:13 +0200	[thread overview]
Message-ID: <501E5F5D.5070901@gmail.com> (raw)
In-Reply-To: <501E2F6C.4050507@compulab.co.il>

On 05.08.2012 10:31, Igor Grinberg wrote:
> Hi Daniel,
> 
> On 07/25/12 18:35, Daniel Mack wrote:
>> Simplify the code in gpio-pxa.c and make them based on irq_base.
>> When not probed from devicetree, initialize irq_base from
>> PXA_GPIO_TO_IRQ() or MMP_GPIO_TO_IRQ(), respectively, so the non-DT case
>> still works.
>>
>> Only tested on PXA3xx.
>>
>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>> ---
>>  drivers/gpio/gpio-pxa.c |   70 +++++++++++------------------------------------
>>  1 file changed, 16 insertions(+), 54 deletions(-)
>>
>> diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
>> index 58a6a63..6d0cb9d 100644
>> --- a/drivers/gpio/gpio-pxa.c
>> +++ b/drivers/gpio/gpio-pxa.c
> 
> [...]
> 
>> @@ -564,10 +516,20 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev)
>>  	int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;
>>  
>>  	ret = pxa_gpio_probe_dt(pdev);
>> -	if (ret < 0)
>> +	if (ret < 0) {
>>  		pxa_last_gpio = pxa_gpio_nums();
>> -	else
>> +#ifdef CONFIG_ARCH_PXA
>> +		if (gpio_is_pxa_type(gpio_type))
>> +			irq_base = PXA_GPIO_TO_IRQ(0);
>> +#endif
>> +#ifdef CONFIG_ARCH_MMP
>> +		if (gpio_is_mmp_type(gpio_type))
>> +			irq_base = MMP_GPIO_TO_IRQ(0);
>> +#endif
> 
> The ifdes above do not look essential.

But they are. In case of !CONFIG_ARCH_MMP, MMP_GPIO_TO_IRQ is undefined.
Same problem for !CONFIG_ARC_PXA.

> Can't we drop them and just have else if ... else if?

We can't do that either, as we might have a hybrid kernel that works on
both PXA and MMP platforms, and then the condition is a runtime thing.


Daniel

  reply	other threads:[~2012-08-05 11:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 15:35 [PATCH 1/2] GPIO: gpio-pxa: simplify pxa_gpio_to_irq() and pxa_irq_to_chip() Daniel Mack
2012-07-25 15:35 ` [PATCH 2/2] GPIO: gpio-pxa: fix devicetree functions Daniel Mack
2012-08-04 23:16   ` Linus Walleij
2012-08-05  3:52     ` Haojian Zhuang
2012-08-05  9:40       ` Linus Walleij
2012-08-05 12:58         ` Haojian Zhuang
2012-07-25 16:17 ` [PATCH 1/2] GPIO: gpio-pxa: simplify pxa_gpio_to_irq() and pxa_irq_to_chip() Arnd Bergmann
2012-07-25 18:11   ` Daniel Mack
2012-07-25 19:10     ` Arnd Bergmann
2012-08-04 23:20       ` Linus Walleij
2012-08-05  8:31 ` Igor Grinberg
2012-08-05 11:56   ` Daniel Mack [this message]
2012-08-06 10:08     ` Igor Grinberg
2012-08-06 10:26       ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=501E5F5D.5070901@gmail.com \
    --to=zonque@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.