Re: [PATCH 7/7] gpio: dwapb: use d->mask instead od BIT(bit)

2014-03-25 Thread Sebastian Andrzej Siewior
On 03/25/2014 03:17 AM, Alexandre Courbot wrote:
>> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
>> index 3c9cdda..ebfcf5c 100644
>> --- a/drivers/gpio/gpio-dwapb.c
>> +++ b/drivers/gpio/gpio-dwapb.c
>> @@ -126,7 +126,7 @@ static void dwapb_irq_disable(struct irq_data *d)
>>
>> irq_gc_lock(igc);
>> val = readl(gpio->regs + GPIO_INTEN);
>> -   val &= ~BIT(d->hwirq);
>> +   val &= d->mask;
> 
> Shouldn't that be ~d->mask here?

Yes, indeed. Thanks for catching this.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 7/7] gpio: dwapb: use d->mask instead od BIT(bit)

2014-03-24 Thread Alexandre Courbot
On Sun, Mar 23, 2014 at 1:16 AM, Sebastian Andrzej Siewior
 wrote:
> d->mask contains exact the same information as BIT(bit) so we could save
> a few cycles here.
>
> Signed-off-by: Sebastian Andrzej Siewior 
> ---
>  drivers/gpio/gpio-dwapb.c | 25 -
>  1 file changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index 3c9cdda..ebfcf5c 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -113,7 +113,7 @@ static void dwapb_irq_enable(struct irq_data *d)
>
> irq_gc_lock(igc);
> val = readl(gpio->regs + GPIO_INTEN);
> -   val |= BIT(d->hwirq);
> +   val |= d->mask;
> writel(val, gpio->regs + GPIO_INTEN);
> irq_gc_unlock(igc);
>  }
> @@ -126,7 +126,7 @@ static void dwapb_irq_disable(struct irq_data *d)
>
> irq_gc_lock(igc);
> val = readl(gpio->regs + GPIO_INTEN);
> -   val &= ~BIT(d->hwirq);
> +   val &= d->mask;

Shouldn't that be ~d->mask here?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 7/7] gpio: dwapb: use d->mask instead od BIT(bit)

2014-03-22 Thread Sebastian Andrzej Siewior
d->mask contains exact the same information as BIT(bit) so we could save
a few cycles here.

Signed-off-by: Sebastian Andrzej Siewior 
---
 drivers/gpio/gpio-dwapb.c | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 3c9cdda..ebfcf5c 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -113,7 +113,7 @@ static void dwapb_irq_enable(struct irq_data *d)
 
irq_gc_lock(igc);
val = readl(gpio->regs + GPIO_INTEN);
-   val |= BIT(d->hwirq);
+   val |= d->mask;
writel(val, gpio->regs + GPIO_INTEN);
irq_gc_unlock(igc);
 }
@@ -126,7 +126,7 @@ static void dwapb_irq_disable(struct irq_data *d)
 
irq_gc_lock(igc);
val = readl(gpio->regs + GPIO_INTEN);
-   val &= ~BIT(d->hwirq);
+   val &= d->mask;
writel(val, gpio->regs + GPIO_INTEN);
irq_gc_unlock(igc);
 }
@@ -158,7 +158,6 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)
 {
struct irq_chip_generic *igc = irq_data_get_irq_chip_data(d);
struct dwapb_gpio *gpio = igc->private;
-   int bit = d->hwirq;
unsigned long level, polarity;
 
if (type & ~(IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
@@ -171,24 +170,24 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 
type)
 
switch (type) {
case IRQ_TYPE_EDGE_BOTH:
-   level |= BIT(bit);
-   dwapb_toggle_trigger(gpio, bit);
+   level |= d->mask;
+   dwapb_toggle_trigger(gpio, d->hwirq);
break;
case IRQ_TYPE_EDGE_RISING:
-   level |= BIT(bit);
-   polarity |= BIT(bit);
+   level |= d->mask;
+   polarity |= d->mask;
break;
case IRQ_TYPE_EDGE_FALLING:
-   level |= BIT(bit);
-   polarity &= ~BIT(bit);
+   level |= d->mask;
+   polarity &= ~d->mask;
break;
case IRQ_TYPE_LEVEL_HIGH:
-   level &= ~BIT(bit);
-   polarity |= BIT(bit);
+   level &= ~d->mask;
+   polarity |= d->mask;
break;
case IRQ_TYPE_LEVEL_LOW:
-   level &= ~BIT(bit);
-   polarity &= ~BIT(bit);
+   level &= ~d->mask;
+   polarity &= ~d->mask;
break;
}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/