Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: loongson1: fix bgpio usage

When no flags are given, the native endianness is used to access
the MMIO registers, and the pin2mask() call can simply be
converted to a BIT() call, as per the default pin2mask()
implementation in gpio-mmio.c.

Cc: Kelvin Cheung <keguang.zhang@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+3 -4
+3 -4
drivers/gpio/gpio-loongson1.c
··· 11 11 #include <linux/module.h> 12 12 #include <linux/gpio/driver.h> 13 13 #include <linux/platform_device.h> 14 + #include <linux/bitops.h> 14 15 15 16 /* Loongson 1 GPIO Register Definitions */ 16 17 #define GPIO_CFG 0x0 ··· 23 22 24 23 static int ls1x_gpio_request(struct gpio_chip *gc, unsigned int offset) 25 24 { 26 - unsigned long pinmask = gc->pin2mask(gc, offset); 27 25 unsigned long flags; 28 26 29 27 spin_lock_irqsave(&gc->bgpio_lock, flags); 30 - __raw_writel(__raw_readl(gpio_reg_base + GPIO_CFG) | pinmask, 28 + __raw_writel(__raw_readl(gpio_reg_base + GPIO_CFG) | BIT(offset), 31 29 gpio_reg_base + GPIO_CFG); 32 30 spin_unlock_irqrestore(&gc->bgpio_lock, flags); 33 31 ··· 35 35 36 36 static void ls1x_gpio_free(struct gpio_chip *gc, unsigned int offset) 37 37 { 38 - unsigned long pinmask = gc->pin2mask(gc, offset); 39 38 unsigned long flags; 40 39 41 40 spin_lock_irqsave(&gc->bgpio_lock, flags); 42 - __raw_writel(__raw_readl(gpio_reg_base + GPIO_CFG) & ~pinmask, 41 + __raw_writel(__raw_readl(gpio_reg_base + GPIO_CFG) & ~BIT(offset), 43 42 gpio_reg_base + GPIO_CFG); 44 43 spin_unlock_irqrestore(&gc->bgpio_lock, flags); 45 44 }