Skip to content

Commit a5ec171

Browse files
andy-shevBartosz Golaszewski
authored andcommitted
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 <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 029d14e commit a5ec171

File tree

6 files changed

+0
-46
lines changed

6 files changed

+0
-46
lines changed

Documentation/driver-api/gpio/legacy.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,6 @@ map between them using calls like::
387387
/* map GPIO numbers to IRQ numbers */
388388
int gpio_to_irq(unsigned gpio);
389389

390-
/* map IRQ numbers to GPIO numbers (avoid using this) */
391-
int irq_to_gpio(unsigned irq);
392-
393390
Those return either the corresponding number in the other namespace, or
394391
else a negative errno code if the mapping can't be done. (For example,
395392
some GPIOs can't be used as IRQs.) It is an unchecked error to use a GPIO
@@ -405,11 +402,6 @@ devices, by the board-specific initialization code. Note that IRQ trigger
405402
options are part of the IRQ interface, e.g. IRQF_TRIGGER_FALLING, as are
406403
system wakeup capabilities.
407404

408-
Non-error values returned from irq_to_gpio() would most commonly be used
409-
with gpio_get_value(), for example to initialize or update driver state
410-
when the IRQ is edge-triggered. Note that some platforms don't support
411-
this reverse mapping, so you should avoid using it.
412-
413405

414406
Emulating Open Drain Signals
415407
----------------------------

Documentation/translations/zh_CN/driver-api/gpio/legacy.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,6 @@ GPIO 编号是无符号整数;IRQ 编号也是。这些构成了两个逻辑上
358358
/* 映射 GPIO 编号到 IRQ 编号 */
359359
int gpio_to_irq(unsigned gpio);
360360

361-
/* 映射 IRQ 编号到 GPIO 编号 (尽量避免使用) */
362-
int irq_to_gpio(unsigned irq);
363-
364361
它们的返回值为对应命名空间的相关编号,或是负的错误代码(如果无法映射)。
365362
(例如,某些 GPIO 无法做为 IRQ 使用。)以下的编号错误是未经检测的:使用一个
366363
未通过 gpio_direction_input()配置为输入的 GPIO 编号,或者使用一个
@@ -373,10 +370,6 @@ gpio_to_irq()返回的非错误值可以传递给 request_irq()或者 free_irq()
373370
触发选项是 IRQ 接口的一部分,如 IRQF_TRIGGER_FALLING,系统唤醒能力
374371
也是如此。
375372

376-
irq_to_gpio()返回的非错误值大多数通常可以被 gpio_get_value()所使用,
377-
比如在 IRQ 是沿触发时初始化或更新驱动状态。注意某些平台不支持反映射,所以
378-
你应该尽量避免使用它。
379-
380373

381374
模拟开漏信号
382375
------------

Documentation/translations/zh_TW/gpio.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,6 @@ GPIO 編號是無符號整數;IRQ 編號也是。這些構成了兩個邏輯上
363363
/* 映射 GPIO 編號到 IRQ 編號 */
364364
int gpio_to_irq(unsigned gpio);
365365

366-
/* 映射 IRQ 編號到 GPIO 編號 (儘量避免使用) */
367-
int irq_to_gpio(unsigned irq);
368-
369366
它們的返回值爲對應命名空間的相關編號,或是負的錯誤代碼(如果無法映射)。
370367
(例如,某些 GPIO 無法做爲 IRQ 使用。)以下的編號錯誤是未經檢測的:使用一個
371368
未通過 gpio_direction_input()配置爲輸入的 GPIO 編號,或者使用一個
@@ -378,10 +375,6 @@ gpio_to_irq()返回的非錯誤值可以傳遞給 request_irq()或者 free_irq()
378375
觸發選項是 IRQ 接口的一部分,如 IRQF_TRIGGER_FALLING,系統喚醒能力
379376
也是如此。
380377

381-
irq_to_gpio()返回的非錯誤值大多數通常可以被 gpio_get_value()所使用,
382-
比如在 IRQ 是沿觸發時初始化或更新驅動狀態。注意某些平台不支持反映射,所以
383-
你應該儘量避免使用它。
384-
385378

386379
模擬開漏信號
387380
----------------------------

arch/m68k/include/asm/gpio.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ static inline int gpio_to_irq(unsigned gpio)
6666
return __gpio_to_irq(gpio);
6767
}
6868

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-
7669
static inline int gpio_cansleep(unsigned gpio)
7770
{
7871
return gpio < MCFGPIO_PIN_MAX ? 0 : __gpio_cansleep(gpio);

arch/sh/include/asm/gpio.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ static inline int gpio_to_irq(unsigned gpio)
4040
return __gpio_to_irq(gpio);
4141
}
4242

43-
static inline int irq_to_gpio(unsigned int irq)
44-
{
45-
return -ENOSYS;
46-
}
47-
4843
#endif /* CONFIG_GPIOLIB */
4944

5045
#endif /* __ASM_SH_GPIO_H */

include/linux/gpio.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ static inline int gpio_to_irq(unsigned int gpio)
8181
return __gpio_to_irq(gpio);
8282
}
8383

84-
static inline int irq_to_gpio(unsigned int irq)
85-
{
86-
return -EINVAL;
87-
}
88-
8984
#endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */
9085

9186
/* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */
@@ -210,13 +205,6 @@ static inline int gpio_to_irq(unsigned gpio)
210205
return -EINVAL;
211206
}
212207

213-
static inline int irq_to_gpio(unsigned irq)
214-
{
215-
/* irq can never have been returned from gpio_to_irq() */
216-
WARN_ON(1);
217-
return -EINVAL;
218-
}
219-
220208
static inline int devm_gpio_request(struct device *dev, unsigned gpio,
221209
const char *label)
222210
{

0 commit comments

Comments
 (0)