Lines Matching defs:aggr
45 static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *key,
50 lookups = krealloc(aggr->lookups, struct_size(lookups, table, *n + 2),
60 aggr->lookups = lookups;
64 static int aggr_parse(struct gpio_aggregator *aggr)
66 char *args = skip_spaces(aggr->args);
83 error = aggr_add_gpio(aggr, name, U16_MAX, &n);
99 error = aggr_add_gpio(aggr, name, i, &n);
120 struct gpio_aggregator *aggr;
125 aggr = kzalloc(sizeof(*aggr) + count + 1, GFP_KERNEL);
126 if (!aggr)
129 memcpy(aggr->args, buf, count + 1);
131 aggr->lookups = kzalloc(struct_size(aggr->lookups, table, 1),
133 if (!aggr->lookups) {
139 id = idr_alloc(&gpio_aggregator_idr, aggr, 0, 0, GFP_KERNEL);
147 aggr->lookups->dev_id = kasprintf(GFP_KERNEL, "%s.%d", DRV_NAME, id);
148 if (!aggr->lookups->dev_id) {
153 res = aggr_parse(aggr);
157 gpiod_add_lookup_table(aggr->lookups);
165 aggr->pdev = pdev;
169 gpiod_remove_lookup_table(aggr->lookups);
171 kfree(aggr->lookups->dev_id);
177 kfree(aggr->lookups);
179 kfree(aggr);
185 static void gpio_aggregator_free(struct gpio_aggregator *aggr)
187 platform_device_unregister(aggr->pdev);
188 gpiod_remove_lookup_table(aggr->lookups);
189 kfree(aggr->lookups->dev_id);
190 kfree(aggr->lookups);
191 kfree(aggr);
197 struct gpio_aggregator *aggr;
209 aggr = idr_remove(&gpio_aggregator_idr, id);
211 if (!aggr)
214 gpio_aggregator_free(aggr);