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: <20250203175939.3133477-6-bvanassche@acm.org>
Date: Mon,  3 Feb 2025 09:59:39 -0800
From: Bart Van Assche <bvanassche@....org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Peter Zijlstra <peterz@...radead.org>,
	linux-kernel@...r.kernel.org,
	Bart Van Assche <bvanassche@....org>
Subject: [PATCH 5/5] irq: Simplify gpiochip_add_data()

Because of patch "irqdesc: Use dynamic lockdep keys for interrupt
descriptors", the 'lock_key' and 'request_key' members of
gpiochip_add_data_with_key() and devm_gpiochip_add_data_with_key() are no
longer used. Hence, remove the gpiochip_add_data() and
devm_gpiochip_add_data() macros, remove the 'lock_key' and 'request_key'
arguments and remove the _with_key suffix from the two aforementioned
functions.

Signed-off-by: Bart Van Assche <bvanassche@....org>
---
 drivers/gpio/gpiolib-devres.c | 12 ++++--------
 drivers/gpio/gpiolib.c        | 24 ++++++------------------
 include/linux/gpio/driver.h   | 27 +++------------------------
 3 files changed, 13 insertions(+), 50 deletions(-)

diff --git a/drivers/gpio/gpiolib-devres.c b/drivers/gpio/gpiolib-devres.c
index 08205f355ceb..70f0c60c0b1c 100644
--- a/drivers/gpio/gpiolib-devres.c
+++ b/drivers/gpio/gpiolib-devres.c
@@ -366,12 +366,10 @@ static void devm_gpio_chip_release(void *data)
 }
 
 /**
- * devm_gpiochip_add_data_with_key() - Resource managed gpiochip_add_data_with_key()
+ * devm_gpiochip_add_data() - Resource managed gpiochip_add_data()
  * @dev: pointer to the device that gpio_chip belongs to.
  * @gc: the GPIO chip to register
  * @data: driver-private data associated with this chip
- * @lock_key: lockdep class for IRQ lock
- * @request_key: lockdep class for IRQ request
  *
  * Context: potentially before irqs will work
  *
@@ -382,16 +380,14 @@ static void devm_gpio_chip_release(void *data)
  * gc->base is invalid or already associated with a different chip.
  * Otherwise it returns zero as a success code.
  */
-int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc, void *data,
-				    struct lock_class_key *lock_key,
-				    struct lock_class_key *request_key)
+int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc, void *data)
 {
 	int ret;
 
-	ret = gpiochip_add_data_with_key(gc, data, lock_key, request_key);
+	ret = gpiochip_add_data(gc, data);
 	if (ret < 0)
 		return ret;
 
 	return devm_add_action_or_reset(dev, devm_gpio_chip_release, gc);
 }
-EXPORT_SYMBOL_GPL(devm_gpiochip_add_data_with_key);
+EXPORT_SYMBOL_GPL(devm_gpiochip_add_data);
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 940d3f980457..2aac9660b86b 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -93,9 +93,7 @@ static LIST_HEAD(gpio_machine_hogs);
 const char *const gpio_suffixes[] = { "gpios", "gpio", NULL };
 
 static void gpiochip_free_hogs(struct gpio_chip *gc);
-static int gpiochip_add_irqchip(struct gpio_chip *gc,
-				struct lock_class_key *lock_key,
-				struct lock_class_key *request_key);
+static int gpiochip_add_irqchip(struct gpio_chip *gc);
 static void gpiochip_irqchip_remove(struct gpio_chip *gc);
 static int gpiochip_irqchip_init_hw(struct gpio_chip *gc);
 static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gc);
@@ -916,9 +914,7 @@ int gpiochip_get_ngpios(struct gpio_chip *gc, struct device *dev)
 }
 EXPORT_SYMBOL_GPL(gpiochip_get_ngpios);
 
-int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
-			       struct lock_class_key *lock_key,
-			       struct lock_class_key *request_key)
+int gpiochip_add_data(struct gpio_chip *gc, void *data)
 {
 	struct gpio_device *gdev;
 	unsigned int desc_index;
@@ -1085,7 +1081,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
 	if (ret)
 		goto err_remove_irqchip_mask;
 
-	ret = gpiochip_add_irqchip(gc, lock_key, request_key);
+	ret = gpiochip_add_irqchip(gc);
 	if (ret)
 		goto err_remove_irqchip_mask;
 
@@ -1148,7 +1144,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
 	}
 	return ret;
 }
-EXPORT_SYMBOL_GPL(gpiochip_add_data_with_key);
+EXPORT_SYMBOL_GPL(gpiochip_add_data);
 
 /**
  * gpiochip_remove() - unregister a gpio_chip
@@ -1930,15 +1926,11 @@ static int gpiochip_irqchip_add_allocated_domain(struct gpio_chip *gc,
 /**
  * gpiochip_add_irqchip() - adds an IRQ chip to a GPIO chip
  * @gc: the GPIO chip to add the IRQ chip to
- * @lock_key: lockdep class for IRQ lock
- * @request_key: lockdep class for IRQ request
  *
  * Returns:
  * 0 on success, or a negative errno on failure.
  */
-static int gpiochip_add_irqchip(struct gpio_chip *gc,
-				struct lock_class_key *lock_key,
-				struct lock_class_key *request_key)
+static int gpiochip_add_irqchip(struct gpio_chip *gc)
 {
 	struct fwnode_handle *fwnode = dev_fwnode(&gc->gpiodev->dev);
 	struct irq_chip *irqchip = gc->irq.chip;
@@ -1967,8 +1959,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
 		type = IRQ_TYPE_NONE;
 
 	gc->irq.default_type = type;
-	gc->irq.lock_key = lock_key;
-	gc->irq.request_key = request_key;
 
 	/* If a parent irqdomain is provided, let's build a hierarchy */
 	if (gpiochip_hierarchy_is_hierarchical(gc)) {
@@ -2083,9 +2073,7 @@ EXPORT_SYMBOL_GPL(gpiochip_irqchip_add_domain);
 
 #else /* CONFIG_GPIOLIB_IRQCHIP */
 
-static inline int gpiochip_add_irqchip(struct gpio_chip *gc,
-				       struct lock_class_key *lock_key,
-				       struct lock_class_key *request_key)
+static inline int gpiochip_add_irqchip(struct gpio_chip *gc)
 {
 	return 0;
 }
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 087a295a5480..ef39e60a0849 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -572,9 +572,7 @@ DEFINE_CLASS(_gpiochip_for_each_data,
 	for_each_requested_gpio_in_range(chip, i, 0, chip->ngpio, label)
 
 /* add/remove chips */
-int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
-			       struct lock_class_key *lock_key,
-			       struct lock_class_key *request_key);
+int gpiochip_add_data(struct gpio_chip *gc, void *data);
 
 /**
  * gpiochip_add_data() - register a gpio_chip
@@ -599,29 +597,10 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
  * gc->base is invalid or already associated with a different chip.
  * Otherwise it returns zero as a success code.
  */
-#ifdef CONFIG_LOCKDEP
-#define gpiochip_add_data(gc, data) ({		\
-		static struct lock_class_key lock_key;	\
-		static struct lock_class_key request_key;	  \
-		gpiochip_add_data_with_key(gc, data, &lock_key, \
-					   &request_key);	  \
-	})
-#define devm_gpiochip_add_data(dev, gc, data) ({ \
-		static struct lock_class_key lock_key;	\
-		static struct lock_class_key request_key;	  \
-		devm_gpiochip_add_data_with_key(dev, gc, data, &lock_key, \
-					   &request_key);	  \
-	})
-#else
-#define gpiochip_add_data(gc, data) gpiochip_add_data_with_key(gc, data, NULL, NULL)
-#define devm_gpiochip_add_data(dev, gc, data) \
-	devm_gpiochip_add_data_with_key(dev, gc, data, NULL, NULL)
-#endif /* CONFIG_LOCKDEP */
 
 void gpiochip_remove(struct gpio_chip *gc);
-int devm_gpiochip_add_data_with_key(struct device *dev, struct gpio_chip *gc,
-				    void *data, struct lock_class_key *lock_key,
-				    struct lock_class_key *request_key);
+int devm_gpiochip_add_data(struct device *dev, struct gpio_chip *gc,
+			   void *data);
 
 struct gpio_device *gpio_device_find(const void *data,
 				int (*match)(struct gpio_chip *gc,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ