summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Paracuellos <sergio.paracuellos@gmail.com>2018-06-18 12:36:11 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-06-28 15:50:58 +0300
commit5547b411e9924c69bc3074e884227ee9bd5850d5 (patch)
treeaf7ea1d9df505af4e835daaac09c856c456891f1
parent7bf3d70e6e2c5ab724214a234a8755c03acb39a8 (diff)
downloadlinux-5547b411e9924c69bc3074e884227ee9bd5850d5.tar.xz
staging: mt7621-gpio: remove no more necessary PIN_MASK macro
PIN_MASK macro was being used because of the fact we were only using one interrupt controller for all of the gpio chips. This has been changed to use one per gpio chip and each has 32 irqs. Because of this this macro is not needed anymore. Use BIT macro instead. Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/mt7621-gpio/gpio-mt7621.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index d2a7512db0ea..a8893e811ef1 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -15,7 +15,6 @@
#define MTK_BANK_CNT 3
#define MTK_BANK_WIDTH 32
-#define PIN_MASK(nr) (1UL << ((nr % MTK_BANK_WIDTH)))
#define GPIO_BANK_WIDE 0x04
#define GPIO_REG_CTRL 0x00
@@ -133,10 +132,10 @@ mediatek_gpio_irq_unmask(struct irq_data *d)
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
high = mtk_gpio_r32(rg, GPIO_REG_HLVL);
low = mtk_gpio_r32(rg, GPIO_REG_LLVL);
- mtk_gpio_w32(rg, GPIO_REG_REDGE, rise | (PIN_MASK(pin) & rg->rising));
- mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall | (PIN_MASK(pin) & rg->falling));
- mtk_gpio_w32(rg, GPIO_REG_HLVL, high | (PIN_MASK(pin) & rg->hlevel));
- mtk_gpio_w32(rg, GPIO_REG_LLVL, low | (PIN_MASK(pin) & rg->llevel));
+ mtk_gpio_w32(rg, GPIO_REG_REDGE, rise | (BIT(pin) & rg->rising));
+ mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall | (BIT(pin) & rg->falling));
+ mtk_gpio_w32(rg, GPIO_REG_HLVL, high | (BIT(pin) & rg->hlevel));
+ mtk_gpio_w32(rg, GPIO_REG_LLVL, low | (BIT(pin) & rg->llevel));
spin_unlock_irqrestore(&rg->lock, flags);
}
@@ -157,10 +156,10 @@ mediatek_gpio_irq_mask(struct irq_data *d)
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
high = mtk_gpio_r32(rg, GPIO_REG_HLVL);
low = mtk_gpio_r32(rg, GPIO_REG_LLVL);
- mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall & ~PIN_MASK(pin));
- mtk_gpio_w32(rg, GPIO_REG_REDGE, rise & ~PIN_MASK(pin));
- mtk_gpio_w32(rg, GPIO_REG_HLVL, high & ~PIN_MASK(pin));
- mtk_gpio_w32(rg, GPIO_REG_LLVL, low & ~PIN_MASK(pin));
+ mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall & ~BIT(pin));
+ mtk_gpio_w32(rg, GPIO_REG_REDGE, rise & ~BIT(pin));
+ mtk_gpio_w32(rg, GPIO_REG_HLVL, high & ~BIT(pin));
+ mtk_gpio_w32(rg, GPIO_REG_LLVL, low & ~BIT(pin));
spin_unlock_irqrestore(&rg->lock, flags);
}
@@ -170,7 +169,7 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int type)
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct mtk_gc *rg = to_mediatek_gpio(gc);
int pin = d->hwirq;
- u32 mask = PIN_MASK(pin);
+ u32 mask = BIT(pin);
if (!rg)
return -1;