History

Merge tag 'gpio-v4.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fix from Linus Walleij: "A single lockdep fix, nothing else going on. This makes lockdep noiseless and work properly with threaded GPIO IRQchips. Summary: Fix a lockdep issue: the threaded irqchips also need their unique key, and take this opportunity to get rid of the horrible macro and replace it with a static inline" * tag 'gpio-v4.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: provide lockdep keys for nested/unnested irqchips

Linus Torvalds committed 9 years ago

Commit 63021182 parents 3258943 739e6f52 files · +59 −29Browse files

Unified · Split

2 files
  1. drivers/gpio/gpiolib.c +9 −9
  2. include/linux/gpio/driver.h +50 −20
drivers/gpio/gpiolib.c+9−9
@@ -1723,7 +1723,7 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) · 1722 unmodified lines
17231723 }
17241724
17251725 /**
1726− * _gpiochip_irqchip_add() - adds an irqchip to a gpiochip
1726+ * gpiochip_irqchip_add_key() - adds an irqchip to a gpiochip
17271727 * @gpiochip: the gpiochip to add the irqchip to
17281728 * @irqchip: the irqchip to add to the gpiochip
17291729 * @first_irq: if not dynamically assigned, the base (first) IRQ to
@@ -1749,13 +1749,13 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) · 19 unmodified lines
17491749 * the pins on the gpiochip can generate a unique IRQ. Everything else
17501750 * need to be open coded.
17511751 */
1752−int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
1753− struct irq_chip *irqchip,
1754− unsigned int first_irq,
1755− irq_flow_handler_t handler,
1756− unsigned int type,
1757− bool nested,
1758− struct lock_class_key *lock_key)
1752+int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
1753+ struct irq_chip *irqchip,
1754+ unsigned int first_irq,
1755+ irq_flow_handler_t handler,
1756+ unsigned int type,
1757+ bool nested,
1758+ struct lock_class_key *lock_key)
17591759 {
17601760 struct device_node *of_node;
17611761 bool irq_base_set = false;
@@ -1840,7 +1840,7 @@ int _gpiochip_irqchip_add(struct gpio_chip *gpiochip, · 78 unmodified lines
18401840
18411841 return 0;
18421842 }
1843−EXPORT_SYMBOL_GPL(_gpiochip_irqchip_add);
1843+EXPORT_SYMBOL_GPL(gpiochip_irqchip_add_key);
18441844
18451845 #else /* CONFIG_GPIOLIB_IRQCHIP */
18461846
include/linux/gpio/driver.h+50−20
@@ -274,37 +274,67 @@ void gpiochip_set_nested_irqchip(struct gpio_chip *gpiochip, · 273 unmodified lines
274274 struct irq_chip *irqchip,
275275 int parent_irq);
276276
277−int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
277+int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
278+ struct irq_chip *irqchip,
279+ unsigned int first_irq,
280+ irq_flow_handler_t handler,
281+ unsigned int type,
282+ bool nested,
283+ struct lock_class_key *lock_key);
284+
285+#ifdef CONFIG_LOCKDEP
286+
287+/*
288+ * Lockdep requires that each irqchip instance be created with a
289+ * unique key so as to avoid unnecessary warnings. This upfront
290+ * boilerplate static inlines provides such a key for each
291+ * unique instance.
292+ */
293+static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
294+ struct irq_chip *irqchip,
295+ unsigned int first_irq,
296+ irq_flow_handler_t handler,
297+ unsigned int type)
298+{
299+ static struct lock_class_key key;
300+
301+ return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
302+ handler, type, false, &key);
303+}
304+
305+static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,
278306 struct irq_chip *irqchip,
279307 unsigned int first_irq,
280308 irq_flow_handler_t handler,
281− unsigned int type,
282− bool nested,
283− struct lock_class_key *lock_key);
309+ unsigned int type)
310+{
311+
312+ static struct lock_class_key key;
313+
314+ return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
315+ handler, type, true, &key);
316+}
317+#else
318+static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
319+ struct irq_chip *irqchip,
320+ unsigned int first_irq,
321+ irq_flow_handler_t handler,
322+ unsigned int type)
323+{
324+ return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
325+ handler, type, false, NULL);
326+}
284327
285−/* FIXME: I assume threaded IRQchips do not have the lockdep problem */
286328 static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,
287329 struct irq_chip *irqchip,
288330 unsigned int first_irq,
289331 irq_flow_handler_t handler,
290332 unsigned int type)
291333 {
292− return _gpiochip_irqchip_add(gpiochip, irqchip, first_irq,
293− handler, type, true, NULL);
334+ return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
335+ handler, type, true, NULL);
294336 }
295−
296−#ifdef CONFIG_LOCKDEP
297−#define gpiochip_irqchip_add(...) \
298−( \
299− ({ \
300− static struct lock_class_key _key; \
301− _gpiochip_irqchip_add(__VA_ARGS__, false, &_key); \
302− }) \
303−)
304−#else
305−#define gpiochip_irqchip_add(...) \
306− _gpiochip_irqchip_add(__VA_ARGS__, false, NULL)
307−#endif
337+#endif /* CONFIG_LOCKDEP */
308338
309339 #endif /* CONFIG_GPIOLIB_IRQCHIP */
310340

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t