* [PATCH] gpio: Langwell GPIO driver miscellaneous clean-ups
@ 2009-11-22 3:19 Alek Du
2009-11-24 20:29 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Alek Du @ 2009-11-22 3:19 UTC (permalink / raw)
To: Kernel Mailing List; +Cc: David Brownell, Andrew Morton
>From 9ba8224f5246ef7fdf1c0a15bb5535e442731435 Mon Sep 17 00:00:00 2001
From: Alek Du <alek.du@intel.com>
Date: Sun, 22 Nov 2009 10:58:21 +0800
Subject: [PATCH] gpio: Langwell GPIO driver miscellaneous clean-ups
1. Use >= N to check invalid gpio number (unsigned type)
2. Remove wrong and unnecessary unmask operation
3. Remove extra GEDR reading
The 2) and 3) will fix interrupts losing when two or more pins are triggered at close time.
Signed-off-by: Alek Du <alek.du@intel.com>
---
drivers/gpio/langwell_gpio.c | 13 ++-----------
1 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/gpio/langwell_gpio.c b/drivers/gpio/langwell_gpio.c
index 5711ce5..6c0ebbd 100644
--- a/drivers/gpio/langwell_gpio.c
+++ b/drivers/gpio/langwell_gpio.c
@@ -123,7 +123,7 @@ static int lnw_irq_type(unsigned irq, unsigned type)
void __iomem *grer = (void __iomem *)(&lnw->reg_base->GRER[reg]);
void __iomem *gfer = (void __iomem *)(&lnw->reg_base->GFER[reg]);
- if (gpio < 0 || gpio > lnw->chip.ngpio)
+ if (gpio >= lnw->chip.ngpio)
return -EINVAL;
spin_lock_irqsave(&lnw->lock, flags);
if (type & IRQ_TYPE_EDGE_RISING)
@@ -144,13 +144,6 @@ static int lnw_irq_type(unsigned irq, unsigned type)
static void lnw_irq_unmask(unsigned irq)
{
- struct lnw_gpio *lnw = get_irq_chip_data(irq);
- u32 gpio = irq - lnw->irq_base;
- u8 reg = gpio / 32;
- void __iomem *gedr;
-
- gedr = (void __iomem *)(&lnw->reg_base->GEDR[reg]);
- writel(BIT(gpio % 32), gedr);
};
static void lnw_irq_mask(unsigned irq)
@@ -183,13 +176,11 @@ static void lnw_irq_handler(unsigned irq, struct irq_desc *desc)
gedr_v = readl(gedr);
if (!gedr_v)
continue;
- for (gpio = reg*32; gpio < reg*32+32; gpio++) {
- gedr_v = readl(gedr);
+ for (gpio = reg*32; gpio < reg*32+32; gpio++)
if (gedr_v & BIT(gpio % 32)) {
pr_debug("pin %d triggered\n", gpio);
generic_handle_irq(lnw->irq_base + gpio);
}
- }
/* clear the edge detect status bit */
writel(gedr_v, gedr);
}
--
1.6.3.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: Langwell GPIO driver miscellaneous clean-ups
2009-11-22 3:19 [PATCH] gpio: Langwell GPIO driver miscellaneous clean-ups Alek Du
@ 2009-11-24 20:29 ` Andrew Morton
2009-11-25 1:02 ` Alek Du
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2009-11-24 20:29 UTC (permalink / raw)
To: Alek Du; +Cc: Kernel Mailing List, David Brownell
On Sun, 22 Nov 2009 11:19:01 +0800
Alek Du <alek.du@intel.com> wrote:
> >From 9ba8224f5246ef7fdf1c0a15bb5535e442731435 Mon Sep 17 00:00:00 2001
> From: Alek Du <alek.du@intel.com>
> Date: Sun, 22 Nov 2009 10:58:21 +0800
> Subject: [PATCH] gpio: Langwell GPIO driver miscellaneous clean-ups
>
> 1. Use >= N to check invalid gpio number (unsigned type)
I already had this in gpio-fix-test-on-unsigned-in-lnw_irq_type.patch
> 2. Remove wrong and unnecessary unmask operation
> 3. Remove extra GEDR reading
>
> The 2) and 3) will fix interrupts losing when two or more pins are triggered at close time.
>
Those aren't cleanups - they're bug fixes!
How important are they?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: Langwell GPIO driver miscellaneous clean-ups
2009-11-24 20:29 ` Andrew Morton
@ 2009-11-25 1:02 ` Alek Du
0 siblings, 0 replies; 3+ messages in thread
From: Alek Du @ 2009-11-25 1:02 UTC (permalink / raw)
To: Andrew Morton; +Cc: Kernel Mailing List, David Brownell
On Wed, 25 Nov 2009 04:29:37 +0800
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Sun, 22 Nov 2009 11:19:01 +0800
> Alek Du <alek.du@intel.com> wrote:
>
> > >From 9ba8224f5246ef7fdf1c0a15bb5535e442731435 Mon Sep 17 00:00:00 2001
> > From: Alek Du <alek.du@intel.com>
> > Date: Sun, 22 Nov 2009 10:58:21 +0800
> > Subject: [PATCH] gpio: Langwell GPIO driver miscellaneous clean-ups
> >
> > 1. Use >= N to check invalid gpio number (unsigned type)
>
> I already had this in gpio-fix-test-on-unsigned-in-lnw_irq_type.patch
>
> > 2. Remove wrong and unnecessary unmask operation
> > 3. Remove extra GEDR reading
> >
> > The 2) and 3) will fix interrupts losing when two or more pins are triggered at close time.
> >
>
> Those aren't cleanups - they're bug fixes!
I agree, thx.
>
> How important are they?
It is not show stopper one, but would be great if could commit to 2.6.32 rcx.
Thanks,
Alek
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-25 1:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-22 3:19 [PATCH] gpio: Langwell GPIO driver miscellaneous clean-ups Alek Du
2009-11-24 20:29 ` Andrew Morton
2009-11-25 1:02 ` Alek Du
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®