[PATCH v3 06/13] gpio: aggregator: convert to use gpio-pseudo utilities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 drivers/gpio/Kconfig           | 1 +
 drivers/gpio/gpio-aggregator.c | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index d8fede07149f..8b9ffe17426e 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -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.
diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c
index 893cd56de867..b24ed963cd9a 100644
--- a/drivers/gpio/gpio-aggregator.c
+++ b/drivers/gpio/gpio-aggregator.c
@@ -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);
-- 
2.45.2





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux