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

gpio: Remove unused and obsoleted irq_to_gpio()

irq_to_gpio() is legacy and unused API, remove it for good.

This leaves gpio_to_irq() as it's used yet in many places.
Nevertheless, removal of its counterpart is a good signal
to whoever even trying to consider using them that do not.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Andy Shevchenko and committed by
Bartosz Golaszewski
a5ec171e 029d14e9

-46
-8
Documentation/driver-api/gpio/legacy.rst
··· 387 387 /* map GPIO numbers to IRQ numbers */ 388 388 int gpio_to_irq(unsigned gpio); 389 389 390 - /* map IRQ numbers to GPIO numbers (avoid using this) */ 391 - int irq_to_gpio(unsigned irq); 392 - 393 390 Those return either the corresponding number in the other namespace, or 394 391 else a negative errno code if the mapping can't be done. (For example, 395 392 some GPIOs can't be used as IRQs.) It is an unchecked error to use a GPIO ··· 401 404 devices, by the board-specific initialization code. Note that IRQ trigger 402 405 options are part of the IRQ interface, e.g. IRQF_TRIGGER_FALLING, as are 403 406 system wakeup capabilities. 404 - 405 - Non-error values returned from irq_to_gpio() would most commonly be used 406 - with gpio_get_value(), for example to initialize or update driver state 407 - when the IRQ is edge-triggered. Note that some platforms don't support 408 - this reverse mapping, so you should avoid using it. 409 407 410 408 411 409 Emulating Open Drain Signals
-7
Documentation/translations/zh_CN/driver-api/gpio/legacy.rst
··· 358 358 /* 映射 GPIO 编号到 IRQ 编号 */ 359 359 int gpio_to_irq(unsigned gpio); 360 360 361 - /* 映射 IRQ 编号到 GPIO 编号 (尽量避免使用) */ 362 - int irq_to_gpio(unsigned irq); 363 - 364 361 它们的返回值为对应命名空间的相关编号,或是负的错误代码(如果无法映射)。 365 362 (例如,某些 GPIO 无法做为 IRQ 使用。)以下的编号错误是未经检测的:使用一个 366 363 未通过 gpio_direction_input()配置为输入的 GPIO 编号,或者使用一个 ··· 369 372 它们通常通过板级特定的初始化代码存放到平台设备的 IRQ 资源中。注意:IRQ 370 373 触发选项是 IRQ 接口的一部分,如 IRQF_TRIGGER_FALLING,系统唤醒能力 371 374 也是如此。 372 - 373 - irq_to_gpio()返回的非错误值大多数通常可以被 gpio_get_value()所使用, 374 - 比如在 IRQ 是沿触发时初始化或更新驱动状态。注意某些平台不支持反映射,所以 375 - 你应该尽量避免使用它。 376 375 377 376 378 377 模拟开漏信号
-7
Documentation/translations/zh_TW/gpio.txt
··· 363 363 /* 映射 GPIO 編號到 IRQ 編號 */ 364 364 int gpio_to_irq(unsigned gpio); 365 365 366 - /* 映射 IRQ 編號到 GPIO 編號 (儘量避免使用) */ 367 - int irq_to_gpio(unsigned irq); 368 - 369 366 它們的返回值爲對應命名空間的相關編號,或是負的錯誤代碼(如果無法映射)。 370 367 (例如,某些 GPIO 無法做爲 IRQ 使用。)以下的編號錯誤是未經檢測的:使用一個 371 368 未通過 gpio_direction_input()配置爲輸入的 GPIO 編號,或者使用一個 ··· 374 377 它們通常通過板級特定的初始化代碼存放到平台設備的 IRQ 資源中。注意:IRQ 375 378 觸發選項是 IRQ 接口的一部分,如 IRQF_TRIGGER_FALLING,系統喚醒能力 376 379 也是如此。 377 - 378 - irq_to_gpio()返回的非錯誤值大多數通常可以被 gpio_get_value()所使用, 379 - 比如在 IRQ 是沿觸發時初始化或更新驅動狀態。注意某些平台不支持反映射,所以 380 - 你應該儘量避免使用它。 381 380 382 381 383 382 模擬開漏信號
-7
arch/m68k/include/asm/gpio.h
··· 66 66 return __gpio_to_irq(gpio); 67 67 } 68 68 69 - static inline int irq_to_gpio(unsigned irq) 70 - { 71 - return (irq >= MCFGPIO_IRQ_VECBASE && 72 - irq < (MCFGPIO_IRQ_VECBASE + MCFGPIO_IRQ_MAX)) ? 73 - irq - MCFGPIO_IRQ_VECBASE : -ENXIO; 74 - } 75 - 76 69 static inline int gpio_cansleep(unsigned gpio) 77 70 { 78 71 return gpio < MCFGPIO_PIN_MAX ? 0 : __gpio_cansleep(gpio);
-5
arch/sh/include/asm/gpio.h
··· 40 40 return __gpio_to_irq(gpio); 41 41 } 42 42 43 - static inline int irq_to_gpio(unsigned int irq) 44 - { 45 - return -ENOSYS; 46 - } 47 - 48 43 #endif /* CONFIG_GPIOLIB */ 49 44 50 45 #endif /* __ASM_SH_GPIO_H */
-12
include/linux/gpio.h
··· 81 81 return __gpio_to_irq(gpio); 82 82 } 83 83 84 - static inline int irq_to_gpio(unsigned int irq) 85 - { 86 - return -EINVAL; 87 - } 88 - 89 84 #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ 90 85 91 86 /* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */ ··· 201 206 static inline int gpio_to_irq(unsigned gpio) 202 207 { 203 208 /* GPIO can never have been requested or set as input */ 204 - WARN_ON(1); 205 - return -EINVAL; 206 - } 207 - 208 - static inline int irq_to_gpio(unsigned irq) 209 - { 210 - /* irq can never have been returned from gpio_to_irq() */ 211 209 WARN_ON(1); 212 210 return -EINVAL; 213 211 }