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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211109100207.2474024-8-arnd@kernel.org>
Date:   Tue,  9 Nov 2021 11:02:06 +0100
From:   Arnd Bergmann <arnd@...nel.org>
To:     linux-gpio@...r.kernel.org
Cc:     Arnd Bergmann <arnd@...db.de>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bartosz Golaszewski <brgl@...ev.pl>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2 7/8] gpiolib: remove gpio_to_chip

From: Arnd Bergmann <arnd@...db.de>

There are only two callers of this helper, remove them by
open-coding the call to the gpiod version.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 drivers/pinctrl/core.c    | 5 ++---
 drivers/soc/fsl/qe/gpio.c | 4 +---
 include/linux/gpio.h      | 7 -------
 3 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 976607758e98..8d3c00782178 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -28,7 +28,6 @@
 
 #ifdef CONFIG_GPIOLIB
 #include "../gpio/gpiolib.h"
-#include <linux/gpio.h>
 #endif
 
 #include "core.h"
@@ -324,7 +323,7 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio)
 {
 	struct pinctrl_dev *pctldev;
 	struct pinctrl_gpio_range *range = NULL;
-	struct gpio_chip *chip = gpio_to_chip(gpio);
+	struct gpio_chip *chip = gpiod_to_chip(gpio_to_desc(gpio));
 
 	if (WARN(!chip, "no gpio_chip for gpio%i?", gpio))
 		return false;
@@ -1657,7 +1656,7 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
 			}
 		}
 		if (gpio_num >= 0)
-			chip = gpio_to_chip(gpio_num);
+			chip = gpiod_to_chip(gpio_to_desc(gpio_num));
 		else
 			chip = NULL;
 		if (chip)
diff --git a/drivers/soc/fsl/qe/gpio.c b/drivers/soc/fsl/qe/gpio.c
index 99f7de43c3c6..a6aa55055e9a 100644
--- a/drivers/soc/fsl/qe/gpio.c
+++ b/drivers/soc/fsl/qe/gpio.c
@@ -15,8 +15,6 @@
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/gpio/driver.h>
-/* FIXME: needed for gpio_to_chip() get rid of this */
-#include <linux/gpio.h>
 #include <linux/slab.h>
 #include <linux/export.h>
 #include <soc/fsl/qe/qe.h>
@@ -173,7 +171,7 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
 	err = of_get_gpio(np, index);
 	if (err < 0)
 		goto err0;
-	gc = gpio_to_chip(err);
+	gc = gpiod_to_chip(gpio_to_desc(err));
 	if (WARN_ON(!gc)) {
 		err = -ENODEV;
 		goto err0;
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 7ceb93678689..61fb427b4e70 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -96,12 +96,6 @@ static inline bool gpio_is_valid(int number)
 
 struct device;
 
-/* caller holds gpio_lock *OR* gpio is marked as requested */
-static inline struct gpio_chip *gpio_to_chip(unsigned gpio)
-{
-	return gpiod_to_chip(gpio_to_desc(gpio));
-}
-
 /* Always use the library code for GPIO management calls,
  * or when sleeping may be involved.
  */
@@ -158,7 +152,6 @@ int devm_gpio_request_one(struct device *dev, unsigned gpio,
 #include <linux/bug.h>
 
 struct device;
-struct gpio_chip;
 
 static inline bool gpio_is_valid(int number)
 {
-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ