lkml.org 
[lkml]   [2014]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 7/7 v2] gpio: dwapb: use d->mask instead od BIT(bit)
From
Date
On Tue, 2014-03-25 at 22:18 +0100, Sebastian Andrzej Siewior wrote:
> d->mask contains exact the same information as BIT(bit) so we could save
> a few cycles here.

I think you actually lose a few cycles here as
the pointer has to be dereferenced for each use.

> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
[]
> @@ -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;
> }
>





\
 
 \ /
  Last update: 2014-03-25 22:41    [W:0.150 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site