diff options
| author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2015-02-11 05:52:37 -0500 |
|---|---|---|
| committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2015-07-06 04:39:24 -0400 |
| commit | b17d1bf16cc72a374a48d748940f700009d40ff4 (patch) | |
| tree | ac192a6fd865e2d30d9c9031c745975ca7e52674 /include/linux/gpio | |
| parent | eac477801924cac38a273338487cce9f460434bb (diff) | |
gpio: make flags mandatory for gpiod_get functions
Now that all[1] users of the gpiod_get functions are converted to make
use of the up to now optional flags parameter, make it mandatory which
allows to remove some cpp magic.
[1] all but etraxfs-uart which is broken anyhow and I'm allowed to
ignore it by Jesper Nilsson :-)
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'include/linux/gpio')
| -rw-r--r-- | include/linux/gpio/consumer.h | 82 |
1 files changed, 23 insertions, 59 deletions
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index adac255aee86..14cac67c2012 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h | |||
| @@ -47,17 +47,17 @@ enum gpiod_flags { | |||
| 47 | int gpiod_count(struct device *dev, const char *con_id); | 47 | int gpiod_count(struct device *dev, const char *con_id); |
| 48 | 48 | ||
| 49 | /* Acquire and dispose GPIOs */ | 49 | /* Acquire and dispose GPIOs */ |
| 50 | struct gpio_desc *__must_check __gpiod_get(struct device *dev, | 50 | struct gpio_desc *__must_check gpiod_get(struct device *dev, |
| 51 | const char *con_id, | 51 | const char *con_id, |
| 52 | enum gpiod_flags flags); | 52 | enum gpiod_flags flags); |
| 53 | struct gpio_desc *__must_check __gpiod_get_index(struct device *dev, | 53 | struct gpio_desc *__must_check gpiod_get_index(struct device *dev, |
| 54 | const char *con_id, | 54 | const char *con_id, |
| 55 | unsigned int idx, | 55 | unsigned int idx, |
| 56 | enum gpiod_flags flags); | 56 | enum gpiod_flags flags); |
| 57 | struct gpio_desc *__must_check __gpiod_get_optional(struct device *dev, | 57 | struct gpio_desc *__must_check gpiod_get_optional(struct device *dev, |
| 58 | const char *con_id, | 58 | const char *con_id, |
| 59 | enum gpiod_flags flags); | 59 | enum gpiod_flags flags); |
| 60 | struct gpio_desc *__must_check __gpiod_get_index_optional(struct device *dev, | 60 | struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev, |
| 61 | const char *con_id, | 61 | const char *con_id, |
| 62 | unsigned int index, | 62 | unsigned int index, |
| 63 | enum gpiod_flags flags); | 63 | enum gpiod_flags flags); |
| @@ -70,18 +70,18 @@ struct gpio_descs *__must_check gpiod_get_array_optional(struct device *dev, | |||
| 70 | void gpiod_put(struct gpio_desc *desc); | 70 | void gpiod_put(struct gpio_desc *desc); |
| 71 | void gpiod_put_array(struct gpio_descs *descs); | 71 | void gpiod_put_array(struct gpio_descs *descs); |
| 72 | 72 | ||
| 73 | struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev, | 73 | struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, |
| 74 | const char *con_id, | 74 | const char *con_id, |
| 75 | enum gpiod_flags flags); | 75 | enum gpiod_flags flags); |
| 76 | struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev, | 76 | struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, |
| 77 | const char *con_id, | 77 | const char *con_id, |
| 78 | unsigned int idx, | 78 | unsigned int idx, |
| 79 | enum gpiod_flags flags); | 79 | enum gpiod_flags flags); |
| 80 | struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev, | 80 | struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev, |
| 81 | const char *con_id, | 81 | const char *con_id, |
| 82 | enum gpiod_flags flags); | 82 | enum gpiod_flags flags); |
| 83 | struct gpio_desc *__must_check | 83 | struct gpio_desc *__must_check |
| 84 | __devm_gpiod_get_index_optional(struct device *dev, const char *con_id, | 84 | devm_gpiod_get_index_optional(struct device *dev, const char *con_id, |
| 85 | unsigned int index, enum gpiod_flags flags); | 85 | unsigned int index, enum gpiod_flags flags); |
| 86 | struct gpio_descs *__must_check devm_gpiod_get_array(struct device *dev, | 86 | struct gpio_descs *__must_check devm_gpiod_get_array(struct device *dev, |
| 87 | const char *con_id, | 87 | const char *con_id, |
| @@ -146,31 +146,31 @@ static inline int gpiod_count(struct device *dev, const char *con_id) | |||
| 146 | return 0; | 146 | return 0; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | static inline struct gpio_desc *__must_check __gpiod_get(struct device *dev, | 149 | static inline struct gpio_desc *__must_check gpiod_get(struct device *dev, |
| 150 | const char *con_id, | 150 | const char *con_id, |
| 151 | enum gpiod_flags flags) | 151 | enum gpiod_flags flags) |
| 152 | { | 152 | { |
| 153 | return ERR_PTR(-ENOSYS); | 153 | return ERR_PTR(-ENOSYS); |
| 154 | } | 154 | } |
| 155 | static inline struct gpio_desc *__must_check | 155 | static inline struct gpio_desc *__must_check |
| 156 | __gpiod_get_index(struct device *dev, | 156 | gpiod_get_index(struct device *dev, |
| 157 | const char *con_id, | 157 | const char *con_id, |
| 158 | unsigned int idx, | 158 | unsigned int idx, |
| 159 | enum gpiod_flags flags) | 159 | enum gpiod_flags flags) |
| 160 | { | 160 | { |
| 161 | return ERR_PTR(-ENOSYS); | 161 | return ERR_PTR(-ENOSYS); |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | static inline struct gpio_desc *__must_check | 164 | static inline struct gpio_desc *__must_check |
| 165 | __gpiod_get_optional(struct device *dev, const char *con_id, | 165 | gpiod_get_optional(struct device *dev, const char *con_id, |
| 166 | enum gpiod_flags flags) | 166 | enum gpiod_flags flags) |
| 167 | { | 167 | { |
| 168 | return ERR_PTR(-ENOSYS); | 168 | return ERR_PTR(-ENOSYS); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static inline struct gpio_desc *__must_check | 171 | static inline struct gpio_desc *__must_check |
| 172 | __gpiod_get_index_optional(struct device *dev, const char *con_id, | 172 | gpiod_get_index_optional(struct device *dev, const char *con_id, |
| 173 | unsigned int index, enum gpiod_flags flags) | 173 | unsigned int index, enum gpiod_flags flags) |
| 174 | { | 174 | { |
| 175 | return ERR_PTR(-ENOSYS); | 175 | return ERR_PTR(-ENOSYS); |
| 176 | } | 176 | } |
| @@ -206,7 +206,7 @@ static inline void gpiod_put_array(struct gpio_descs *descs) | |||
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | static inline struct gpio_desc *__must_check | 208 | static inline struct gpio_desc *__must_check |
| 209 | __devm_gpiod_get(struct device *dev, | 209 | devm_gpiod_get(struct device *dev, |
| 210 | const char *con_id, | 210 | const char *con_id, |
| 211 | enum gpiod_flags flags) | 211 | enum gpiod_flags flags) |
| 212 | { | 212 | { |
| @@ -214,7 +214,7 @@ __devm_gpiod_get(struct device *dev, | |||
| 214 | } | 214 | } |
| 215 | static inline | 215 | static inline |
| 216 | struct gpio_desc *__must_check | 216 | struct gpio_desc *__must_check |
| 217 | __devm_gpiod_get_index(struct device *dev, | 217 | devm_gpiod_get_index(struct device *dev, |
| 218 | const char *con_id, | 218 | const char *con_id, |
| 219 | unsigned int idx, | 219 | unsigned int idx, |
| 220 | enum gpiod_flags flags) | 220 | enum gpiod_flags flags) |
| @@ -223,14 +223,14 @@ __devm_gpiod_get_index(struct device *dev, | |||
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | static inline struct gpio_desc *__must_check | 225 | static inline struct gpio_desc *__must_check |
| 226 | __devm_gpiod_get_optional(struct device *dev, const char *con_id, | 226 | devm_gpiod_get_optional(struct device *dev, const char *con_id, |
| 227 | enum gpiod_flags flags) | 227 | enum gpiod_flags flags) |
| 228 | { | 228 | { |
| 229 | return ERR_PTR(-ENOSYS); | 229 | return ERR_PTR(-ENOSYS); |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | static inline struct gpio_desc *__must_check | 232 | static inline struct gpio_desc *__must_check |
| 233 | __devm_gpiod_get_index_optional(struct device *dev, const char *con_id, | 233 | devm_gpiod_get_index_optional(struct device *dev, const char *con_id, |
| 234 | unsigned int index, enum gpiod_flags flags) | 234 | unsigned int index, enum gpiod_flags flags) |
| 235 | { | 235 | { |
| 236 | return ERR_PTR(-ENOSYS); | 236 | return ERR_PTR(-ENOSYS); |
| @@ -424,42 +424,6 @@ static inline struct gpio_desc *devm_get_gpiod_from_child( | |||
| 424 | 424 | ||
| 425 | #endif /* CONFIG_GPIOLIB */ | 425 | #endif /* CONFIG_GPIOLIB */ |
| 426 | 426 | ||
| 427 | /* | ||
| 428 | * Vararg-hacks! This is done to transition the kernel to always pass | ||
| 429 | * the options flags argument to the below functions. During a transition | ||
| 430 | * phase these vararg macros make both old-and-newstyle code compile, | ||
| 431 | * but when all calls to the elder API are removed, these should go away | ||
| 432 | * and the __gpiod_get() etc functions above be renamed just gpiod_get() | ||
| 433 | * etc. | ||
| 434 | */ | ||
| 435 | #define __gpiod_get(dev, con_id, flags, ...) __gpiod_get(dev, con_id, flags) | ||
| 436 | #define gpiod_get(varargs...) __gpiod_get(varargs, GPIOD_ASIS) | ||
| 437 | #define __gpiod_get_index(dev, con_id, index, flags, ...) \ | ||
| 438 | __gpiod_get_index(dev, con_id, index, flags) | ||
| 439 | #define gpiod_get_index(varargs...) __gpiod_get_index(varargs, GPIOD_ASIS) | ||
| 440 | #define __gpiod_get_optional(dev, con_id, flags, ...) \ | ||
| 441 | __gpiod_get_optional(dev, con_id, flags) | ||
| 442 | #define gpiod_get_optional(varargs...) __gpiod_get_optional(varargs, GPIOD_ASIS) | ||
| 443 | #define __gpiod_get_index_optional(dev, con_id, index, flags, ...) \ | ||
| 444 | __gpiod_get_index_optional(dev, con_id, index, flags) | ||
| 445 | #define gpiod_get_index_optional(varargs...) \ | ||
| 446 | __gpiod_get_index_optional(varargs, GPIOD_ASIS) | ||
| 447 | #define __devm_gpiod_get(dev, con_id, flags, ...) \ | ||
| 448 | __devm_gpiod_get(dev, con_id, flags) | ||
| 449 | #define devm_gpiod_get(varargs...) __devm_gpiod_get(varargs, GPIOD_ASIS) | ||
| 450 | #define __devm_gpiod_get_index(dev, con_id, index, flags, ...) \ | ||
| 451 | __devm_gpiod_get_index(dev, con_id, index, flags) | ||
| 452 | #define devm_gpiod_get_index(varargs...) \ | ||
| 453 | __devm_gpiod_get_index(varargs, GPIOD_ASIS) | ||
| 454 | #define __devm_gpiod_get_optional(dev, con_id, flags, ...) \ | ||
| 455 | __devm_gpiod_get_optional(dev, con_id, flags) | ||
| 456 | #define devm_gpiod_get_optional(varargs...) \ | ||
| 457 | __devm_gpiod_get_optional(varargs, GPIOD_ASIS) | ||
| 458 | #define __devm_gpiod_get_index_optional(dev, con_id, index, flags, ...) \ | ||
| 459 | __devm_gpiod_get_index_optional(dev, con_id, index, flags) | ||
| 460 | #define devm_gpiod_get_index_optional(varargs...) \ | ||
| 461 | __devm_gpiod_get_index_optional(varargs, GPIOD_ASIS) | ||
| 462 | |||
| 463 | #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) | 427 | #if IS_ENABLED(CONFIG_GPIOLIB) && IS_ENABLED(CONFIG_GPIO_SYSFS) |
| 464 | 428 | ||
| 465 | int gpiod_export(struct gpio_desc *desc, bool direction_may_change); | 429 | int gpiod_export(struct gpio_desc *desc, bool direction_may_change); |
