[SRU][O][PATCH v2 05/19] gpio: aggregator: unify function naming

Koichiro Den koichiro.den at canonical.com
Tue Apr 15 06:13:31 UTC 2025


BugLink: https://bugs.launchpad.net/bugs/2103496

Unify function names to use gpio_aggregator_ prefix (except GPIO
forwarder implementations, which remain unchanged in subsequent
commits). While at it, rename the pre-existing gpio_aggregator_free() to
gpio_aggregator_destory(), since that name will be used by new
alloc/free functions introduced in the next commit, for which the name
is more appropriate.

No functional change.

Signed-off-by: Koichiro Den <koichiro.den at canonical.com>
Link: https://lore.kernel.org/r/20250407043019.4105613-3-koichiro.den@canonical.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski at linaro.org>
(cherry picked from commit 7616dd97ae22e5f69b24774455673d183d4191c9 linux-next)
Signed-off-by: Koichiro Den <koichiro.den at canonical.com>
---
 drivers/gpio/gpio-aggregator.c | 37 ++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c
index 893cd56de867..92cb18830d42 100644
--- a/drivers/gpio/gpio-aggregator.c
+++ b/drivers/gpio/gpio-aggregator.c
@@ -42,8 +42,8 @@ struct gpio_aggregator {
 static DEFINE_MUTEX(gpio_aggregator_lock);	/* protects idr */
 static DEFINE_IDR(gpio_aggregator_idr);
 
-static int aggr_add_gpio(struct gpio_aggregator *aggr, const char *key,
-			 int hwnum, unsigned int *n)
+static int gpio_aggregator_add_gpio(struct gpio_aggregator *aggr,
+				    const char *key, int hwnum, unsigned int *n)
 {
 	struct gpiod_lookup_table *lookups;
 
@@ -388,7 +388,7 @@ static struct gpiochip_fwd *gpiochip_fwd_create(struct device *dev,
 /*
  * Sysfs interface
  */
-static int aggr_parse(struct gpio_aggregator *aggr)
+static int gpio_aggregator_parse(struct gpio_aggregator *aggr)
 {
 	char *args = skip_spaces(aggr->args);
 	char *name, *offsets, *p;
@@ -407,7 +407,7 @@ static int aggr_parse(struct gpio_aggregator *aggr)
 		p = get_options(offsets, 0, &error);
 		if (error == 0 || *p) {
 			/* Named GPIO line */
-			error = aggr_add_gpio(aggr, name, U16_MAX, &n);
+			error = gpio_aggregator_add_gpio(aggr, name, U16_MAX, &n);
 			if (error)
 				return error;
 
@@ -423,7 +423,7 @@ static int aggr_parse(struct gpio_aggregator *aggr)
 		}
 
 		for_each_set_bit(i, bitmap, AGGREGATOR_MAX_GPIOS) {
-			error = aggr_add_gpio(aggr, name, i, &n);
+			error = gpio_aggregator_add_gpio(aggr, name, i, &n);
 			if (error)
 				return error;
 		}
@@ -439,8 +439,8 @@ static int aggr_parse(struct gpio_aggregator *aggr)
 	return 0;
 }
 
-static ssize_t new_device_store(struct device_driver *driver, const char *buf,
-				size_t count)
+static ssize_t gpio_aggregator_new_device_store(struct device_driver *driver,
+						const char *buf, size_t count)
 {
 	struct gpio_aggregator *aggr;
 	struct platform_device *pdev;
@@ -480,7 +480,7 @@ static ssize_t new_device_store(struct device_driver *driver, const char *buf,
 		goto remove_idr;
 	}
 
-	res = aggr_parse(aggr);
+	res = gpio_aggregator_parse(aggr);
 	if (res)
 		goto free_dev_id;
 
@@ -513,9 +513,10 @@ static ssize_t new_device_store(struct device_driver *driver, const char *buf,
 	return res;
 }
 
-static DRIVER_ATTR_WO(new_device);
+static struct driver_attribute driver_attr_gpio_aggregator_new_device =
+	__ATTR(new_device, 0200, NULL, gpio_aggregator_new_device_store);
 
-static void gpio_aggregator_free(struct gpio_aggregator *aggr)
+static void gpio_aggregator_destroy(struct gpio_aggregator *aggr)
 {
 	platform_device_unregister(aggr->pdev);
 	gpiod_remove_lookup_table(aggr->lookups);
@@ -524,8 +525,8 @@ static void gpio_aggregator_free(struct gpio_aggregator *aggr)
 	kfree(aggr);
 }
 
-static ssize_t delete_device_store(struct device_driver *driver,
-				   const char *buf, size_t count)
+static ssize_t gpio_aggregator_delete_device_store(struct device_driver *driver,
+						   const char *buf, size_t count)
 {
 	struct gpio_aggregator *aggr;
 	unsigned int id;
@@ -549,15 +550,17 @@ static ssize_t delete_device_store(struct device_driver *driver,
 		return -ENOENT;
 	}
 
-	gpio_aggregator_free(aggr);
+	gpio_aggregator_destroy(aggr);
 	module_put(THIS_MODULE);
 	return count;
 }
-static DRIVER_ATTR_WO(delete_device);
+
+static struct driver_attribute driver_attr_gpio_aggregator_delete_device =
+	__ATTR(delete_device, 0200, NULL, gpio_aggregator_delete_device_store);
 
 static struct attribute *gpio_aggregator_attrs[] = {
-	&driver_attr_new_device.attr,
-	&driver_attr_delete_device.attr,
+	&driver_attr_gpio_aggregator_new_device.attr,
+	&driver_attr_gpio_aggregator_delete_device.attr,
 	NULL
 };
 ATTRIBUTE_GROUPS(gpio_aggregator);
@@ -622,7 +625,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);
+	gpio_aggregator_destroy(p);
 	return 0;
 }
 
-- 
2.45.2




More information about the kernel-team mailing list