lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240718000935.2573288-2-khilman@baylibre.com>
Date: Wed, 17 Jul 2024 17:09:32 -0700
From: Kevin Hilman <khilman@...libre.com>
To: linux-gpio@...r.kernel.org
Cc: Keerthy <j-keerthy@...com>,
	Linus Walleij <linus.walleij@...aro.org>,
	Bartosz Golaszewski <brgl@...ev.pl>,
	linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 1/2] gpiolib: expose for_each_gpio_desc() to drivers

The for_each_gpio_desc() iterator is a convenient helper and is also
useful for GPIO controller drivers.  Move this helper from the
internal gpiolib.h to driver.h.

Signed-off-by: Kevin Hilman <khilman@...libre.com>
---
 drivers/gpio/gpiolib.h      | 5 -----
 include/linux/gpio/driver.h | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 48e086c2f416..c68be135e137 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -115,11 +115,6 @@ struct gpio_array {
 	unsigned long		invert_mask[];
 };
 
-#define for_each_gpio_desc(gc, desc)					\
-	for (unsigned int __i = 0;					\
-	     __i < gc->ngpio && (desc = gpiochip_get_desc(gc, __i));	\
-	     __i++)							\
-
 #define for_each_gpio_desc_with_flag(gc, desc, flag)			\
 	for_each_gpio_desc(gc, desc)					\
 		if (!test_bit(flag, &desc->flags)) {} else
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 0032bb6e7d8f..3e7e58be31b4 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -813,6 +813,11 @@ const char *gpio_device_get_label(struct gpio_device *gdev);
 struct gpio_device *gpio_device_find_by_label(const char *label);
 struct gpio_device *gpio_device_find_by_fwnode(const struct fwnode_handle *fwnode);
 
+#define for_each_gpio_desc(gc, desc)					\
+	for (unsigned int __i = 0;					\
+	     __i < gc->ngpio && (desc = gpiochip_get_desc(gc, __i));	\
+	     __i++)							\
+
 #else /* CONFIG_GPIOLIB */
 
 #include <asm/bug.h>
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ