diff options
Diffstat (limited to 'include/linux/gpio')
| -rw-r--r-- | include/linux/gpio/consumer.h | 31 | ||||
| -rw-r--r-- | include/linux/gpio/driver.h | 10 | 
2 files changed, 31 insertions, 10 deletions
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index f2f887795d43..9ddcf50a3c59 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -104,6 +104,7 @@ struct gpio_descs *__must_check  devm_gpiod_get_array_optional(struct device *dev, const char *con_id,  			      enum gpiod_flags flags);  void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); +void devm_gpiod_unhinge(struct device *dev, struct gpio_desc *desc);  void devm_gpiod_put_array(struct device *dev, struct gpio_descs *descs);  int gpiod_get_direction(struct gpio_desc *desc); @@ -162,7 +163,7 @@ int gpiod_is_active_low(const struct gpio_desc *desc);  int gpiod_cansleep(const struct gpio_desc *desc);  int gpiod_to_irq(const struct gpio_desc *desc); -void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name); +int gpiod_set_consumer_name(struct gpio_desc *desc, const char *name);  /* Convert between the old gpio_ and new gpiod_ interfaces */  struct gpio_desc *gpio_to_desc(unsigned gpio); @@ -172,6 +173,10 @@ int desc_to_gpio(const struct gpio_desc *desc);  struct device_node;  struct fwnode_handle; +struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, +					 const char *propname, int index, +					 enum gpiod_flags dflags, +					 const char *label);  struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,  					      struct device_node *node,  					      const char *propname, int index, @@ -245,6 +250,15 @@ static inline void gpiod_put(struct gpio_desc *desc)  	WARN_ON(1);  } +static inline void devm_gpiod_unhinge(struct device *dev, +				      struct gpio_desc *desc) +{ +	might_sleep(); + +	/* GPIO can never have been requested */ +	WARN_ON(1); +} +  static inline void gpiod_put_array(struct gpio_descs *descs)  {  	might_sleep(); @@ -495,15 +509,17 @@ static inline int gpiod_to_irq(const struct gpio_desc *desc)  	return -EINVAL;  } -static inline void gpiod_set_consumer_name(struct gpio_desc *desc, const char *name) +static inline int gpiod_set_consumer_name(struct gpio_desc *desc, +					  const char *name)  {  	/* GPIO can never have been requested */  	WARN_ON(1); +	return -EINVAL;  }  static inline struct gpio_desc *gpio_to_desc(unsigned gpio)  { -	return ERR_PTR(-EINVAL); +	return NULL;  }  static inline int desc_to_gpio(const struct gpio_desc *desc) @@ -518,6 +534,15 @@ struct device_node;  struct fwnode_handle;  static inline +struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, +					 const char *propname, int index, +					 enum gpiod_flags dflags, +					 const char *label) +{ +	return ERR_PTR(-ENOSYS); +} + +static inline  struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev,  					      struct device_node *node,  					      const char *propname, int index, diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 2db62b550b95..07cddbf45186 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -17,6 +17,7 @@ struct device_node;  struct seq_file;  struct gpio_device;  struct module; +enum gpiod_flags;  #ifdef CONFIG_GPIOLIB @@ -166,11 +167,6 @@ struct gpio_irq_chip {  	 */  	void		(*irq_disable)(struct irq_data *data);  }; - -static inline struct gpio_irq_chip *to_gpio_irq_chip(struct irq_chip *chip) -{ -	return container_of(chip, struct gpio_irq_chip, chip); -}  #endif  /** @@ -422,7 +418,6 @@ static inline int gpiochip_add(struct gpio_chip *chip)  extern void gpiochip_remove(struct gpio_chip *chip);  extern int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *chip,  				  void *data); -extern void devm_gpiochip_remove(struct device *dev, struct gpio_chip *chip);  extern struct gpio_chip *gpiochip_find(void *data,  			      int (*match)(struct gpio_chip *chip, void *data)); @@ -610,7 +605,8 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip)  #endif /* CONFIG_PINCTRL */  struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum, -					    const char *label); +					    const char *label, +					    enum gpiod_flags flags);  void gpiochip_free_own_desc(struct gpio_desc *desc);  #else /* CONFIG_GPIOLIB */  |