Lines Matching refs:aggr

93 static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *key,  in aggr_add_gpio()  argument
98 lookups = krealloc(aggr->lookups, struct_size(lookups, table, *n + 2), in aggr_add_gpio()
109 aggr->lookups = lookups; in aggr_add_gpio()
113 static int aggr_parse(struct gpio_aggregator *aggr) in aggr_parse() argument
115 char *args = aggr->args; in aggr_parse()
135 error = aggr_add_gpio(aggr, name, U16_MAX, &n); in aggr_parse()
151 error = aggr_add_gpio(aggr, name, i, &n); in aggr_parse()
172 struct gpio_aggregator *aggr; in new_device_store() local
177 aggr = kzalloc(sizeof(*aggr) + count + 1, GFP_KERNEL); in new_device_store()
178 if (!aggr) in new_device_store()
181 memcpy(aggr->args, buf, count + 1); in new_device_store()
183 aggr->lookups = kzalloc(struct_size(aggr->lookups, table, 1), in new_device_store()
185 if (!aggr->lookups) { in new_device_store()
191 id = idr_alloc(&gpio_aggregator_idr, aggr, 0, 0, GFP_KERNEL); in new_device_store()
199 aggr->lookups->dev_id = kasprintf(GFP_KERNEL, "%s.%d", DRV_NAME, id); in new_device_store()
200 if (!aggr->lookups->dev_id) { in new_device_store()
205 res = aggr_parse(aggr); in new_device_store()
209 gpiod_add_lookup_table(aggr->lookups); in new_device_store()
217 aggr->pdev = pdev; in new_device_store()
221 gpiod_remove_lookup_table(aggr->lookups); in new_device_store()
223 kfree(aggr->lookups->dev_id); in new_device_store()
229 kfree(aggr->lookups); in new_device_store()
231 kfree(aggr); in new_device_store()
237 static void gpio_aggregator_free(struct gpio_aggregator *aggr) in gpio_aggregator_free() argument
239 platform_device_unregister(aggr->pdev); in gpio_aggregator_free()
240 gpiod_remove_lookup_table(aggr->lookups); in gpio_aggregator_free()
241 kfree(aggr->lookups->dev_id); in gpio_aggregator_free()
242 kfree(aggr->lookups); in gpio_aggregator_free()
243 kfree(aggr); in gpio_aggregator_free()
249 struct gpio_aggregator *aggr; in delete_device_store() local
261 aggr = idr_remove(&gpio_aggregator_idr, id); in delete_device_store()
263 if (!aggr) in delete_device_store()
266 gpio_aggregator_free(aggr); in delete_device_store()