From: grinberg@compulab.co.il (Igor Grinberg)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pxa270 rtc wakeup event fix
Date: Tue, 12 Apr 2011 12:56:29 +0300 [thread overview]
Message-ID: <4DA421CD.8090103@compulab.co.il> (raw)
In-Reply-To: <4DA40D2D.40807@googlemail.com>
Hi Nick,
On 04/12/11 11:28, Nick Bane wrote:
>
>> Hi Nick,
>>
>> Thanks for spotting this. The problem is really IRQ_TO_GPIO() macro
>> doesn't behave as assumed. A better approach would be to return -1
>> when none-GPIO IRQs are mapped back, let me know if you are OK w/
>> the patch below:
>>
> Hi Eric
> That looks like the right answer.
> Nick
>> diff --git a/arch/arm/mach-pxa/include/mach/gpio.h
>> b/arch/arm/mach-pxa/include/mach/gpio.h
>> index b024a8b..b9f4ed1 100644
>> --- a/arch/arm/mach-pxa/include/mach/gpio.h
>> +++ b/arch/arm/mach-pxa/include/mach/gpio.h
>> @@ -103,7 +103,20 @@
>>
>> #define gpio_to_bank(gpio) ((gpio)>> 5)
>> #define gpio_to_irq(gpio) IRQ_GPIO(gpio)
>> -#define irq_to_gpio(irq) IRQ_TO_GPIO(irq)
>> +
>> +static inline int irq_to_gpio(unsigned int irq)
>> +{
>> + int gpio;
>> +
>> + if (irq == IRQ_GPIO0 || irq == IRQ_GPIO1)
>> + return irq - IRQ_GPIO0;
>> +
>> + gpio = irq - PXA_GPIO_IRQ_BASE;
>> + if (gpio>= 2&& gpio< NR_BUILTIN_GPIO)
This is a really nice white space game, your mailer plays ;)
Really funny...
>> + return gpio;
>> +
>> + return -1;
>> +}
>>
>> #ifdef CONFIG_CPU_PXA26x
>> /* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
>> diff --git a/arch/arm/mach-pxa/include/mach/irqs.h
>> b/arch/arm/mach-pxa/include/mach/irqs.h
>> index a4285fc..0384024 100644
>> --- a/arch/arm/mach-pxa/include/mach/irqs.h
>> +++ b/arch/arm/mach-pxa/include/mach/irqs.h
>> @@ -93,9 +93,6 @@
>> #define GPIO_2_x_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x))
>> #define IRQ_GPIO(x) (((x)< 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x))
>>
>> -#define IRQ_TO_GPIO_2_x(i) ((i) - PXA_GPIO_IRQ_BASE)
>> -#define IRQ_TO_GPIO(i) (((i)< IRQ_GPIO(2)) ? ((i) - IRQ_GPIO0) :
>> IRQ_TO_GPIO_2_x(i))
>> -
>> /*
>> * The following interrupts are for board specific purposes. Since
>> * the kernel can only run on one machine at a time, we can re-use
>> diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
>> index 6bde595..a4af8c5 100644
>> --- a/arch/arm/mach-pxa/pxa25x.c
>> +++ b/arch/arm/mach-pxa/pxa25x.c
>> @@ -285,7 +285,7 @@ static inline void pxa25x_init_pm(void) {}
>>
>> static int pxa25x_set_wake(struct irq_data *d, unsigned int on)
>> {
>> - int gpio = IRQ_TO_GPIO(d->irq);
>> + int gpio = irq_to_gpio(d->irq);
>> uint32_t mask = 0;
>>
>> if (gpio>= 0&& gpio< 85)
>> diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
>> index 1cb5d0f..909756e 100644
>> --- a/arch/arm/mach-pxa/pxa27x.c
>> +++ b/arch/arm/mach-pxa/pxa27x.c
>> @@ -345,7 +345,7 @@ static inline void pxa27x_init_pm(void) {}
>> */
>> static int pxa27x_set_wake(struct irq_data *d, unsigned int on)
>> {
>> - int gpio = IRQ_TO_GPIO(d->irq);
>> + int gpio = irq_to_gpio(d->irq);
>> uint32_t mask;
>>
>> if (gpio>= 0&& gpio< 128)
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
Regards,
Igor.
next prev parent reply other threads:[~2011-04-12 9:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-08 16:42 [PATCH] pxa270 rtc wakeup event fix Nick Bane
2011-04-08 19:36 ` Marek Vasut
2011-04-12 7:44 ` Eric Miao
2011-04-12 8:28 ` Nick Bane
2011-04-12 9:56 ` Igor Grinberg [this message]
2011-04-12 10:53 ` Marek Vasut
2011-04-12 13:47 ` Eric Miao
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=4DA421CD.8090103@compulab.co.il \
--to=grinberg@compulab.co.il \
--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.