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

gpio: sta2x11: Inline regs macro

I don't like the __namespace and this is simple enough to just
inline at all sites.

Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+7 -12
+7 -12
drivers/gpio/gpio-sta2x11.c
··· 59 59 unsigned irq_type[GSTA_NR_GPIO]; 60 60 }; 61 61 62 - static inline struct gsta_regs __iomem *__regs(struct gsta_gpio *chip, int nr) 63 - { 64 - return chip->regs[nr / GSTA_GPIO_PER_BLOCK]; 65 - } 66 - 67 62 /* 68 63 * gpio methods 69 64 */ ··· 66 71 static void gsta_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) 67 72 { 68 73 struct gsta_gpio *chip = gpiochip_get_data(gpio); 69 - struct gsta_regs __iomem *regs = __regs(chip, nr); 74 + struct gsta_regs __iomem *regs = chip->regs[nr / GSTA_GPIO_PER_BLOCK]; 70 75 u32 bit = BIT(nr % GSTA_GPIO_PER_BLOCK); 71 76 72 77 if (val) ··· 78 83 static int gsta_gpio_get(struct gpio_chip *gpio, unsigned nr) 79 84 { 80 85 struct gsta_gpio *chip = gpiochip_get_data(gpio); 81 - struct gsta_regs __iomem *regs = __regs(chip, nr); 86 + struct gsta_regs __iomem *regs = chip->regs[nr / GSTA_GPIO_PER_BLOCK]; 82 87 u32 bit = BIT(nr % GSTA_GPIO_PER_BLOCK); 83 88 84 89 return !!(readl(&regs->dat) & bit); ··· 88 93 int val) 89 94 { 90 95 struct gsta_gpio *chip = gpiochip_get_data(gpio); 91 - struct gsta_regs __iomem *regs = __regs(chip, nr); 96 + struct gsta_regs __iomem *regs = chip->regs[nr / GSTA_GPIO_PER_BLOCK]; 92 97 u32 bit = BIT(nr % GSTA_GPIO_PER_BLOCK); 93 98 94 99 writel(bit, &regs->dirs); ··· 103 108 static int gsta_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) 104 109 { 105 110 struct gsta_gpio *chip = gpiochip_get_data(gpio); 106 - struct gsta_regs __iomem *regs = __regs(chip, nr); 111 + struct gsta_regs __iomem *regs = chip->regs[nr / GSTA_GPIO_PER_BLOCK]; 107 112 u32 bit = BIT(nr % GSTA_GPIO_PER_BLOCK); 108 113 109 114 writel(bit, &regs->dirc); ··· 156 161 */ 157 162 static void gsta_set_config(struct gsta_gpio *chip, int nr, unsigned cfg) 158 163 { 159 - struct gsta_regs __iomem *regs = __regs(chip, nr); 164 + struct gsta_regs __iomem *regs = chip->regs[nr / GSTA_GPIO_PER_BLOCK]; 160 165 unsigned long flags; 161 166 u32 bit = BIT(nr % GSTA_GPIO_PER_BLOCK); 162 167 u32 val; ··· 225 230 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data); 226 231 struct gsta_gpio *chip = gc->private; 227 232 int nr = data->irq - chip->irq_base; 228 - struct gsta_regs __iomem *regs = __regs(chip, nr); 233 + struct gsta_regs __iomem *regs = chip->regs[nr / GSTA_GPIO_PER_BLOCK]; 229 234 u32 bit = BIT(nr % GSTA_GPIO_PER_BLOCK); 230 235 u32 val; 231 236 unsigned long flags; ··· 248 253 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data); 249 254 struct gsta_gpio *chip = gc->private; 250 255 int nr = data->irq - chip->irq_base; 251 - struct gsta_regs __iomem *regs = __regs(chip, nr); 256 + struct gsta_regs __iomem *regs = chip->regs[nr / GSTA_GPIO_PER_BLOCK]; 252 257 u32 bit = BIT(nr % GSTA_GPIO_PER_BLOCK); 253 258 u32 val; 254 259 int type;