mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org,
	Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH 5/5] irq: Simplify gpiochip_add_data()
Date: Mon,  3 Feb 2025 09:59:39 -0800	[thread overview]
Message-ID: <20250203175939.3133477-6-bvanassche@acm.org> (raw)
In-Reply-To: <20250203175939.3133477-1-bvanassche@acm.org>

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@acm.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,

  parent reply	other threads:[~2025-02-03 17:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03 17:59 [PATCH 0/5] Make it easier to use nested locking for interrupt descriptors Bart Van Assche
2025-02-03 17:59 ` [PATCH 1/5] lockdep: Introduce lockdep_unregister_key_nosync() Bart Van Assche
2025-02-03 17:59 ` [PATCH 2/5] irqdesc: Use dynamic lockdep keys for interrupt descriptors Bart Van Assche
2025-02-03 17:59 ` [PATCH 3/5] irq: Remove irq_set_lockdep_class() and __irq_set_lockdep_class() Bart Van Assche
2025-02-03 17:59 ` [PATCH 4/5] irq: Remove the IRQ_GC_INIT_NESTED_LOCK flag Bart Van Assche
2025-02-03 17:59 ` Bart Van Assche [this message]
2025-02-03 19:40 ` [PATCH 0/5] Make it easier to use nested locking for interrupt descriptors Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250203175939.3133477-6-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®