@@ -1871,6 +1871,7 @@ menu "Virtual GPIO drivers"
config GPIO_AGGREGATOR
tristate "GPIO Aggregator"
+ select GPIO_PSEUDO
help
Say yes here to enable the GPIO Aggregator, which provides a way to
aggregate existing GPIO lines into a new virtual GPIO chip.
@@ -27,6 +27,8 @@
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
+#include "gpio-pseudo.h"
+
#define AGGREGATOR_MAX_GPIOS 512
/*
@@ -34,8 +36,8 @@
*/
struct gpio_aggregator {
+ struct pseudo_gpio_common common;
struct gpiod_lookup_table *lookups;
- struct platform_device *pdev;
char args[];
};
@@ -492,7 +494,7 @@ static ssize_t new_device_store(struct device_driver *driver, const char *buf,
goto remove_table;
}
- aggr->pdev = pdev;
+ aggr->common.pdev = pdev;
module_put(THIS_MODULE);
return count;
@@ -517,7 +519,7 @@ static DRIVER_ATTR_WO(new_device);
static void gpio_aggregator_free(struct gpio_aggregator *aggr)
{
- platform_device_unregister(aggr->pdev);
+ platform_device_unregister(aggr->common.pdev);
gpiod_remove_lookup_table(aggr->lookups);
kfree(aggr->lookups->dev_id);
kfree(aggr->lookups);
Update gpio-aggregator to use the new gpio-pseudo helper functions. Note that the current sysfs interface for gpio-aggregator does not wait for probe completion when creating a platform device. This change brings no immediate benefit but prepares for a later commit introducing configfs that shares this mechanism. No functional change. Signed-off-by: Koichiro Den <koichiro.den@canonical.com> --- drivers/gpio/Kconfig | 1 + drivers/gpio/gpio-aggregator.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-)