aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpio/gpiolib-acpi.c5
-rw-r--r--drivers/gpio/gpiolib.c1
-rw-r--r--drivers/gpio/gpiolib.h23
-rw-r--r--include/linux/acpi_gpio.h45
4 files changed, 26 insertions, 48 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 739b72b6731a..716ee9843110 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -12,11 +12,13 @@
12 12
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/gpio/consumer.h> 14#include <linux/gpio/consumer.h>
15#include <linux/gpio/driver.h>
15#include <linux/export.h> 16#include <linux/export.h>
16#include <linux/acpi_gpio.h>
17#include <linux/acpi.h> 17#include <linux/acpi.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19 19
20#include "gpiolib.h"
21
20struct acpi_gpio_evt_pin { 22struct acpi_gpio_evt_pin {
21 struct list_head node; 23 struct list_head node;
22 acpi_handle *evt_handle; 24 acpi_handle *evt_handle;
@@ -307,7 +309,6 @@ struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
307 309
308 return lookup.desc ? lookup.desc : ERR_PTR(-ENOENT); 310 return lookup.desc ? lookup.desc : ERR_PTR(-ENOENT);
309} 311}
310EXPORT_SYMBOL_GPL(acpi_get_gpiod_by_index);
311 312
312void acpi_gpiochip_add(struct gpio_chip *chip) 313void acpi_gpiochip_add(struct gpio_chip *chip)
313{ 314{
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 0de4069e33ab..ea0eba572333 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -10,7 +10,6 @@
10#include <linux/seq_file.h> 10#include <linux/seq_file.h>
11#include <linux/gpio.h> 11#include <linux/gpio.h>
12#include <linux/of_gpio.h> 12#include <linux/of_gpio.h>
13#include <linux/acpi_gpio.h>
14#include <linux/idr.h> 13#include <linux/idr.h>
15#include <linux/slab.h> 14#include <linux/slab.h>
16#include <linux/acpi.h> 15#include <linux/acpi.h>
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 2ed23ab8298c..82be586c1f90 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -12,12 +12,35 @@
12#ifndef GPIOLIB_H 12#ifndef GPIOLIB_H
13#define GPIOLIB_H 13#define GPIOLIB_H
14 14
15#include <linux/err.h>
16#include <linux/device.h>
17
18/**
19 * struct acpi_gpio_info - ACPI GPIO specific information
20 * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
21 * @active_low: in case of @gpioint, the pin is active low
22 */
23struct acpi_gpio_info {
24 bool gpioint;
25 bool active_low;
26};
27
15#ifdef CONFIG_ACPI 28#ifdef CONFIG_ACPI
16void acpi_gpiochip_add(struct gpio_chip *chip); 29void acpi_gpiochip_add(struct gpio_chip *chip);
17void acpi_gpiochip_remove(struct gpio_chip *chip); 30void acpi_gpiochip_remove(struct gpio_chip *chip);
31
32struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
33 struct acpi_gpio_info *info);
18#else 34#else
19static inline void acpi_gpiochip_add(struct gpio_chip *chip) { } 35static inline void acpi_gpiochip_add(struct gpio_chip *chip) { }
20static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { } 36static inline void acpi_gpiochip_remove(struct gpio_chip *chip) { }
37
38static inline struct gpio_desc *
39acpi_get_gpiod_by_index(struct device *dev, int index,
40 struct acpi_gpio_info *info)
41{
42 return ERR_PTR(-ENOSYS);
43}
21#endif 44#endif
22 45
23#endif /* GPIOLIB_H */ 46#endif /* GPIOLIB_H */
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h
deleted file mode 100644
index af96a0d452f6..000000000000
--- a/include/linux/acpi_gpio.h
+++ /dev/null
@@ -1,45 +0,0 @@
1#ifndef _LINUX_ACPI_GPIO_H_
2#define _LINUX_ACPI_GPIO_H_
3
4#include <linux/device.h>
5#include <linux/err.h>
6#include <linux/errno.h>
7#include <linux/gpio.h>
8#include <linux/gpio/consumer.h>
9
10/**
11 * struct acpi_gpio_info - ACPI GPIO specific information
12 * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
13 * @active_low: in case of @gpioint, the pin is active low
14 */
15struct acpi_gpio_info {
16 bool gpioint;
17 bool active_low;
18};
19
20#ifdef CONFIG_GPIO_ACPI
21
22struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
23 struct acpi_gpio_info *info);
24#else /* CONFIG_GPIO_ACPI */
25
26static inline struct gpio_desc *
27acpi_get_gpiod_by_index(struct device *dev, int index,
28 struct acpi_gpio_info *info)
29{
30 return ERR_PTR(-ENOSYS);
31}
32
33#endif /* CONFIG_GPIO_ACPI */
34
35static inline int acpi_get_gpio_by_index(struct device *dev, int index,
36 struct acpi_gpio_info *info)
37{
38 struct gpio_desc *desc = acpi_get_gpiod_by_index(dev, index, info);
39
40 if (IS_ERR(desc))
41 return PTR_ERR(desc);
42 return desc_to_gpio(desc);
43}
44
45#endif /* _LINUX_ACPI_GPIO_H_ */