Lines Matching refs:aggr
40 static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *key, in aggr_add_gpio() argument
45 lookups = krealloc(aggr->lookups, struct_size(lookups, table, *n + 2), in aggr_add_gpio()
55 aggr->lookups = lookups; in aggr_add_gpio()
59 static int aggr_parse(struct gpio_aggregator *aggr) in aggr_parse() argument
61 char *args = skip_spaces(aggr->args); in aggr_parse()
78 error = aggr_add_gpio(aggr, name, U16_MAX, &n); in aggr_parse()
94 error = aggr_add_gpio(aggr, name, i, &n); in aggr_parse()
115 struct gpio_aggregator *aggr; in new_device_store() local
120 aggr = kzalloc(sizeof(*aggr) + count + 1, GFP_KERNEL); in new_device_store()
121 if (!aggr) in new_device_store()
124 memcpy(aggr->args, buf, count + 1); in new_device_store()
126 aggr->lookups = kzalloc(struct_size(aggr->lookups, table, 1), in new_device_store()
128 if (!aggr->lookups) { in new_device_store()
134 id = idr_alloc(&gpio_aggregator_idr, aggr, 0, 0, GFP_KERNEL); in new_device_store()
142 aggr->lookups->dev_id = kasprintf(GFP_KERNEL, "%s.%d", DRV_NAME, id); in new_device_store()
143 if (!aggr->lookups->dev_id) { in new_device_store()
148 res = aggr_parse(aggr); in new_device_store()
152 gpiod_add_lookup_table(aggr->lookups); in new_device_store()
160 aggr->pdev = pdev; in new_device_store()
164 gpiod_remove_lookup_table(aggr->lookups); in new_device_store()
166 kfree(aggr->lookups->dev_id); in new_device_store()
172 kfree(aggr->lookups); in new_device_store()
174 kfree(aggr); in new_device_store()
180 static void gpio_aggregator_free(struct gpio_aggregator *aggr) in gpio_aggregator_free() argument
182 platform_device_unregister(aggr->pdev); in gpio_aggregator_free()
183 gpiod_remove_lookup_table(aggr->lookups); in gpio_aggregator_free()
184 kfree(aggr->lookups->dev_id); in gpio_aggregator_free()
185 kfree(aggr->lookups); in gpio_aggregator_free()
186 kfree(aggr); in gpio_aggregator_free()
192 struct gpio_aggregator *aggr; in delete_device_store() local
204 aggr = idr_remove(&gpio_aggregator_idr, id); in delete_device_store()
206 if (!aggr) in delete_device_store()
209 gpio_aggregator_free(aggr); in delete_device_store()