Lines Matching refs:aggr

41 static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *key,  in aggr_add_gpio()  argument
46 lookups = krealloc(aggr->lookups, struct_size(lookups, table, *n + 2), in aggr_add_gpio()
56 aggr->lookups = lookups; in aggr_add_gpio()
60 static int aggr_parse(struct gpio_aggregator *aggr) in aggr_parse() argument
62 char *args = skip_spaces(aggr->args); in aggr_parse()
79 error = aggr_add_gpio(aggr, name, U16_MAX, &n); in aggr_parse()
95 error = aggr_add_gpio(aggr, name, i, &n); in aggr_parse()
116 struct gpio_aggregator *aggr; in new_device_store() local
121 aggr = kzalloc(sizeof(*aggr) + count + 1, GFP_KERNEL); in new_device_store()
122 if (!aggr) in new_device_store()
125 memcpy(aggr->args, buf, count + 1); in new_device_store()
127 aggr->lookups = kzalloc(struct_size(aggr->lookups, table, 1), in new_device_store()
129 if (!aggr->lookups) { in new_device_store()
135 id = idr_alloc(&gpio_aggregator_idr, aggr, 0, 0, GFP_KERNEL); in new_device_store()
143 aggr->lookups->dev_id = kasprintf(GFP_KERNEL, "%s.%d", DRV_NAME, id); in new_device_store()
144 if (!aggr->lookups->dev_id) { in new_device_store()
149 res = aggr_parse(aggr); in new_device_store()
153 gpiod_add_lookup_table(aggr->lookups); in new_device_store()
161 aggr->pdev = pdev; in new_device_store()
165 gpiod_remove_lookup_table(aggr->lookups); in new_device_store()
167 kfree(aggr->lookups->dev_id); in new_device_store()
173 kfree(aggr->lookups); in new_device_store()
175 kfree(aggr); in new_device_store()
181 static void gpio_aggregator_free(struct gpio_aggregator *aggr) in gpio_aggregator_free() argument
183 platform_device_unregister(aggr->pdev); in gpio_aggregator_free()
184 gpiod_remove_lookup_table(aggr->lookups); in gpio_aggregator_free()
185 kfree(aggr->lookups->dev_id); in gpio_aggregator_free()
186 kfree(aggr->lookups); in gpio_aggregator_free()
187 kfree(aggr); in gpio_aggregator_free()
193 struct gpio_aggregator *aggr; in delete_device_store() local
205 aggr = idr_remove(&gpio_aggregator_idr, id); in delete_device_store()
207 if (!aggr) in delete_device_store()
210 gpio_aggregator_free(aggr); in delete_device_store()