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

Configure Feed

Select the types of activity you want to include in your feed.

gpiolib: coldfire: remove custom asm/gpio.h

Now that coldfire is the only user of a custom asm/gpio.h, it seems
better to remove this as well, and have the same interface everywhere.

For the gpio_get_value()/gpio_set_value()/gpio_to_irq(), gpio_cansleep()
functions, the custom version is only a micro-optimization to inline the
function for constant GPIO numbers. However, in the coldfire defconfigs,
I was unable to find a single instance where this micro-optimization
was even used, and according to Geert the only user appears to be the
QSPI chip that is disabled everywhere.

The custom gpio_request_one() function is even less useful, as it is
guarded by an #ifdef that is never true.

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

authored by

Arnd Bergmann and committed by
Andy Shevchenko
94d20f7d ee5a66d8

-111
-1
arch/m68k/Kconfig.cpu
··· 24 24 25 25 config COLDFIRE 26 26 bool "Coldfire CPU family support" 27 - select ARCH_HAVE_CUSTOM_GPIO_H 28 27 select CPU_HAS_NO_BITFIELDS 29 28 select CPU_HAS_NO_CAS 30 29 select CPU_HAS_NO_MULDIV64
-95
arch/m68k/include/asm/gpio.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Coldfire generic GPIO support 4 - * 5 - * (C) Copyright 2009, Steven King <sfking@fdwdc.com> 6 - */ 7 - 8 - #ifndef coldfire_gpio_h 9 - #define coldfire_gpio_h 10 - 11 - #include <linux/io.h> 12 - #include <asm/coldfire.h> 13 - #include <asm/mcfsim.h> 14 - #include <asm/mcfgpio.h> 15 - /* 16 - * The Generic GPIO functions 17 - * 18 - * If the gpio is a compile time constant and is one of the Coldfire gpios, 19 - * use the inline version, otherwise dispatch thru gpiolib. 20 - */ 21 - 22 - static inline int gpio_get_value(unsigned gpio) 23 - { 24 - if (__builtin_constant_p(gpio) && gpio < MCFGPIO_PIN_MAX) 25 - return mcfgpio_read(__mcfgpio_ppdr(gpio)) & mcfgpio_bit(gpio); 26 - else 27 - return __gpio_get_value(gpio); 28 - } 29 - 30 - static inline void gpio_set_value(unsigned gpio, int value) 31 - { 32 - if (__builtin_constant_p(gpio) && gpio < MCFGPIO_PIN_MAX) { 33 - if (gpio < MCFGPIO_SCR_START) { 34 - unsigned long flags; 35 - MCFGPIO_PORTTYPE data; 36 - 37 - local_irq_save(flags); 38 - data = mcfgpio_read(__mcfgpio_podr(gpio)); 39 - if (value) 40 - data |= mcfgpio_bit(gpio); 41 - else 42 - data &= ~mcfgpio_bit(gpio); 43 - mcfgpio_write(data, __mcfgpio_podr(gpio)); 44 - local_irq_restore(flags); 45 - } else { 46 - if (value) 47 - mcfgpio_write(mcfgpio_bit(gpio), 48 - MCFGPIO_SETR_PORT(gpio)); 49 - else 50 - mcfgpio_write(~mcfgpio_bit(gpio), 51 - MCFGPIO_CLRR_PORT(gpio)); 52 - } 53 - } else 54 - __gpio_set_value(gpio, value); 55 - } 56 - 57 - static inline int gpio_to_irq(unsigned gpio) 58 - { 59 - #if defined(MCFGPIO_IRQ_MIN) 60 - if ((gpio >= MCFGPIO_IRQ_MIN) && (gpio < MCFGPIO_IRQ_MAX)) 61 - #else 62 - if (gpio < MCFGPIO_IRQ_MAX) 63 - #endif 64 - return gpio + MCFGPIO_IRQ_VECBASE; 65 - else 66 - return __gpio_to_irq(gpio); 67 - } 68 - 69 - static inline int gpio_cansleep(unsigned gpio) 70 - { 71 - return gpio < MCFGPIO_PIN_MAX ? 0 : __gpio_cansleep(gpio); 72 - } 73 - 74 - #ifndef CONFIG_GPIOLIB 75 - static inline int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) 76 - { 77 - int err; 78 - 79 - err = gpio_request(gpio, label); 80 - if (err) 81 - return err; 82 - 83 - if (flags & GPIOF_DIR_IN) 84 - err = gpio_direction_input(gpio); 85 - else 86 - err = gpio_direction_output(gpio, 87 - (flags & GPIOF_INIT_HIGH) ? 1 : 0); 88 - 89 - if (err) 90 - gpio_free(gpio); 91 - 92 - return err; 93 - } 94 - #endif /* !CONFIG_GPIOLIB */ 95 - #endif
-8
drivers/gpio/Kconfig
··· 3 3 # GPIO infrastructure and drivers 4 4 # 5 5 6 - config ARCH_HAVE_CUSTOM_GPIO_H 7 - bool 8 - help 9 - Selecting this config option from the architecture Kconfig allows 10 - the architecture to provide a custom asm/gpio.h implementation 11 - overriding the default implementations. New uses of this are 12 - strongly discouraged. 13 - 14 6 menuconfig GPIOLIB 15 7 bool "GPIO Support" 16 8 help
-7
include/linux/gpio.h
··· 54 54 }; 55 55 56 56 #ifdef CONFIG_GPIOLIB 57 - 58 - #ifdef CONFIG_ARCH_HAVE_CUSTOM_GPIO_H 59 - #include <asm/gpio.h> 60 - #else 61 - 62 57 #include <asm-generic/gpio.h> 63 58 64 59 static inline int gpio_get_value(unsigned int gpio) ··· 75 80 { 76 81 return __gpio_to_irq(gpio); 77 82 } 78 - 79 - #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ 80 83 81 84 /* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */ 82 85