aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/devres.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/devres.c')
-rw-r--r--drivers/gpio/devres.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c
index 65978cf85f79..41b2f40578d5 100644
--- a/drivers/gpio/devres.c
+++ b/drivers/gpio/devres.c
@@ -39,47 +39,53 @@ static int devm_gpiod_match(struct device *dev, void *res, void *data)
39 * devm_gpiod_get - Resource-managed gpiod_get() 39 * devm_gpiod_get - Resource-managed gpiod_get()
40 * @dev: GPIO consumer 40 * @dev: GPIO consumer
41 * @con_id: function within the GPIO consumer 41 * @con_id: function within the GPIO consumer
42 * @flags: optional GPIO initialization flags
42 * 43 *
43 * Managed gpiod_get(). GPIO descriptors returned from this function are 44 * Managed gpiod_get(). GPIO descriptors returned from this function are
44 * automatically disposed on driver detach. See gpiod_get() for detailed 45 * automatically disposed on driver detach. See gpiod_get() for detailed
45 * information about behavior and return values. 46 * information about behavior and return values.
46 */ 47 */
47struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, 48struct gpio_desc *__must_check __devm_gpiod_get(struct device *dev,
48 const char *con_id) 49 const char *con_id,
50 enum gpiod_flags flags)
49{ 51{
50 return devm_gpiod_get_index(dev, con_id, 0); 52 return devm_gpiod_get_index(dev, con_id, 0, flags);
51} 53}
52EXPORT_SYMBOL(devm_gpiod_get); 54EXPORT_SYMBOL(__devm_gpiod_get);
53 55
54/** 56/**
55 * devm_gpiod_get_optional - Resource-managed gpiod_get_optional() 57 * devm_gpiod_get_optional - Resource-managed gpiod_get_optional()
56 * @dev: GPIO consumer 58 * @dev: GPIO consumer
57 * @con_id: function within the GPIO consumer 59 * @con_id: function within the GPIO consumer
60 * @flags: optional GPIO initialization flags
58 * 61 *
59 * Managed gpiod_get_optional(). GPIO descriptors returned from this function 62 * Managed gpiod_get_optional(). GPIO descriptors returned from this function
60 * are automatically disposed on driver detach. See gpiod_get_optional() for 63 * are automatically disposed on driver detach. See gpiod_get_optional() for
61 * detailed information about behavior and return values. 64 * detailed information about behavior and return values.
62 */ 65 */
63struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev, 66struct gpio_desc *__must_check __devm_gpiod_get_optional(struct device *dev,
64 const char *con_id) 67 const char *con_id,
68 enum gpiod_flags flags)
65{ 69{
66 return devm_gpiod_get_index_optional(dev, con_id, 0); 70 return devm_gpiod_get_index_optional(dev, con_id, 0, flags);
67} 71}
68EXPORT_SYMBOL(devm_gpiod_get_optional); 72EXPORT_SYMBOL(__devm_gpiod_get_optional);
69 73
70/** 74/**
71 * devm_gpiod_get_index - Resource-managed gpiod_get_index() 75 * devm_gpiod_get_index - Resource-managed gpiod_get_index()
72 * @dev: GPIO consumer 76 * @dev: GPIO consumer
73 * @con_id: function within the GPIO consumer 77 * @con_id: function within the GPIO consumer
74 * @idx: index of the GPIO to obtain in the consumer 78 * @idx: index of the GPIO to obtain in the consumer
79 * @flags: optional GPIO initialization flags
75 * 80 *
76 * Managed gpiod_get_index(). GPIO descriptors returned from this function are 81 * Managed gpiod_get_index(). GPIO descriptors returned from this function are
77 * automatically disposed on driver detach. See gpiod_get_index() for detailed 82 * automatically disposed on driver detach. See gpiod_get_index() for detailed
78 * information about behavior and return values. 83 * information about behavior and return values.
79 */ 84 */
80struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, 85struct gpio_desc *__must_check __devm_gpiod_get_index(struct device *dev,
81 const char *con_id, 86 const char *con_id,
82 unsigned int idx) 87 unsigned int idx,
88 enum gpiod_flags flags)
83{ 89{
84 struct gpio_desc **dr; 90 struct gpio_desc **dr;
85 struct gpio_desc *desc; 91 struct gpio_desc *desc;
@@ -89,7 +95,7 @@ struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
89 if (!dr) 95 if (!dr)
90 return ERR_PTR(-ENOMEM); 96 return ERR_PTR(-ENOMEM);
91 97
92 desc = gpiod_get_index(dev, con_id, idx); 98 desc = gpiod_get_index(dev, con_id, idx, flags);
93 if (IS_ERR(desc)) { 99 if (IS_ERR(desc)) {
94 devres_free(dr); 100 devres_free(dr);
95 return desc; 101 return desc;
@@ -100,26 +106,28 @@ struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
100 106
101 return desc; 107 return desc;
102} 108}
103EXPORT_SYMBOL(devm_gpiod_get_index); 109EXPORT_SYMBOL(__devm_gpiod_get_index);
104 110
105/** 111/**
106 * devm_gpiod_get_index_optional - Resource-managed gpiod_get_index_optional() 112 * devm_gpiod_get_index_optional - Resource-managed gpiod_get_index_optional()
107 * @dev: GPIO consumer 113 * @dev: GPIO consumer
108 * @con_id: function within the GPIO consumer 114 * @con_id: function within the GPIO consumer
109 * @index: index of the GPIO to obtain in the consumer 115 * @index: index of the GPIO to obtain in the consumer
116 * @flags: optional GPIO initialization flags
110 * 117 *
111 * Managed gpiod_get_index_optional(). GPIO descriptors returned from this 118 * Managed gpiod_get_index_optional(). GPIO descriptors returned from this
112 * function are automatically disposed on driver detach. See 119 * function are automatically disposed on driver detach. See
113 * gpiod_get_index_optional() for detailed information about behavior and 120 * gpiod_get_index_optional() for detailed information about behavior and
114 * return values. 121 * return values.
115 */ 122 */
116struct gpio_desc *__must_check devm_gpiod_get_index_optional(struct device *dev, 123struct gpio_desc *__must_check __devm_gpiod_get_index_optional(struct device *dev,
117 const char *con_id, 124 const char *con_id,
118 unsigned int index) 125 unsigned int index,
126 enum gpiod_flags flags)
119{ 127{
120 struct gpio_desc *desc; 128 struct gpio_desc *desc;
121 129
122 desc = devm_gpiod_get_index(dev, con_id, index); 130 desc = devm_gpiod_get_index(dev, con_id, index, flags);
123 if (IS_ERR(desc)) { 131 if (IS_ERR(desc)) {
124 if (PTR_ERR(desc) == -ENOENT) 132 if (PTR_ERR(desc) == -ENOENT)
125 return NULL; 133 return NULL;
@@ -127,7 +135,7 @@ struct gpio_desc *__must_check devm_gpiod_get_index_optional(struct device *dev,
127 135
128 return desc; 136 return desc;
129} 137}
130EXPORT_SYMBOL(devm_gpiod_get_index_optional); 138EXPORT_SYMBOL(__devm_gpiod_get_index_optional);
131 139
132/** 140/**
133 * devm_gpiod_put - Resource-managed gpiod_put() 141 * devm_gpiod_put - Resource-managed gpiod_put()