]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/gpio/consumer.h
gpio: Fix build breakage
[karo-tx-linux.git] / include / linux / gpio / consumer.h
index 4d34dbbbad4dde2ce2c1cd820320537661575450..e944c46d32280881209104f4d0d5d8ad90bd2f14 100644 (file)
@@ -26,13 +26,6 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
                                               unsigned int idx);
 void gpiod_put(struct gpio_desc *desc);
 
-struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
-                                             const char *con_id);
-struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
-                                                   const char *con_id,
-                                                   unsigned int idx);
-void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
-
 int gpiod_get_direction(const struct gpio_desc *desc);
 int gpiod_direction_input(struct gpio_desc *desc);
 int gpiod_direction_output(struct gpio_desc *desc, int value);
@@ -68,33 +61,15 @@ static inline struct gpio_desc *__must_check gpiod_get(struct device *dev,
 {
        return ERR_PTR(-ENOSYS);
 }
+
 static inline struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
                                                             const char *con_id,
                                                             unsigned int idx)
 {
        return ERR_PTR(-ENOSYS);
 }
-static inline void gpiod_put(struct gpio_desc *desc)
-{
-       might_sleep();
-
-       /* GPIO can never have been requested */
-       WARN_ON(1);
-}
 
-static inline struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
-                                                           const char *con_id)
-{
-       return ERR_PTR(-ENOSYS);
-}
-static inline
-struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
-                                                   const char *con_id,
-                                                   unsigned int idx)
-{
-       return ERR_PTR(-ENOSYS);
-}
-static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
+static inline void gpiod_put(struct gpio_desc *desc)
 {
        might_sleep();
 
@@ -102,19 +77,20 @@ static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
        WARN_ON(1);
 }
 
-
 static inline int gpiod_get_direction(const struct gpio_desc *desc)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
        return -ENOSYS;
 }
+
 static inline int gpiod_direction_input(struct gpio_desc *desc)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
        return -ENOSYS;
 }
+
 static inline int gpiod_direction_output(struct gpio_desc *desc, int value)
 {
        /* GPIO can never have been requested */
@@ -122,24 +98,26 @@ static inline int gpiod_direction_output(struct gpio_desc *desc, int value)
        return -ENOSYS;
 }
 
-
 static inline int gpiod_get_value(const struct gpio_desc *desc)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
        return 0;
 }
+
 static inline void gpiod_set_value(struct gpio_desc *desc, int value)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
 }
+
 static inline int gpiod_get_raw_value(const struct gpio_desc *desc)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
        return 0;
 }
+
 static inline void gpiod_set_raw_value(struct gpio_desc *desc, int value)
 {
        /* GPIO can never have been requested */
@@ -152,17 +130,20 @@ static inline int gpiod_get_value_cansleep(const struct gpio_desc *desc)
        WARN_ON(1);
        return 0;
 }
+
 static inline void gpiod_set_value_cansleep(struct gpio_desc *desc, int value)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
 }
+
 static inline int gpiod_get_raw_value_cansleep(const struct gpio_desc *desc)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
        return 0;
 }
+
 static inline void gpiod_set_raw_value_cansleep(struct gpio_desc *desc,
                                                int value)
 {
@@ -183,6 +164,7 @@ static inline int gpiod_is_active_low(const struct gpio_desc *desc)
        WARN_ON(1);
        return 0;
 }
+
 static inline int gpiod_cansleep(const struct gpio_desc *desc)
 {
        /* GPIO can never have been requested */
@@ -201,12 +183,14 @@ static inline struct gpio_desc *gpio_to_desc(unsigned gpio)
 {
        return ERR_PTR(-EINVAL);
 }
+
 static inline int desc_to_gpio(const struct gpio_desc *desc)
 {
        /* GPIO can never have been requested */
        WARN_ON(1);
        return -EINVAL;
 }
+
 static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
 {
        /* GPIO can never have been requested */
@@ -214,7 +198,6 @@ static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
        return ERR_PTR(-ENODEV);
 }
 
-
 #endif /* CONFIG_GPIOLIB */
 
 #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS)
@@ -250,4 +233,35 @@ static inline void gpiod_unexport(struct gpio_desc *desc)
 
 #endif /* CONFIG_GPIOLIB && CONFIG_GPIO_SYSFS */
 
+#ifdef CONFIG_GPIO_DEVRES
+struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
+                                             const char *con_id);
+struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
+                                                   const char *con_id,
+                                                   unsigned int idx);
+void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
+#else
+static inline struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
+                                                           const char *con_id)
+{
+       return ERR_PTR(-ENOSYS);
+}
+
+static inline
+struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
+                                                   const char *con_id,
+                                                   unsigned int idx)
+{
+       return ERR_PTR(-ENOSYS);
+}
+
+static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
+{
+       might_sleep();
+
+       /* GPIO can never have been requested */
+       WARN_ON(1);
+}
+#endif
+
 #endif