]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: mt7621-gpio: use MTK_BANK_WIDTH instead of magic number
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Sun, 20 May 2018 13:00:26 +0000 (15:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 May 2018 16:49:32 +0000 (18:49 +0200)
There are some places where magic number '32' is being used to get
the gpio bank. There already exist a definition MTK_BANK_WIDTH
with this value, so just use it instead.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/mt7621-gpio/gpio-mt7621.c

index 15a1003017f8f406c3e5b212e52be3c384e05d47..5d923a7456848f46b2cbf6496ae0d9b0f1b125bf 100644 (file)
@@ -227,7 +227,7 @@ mediatek_gpio_irq_unmask(struct irq_data *d)
 {
        struct mtk_data *gpio_data = irq_data_get_irq_chip_data(d);
        int pin = d->hwirq;
-       int bank = pin / 32;
+       int bank = pin / MTK_BANK_WIDTH;
        struct mtk_gc *rg = gpio_data->gc_map[bank];
        unsigned long flags;
        u32 rise, fall;
@@ -249,7 +249,7 @@ mediatek_gpio_irq_mask(struct irq_data *d)
 {
        struct mtk_data *gpio_data = irq_data_get_irq_chip_data(d);
        int pin = d->hwirq;
-       int bank = pin / 32;
+       int bank = pin / MTK_BANK_WIDTH;
        struct mtk_gc *rg = gpio_data->gc_map[bank];
        unsigned long flags;
        u32 rise, fall;
@@ -271,7 +271,7 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int type)
 {
        struct mtk_data *gpio_data = irq_data_get_irq_chip_data(d);
        int pin = d->hwirq;
-       int bank = pin / 32;
+       int bank = pin / MTK_BANK_WIDTH;
        struct mtk_gc *rg = gpio_data->gc_map[bank];
        u32 mask = BIT(d->hwirq);