.. | .. |
---|
142 | 142 | iio_hw_consumer_free(*(struct iio_hw_consumer **)res); |
---|
143 | 143 | } |
---|
144 | 144 | |
---|
145 | | -static int devm_iio_hw_consumer_match(struct device *dev, void *res, void *data) |
---|
146 | | -{ |
---|
147 | | - struct iio_hw_consumer **r = res; |
---|
148 | | - |
---|
149 | | - if (!r || !*r) { |
---|
150 | | - WARN_ON(!r || !*r); |
---|
151 | | - return 0; |
---|
152 | | - } |
---|
153 | | - return *r == data; |
---|
154 | | -} |
---|
155 | | - |
---|
156 | 145 | /** |
---|
157 | 146 | * devm_iio_hw_consumer_alloc - Resource-managed iio_hw_consumer_alloc() |
---|
158 | 147 | * @dev: Pointer to consumer device. |
---|
159 | 148 | * |
---|
160 | 149 | * Managed iio_hw_consumer_alloc. iio_hw_consumer allocated with this function |
---|
161 | 150 | * is automatically freed on driver detach. |
---|
162 | | - * |
---|
163 | | - * If an iio_hw_consumer allocated with this function needs to be freed |
---|
164 | | - * separately, devm_iio_hw_consumer_free() must be used. |
---|
165 | 151 | * |
---|
166 | 152 | * returns pointer to allocated iio_hw_consumer on success, NULL on failure. |
---|
167 | 153 | */ |
---|
.. | .. |
---|
185 | 171 | return iio_hwc; |
---|
186 | 172 | } |
---|
187 | 173 | EXPORT_SYMBOL_GPL(devm_iio_hw_consumer_alloc); |
---|
188 | | - |
---|
189 | | -/** |
---|
190 | | - * devm_iio_hw_consumer_free - Resource-managed iio_hw_consumer_free() |
---|
191 | | - * @dev: Pointer to consumer device. |
---|
192 | | - * @hwc: iio_hw_consumer to free. |
---|
193 | | - * |
---|
194 | | - * Free iio_hw_consumer allocated with devm_iio_hw_consumer_alloc(). |
---|
195 | | - */ |
---|
196 | | -void devm_iio_hw_consumer_free(struct device *dev, struct iio_hw_consumer *hwc) |
---|
197 | | -{ |
---|
198 | | - int rc; |
---|
199 | | - |
---|
200 | | - rc = devres_release(dev, devm_iio_hw_consumer_release, |
---|
201 | | - devm_iio_hw_consumer_match, hwc); |
---|
202 | | - WARN_ON(rc); |
---|
203 | | -} |
---|
204 | | -EXPORT_SYMBOL_GPL(devm_iio_hw_consumer_free); |
---|
205 | 174 | |
---|
206 | 175 | /** |
---|
207 | 176 | * iio_hw_consumer_enable() - Enable IIO hardware consumer |
---|