[PATCH v2 07/10] gpio: aggregator: clean up gpio_aggregator_free()

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

 



- Rename gpio_aggregator_free() to use the "aggr_" prefix for
  consistency with other functions that modify struct gpio_aggregator
  internals.
- Replace four lines within the function to invoke aggr_deactivate()
- Move it to a more natural location.

This is a preparatory change for the next commit.

No functional change.

Signed-off-by: Koichiro Den <koichiro.den@xxxxxxxxxxxxx>
---
 drivers/gpio/gpio-aggregator.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c
index 123906c821b1..d5fd9fe58164 100644
--- a/drivers/gpio/gpio-aggregator.c
+++ b/drivers/gpio/gpio-aggregator.c
@@ -1092,6 +1092,12 @@ static int aggr_parse(struct gpio_aggregator *aggr)
 	return 0;
 }
 
+static void aggr_free(struct gpio_aggregator *aggr)
+{
+	aggr_deactivate(aggr);
+	kfree(aggr);
+}
+
 static ssize_t new_device_store(struct device_driver *driver, const char *buf,
 				size_t count)
 {
@@ -1160,15 +1166,6 @@ static ssize_t new_device_store(struct device_driver *driver, const char *buf,
 
 static DRIVER_ATTR_WO(new_device);
 
-static void gpio_aggregator_free(struct gpio_aggregator *aggr)
-{
-	platform_device_unregister(aggr->pdev);
-	gpiod_remove_lookup_table(aggr->lookups);
-	kfree(aggr->lookups->dev_id);
-	kfree(aggr->lookups);
-	kfree(aggr);
-}
-
 static ssize_t delete_device_store(struct device_driver *driver,
 				   const char *buf, size_t count)
 {
@@ -1189,7 +1186,7 @@ static ssize_t delete_device_store(struct device_driver *driver,
 	if (!aggr)
 		return -ENOENT;
 
-	gpio_aggregator_free(aggr);
+	aggr_free(aggr);
 	return count;
 }
 static DRIVER_ATTR_WO(delete_device);
@@ -1261,7 +1258,7 @@ static struct platform_driver gpio_aggregator_driver = {
 
 static int __exit gpio_aggregator_idr_remove(int id, void *p, void *data)
 {
-	gpio_aggregator_free(p);
+	aggr_free(p);
 	return 0;
 }
 
-- 
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