aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/gpio/driver.h
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2017-01-30 08:39:20 -0500
committerLinus Walleij <linus.walleij@linaro.org>2017-01-30 08:39:20 -0500
commit7f36f5d11cda050b118f76d774151427a18d15ef (patch)
tree9d4fa3b830785b767525a5e6a065fe4297cd8112 /include/linux/gpio/driver.h
parent2b24efa8e5c5042b0f126c09622b3e9e3c86a4fa (diff)
parent566cf877a1fcb6d6dc0126b076aad062054c2637 (diff)
Merge tag 'v4.10-rc6' into devel
Linux 4.10-rc6 Resolved conflicts in: drivers/pinctrl/pinctrl-amd.c drivers/pinctrl/samsung/pinctrl-exynos.c
Diffstat (limited to 'include/linux/gpio/driver.h')
-rw-r--r--include/linux/gpio/driver.h70
1 files changed, 50 insertions, 20 deletions
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index db2022910caf..846f3b989480 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -251,37 +251,67 @@ void gpiochip_set_nested_irqchip(struct gpio_chip *gpiochip,
251 struct irq_chip *irqchip, 251 struct irq_chip *irqchip,
252 int parent_irq); 252 int parent_irq);
253 253
254int _gpiochip_irqchip_add(struct gpio_chip *gpiochip, 254int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
255 struct irq_chip *irqchip,
256 unsigned int first_irq,
257 irq_flow_handler_t handler,
258 unsigned int type,
259 bool nested,
260 struct lock_class_key *lock_key);
261
262#ifdef CONFIG_LOCKDEP
263
264/*
265 * Lockdep requires that each irqchip instance be created with a
266 * unique key so as to avoid unnecessary warnings. This upfront
267 * boilerplate static inlines provides such a key for each
268 * unique instance.
269 */
270static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
271 struct irq_chip *irqchip,
272 unsigned int first_irq,
273 irq_flow_handler_t handler,
274 unsigned int type)
275{
276 static struct lock_class_key key;
277
278 return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
279 handler, type, false, &key);
280}
281
282static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,
255 struct irq_chip *irqchip, 283 struct irq_chip *irqchip,
256 unsigned int first_irq, 284 unsigned int first_irq,
257 irq_flow_handler_t handler, 285 irq_flow_handler_t handler,
258 unsigned int type, 286 unsigned int type)
259 bool nested, 287{
260 struct lock_class_key *lock_key); 288
289 static struct lock_class_key key;
290
291 return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
292 handler, type, true, &key);
293}
294#else
295static inline int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
296 struct irq_chip *irqchip,
297 unsigned int first_irq,
298 irq_flow_handler_t handler,
299 unsigned int type)
300{
301 return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
302 handler, type, false, NULL);
303}
261 304
262/* FIXME: I assume threaded IRQchips do not have the lockdep problem */
263static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip, 305static inline int gpiochip_irqchip_add_nested(struct gpio_chip *gpiochip,
264 struct irq_chip *irqchip, 306 struct irq_chip *irqchip,
265 unsigned int first_irq, 307 unsigned int first_irq,
266 irq_flow_handler_t handler, 308 irq_flow_handler_t handler,
267 unsigned int type) 309 unsigned int type)
268{ 310{
269 return _gpiochip_irqchip_add(gpiochip, irqchip, first_irq, 311 return gpiochip_irqchip_add_key(gpiochip, irqchip, first_irq,
270 handler, type, true, NULL); 312 handler, type, true, NULL);
271} 313}
272 314#endif /* CONFIG_LOCKDEP */
273#ifdef CONFIG_LOCKDEP
274#define gpiochip_irqchip_add(...) \
275( \
276 ({ \
277 static struct lock_class_key _key; \
278 _gpiochip_irqchip_add(__VA_ARGS__, false, &_key); \
279 }) \
280)
281#else
282#define gpiochip_irqchip_add(...) \
283 _gpiochip_irqchip_add(__VA_ARGS__, false, NULL)
284#endif
285 315
286#endif /* CONFIG_GPIOLIB_IRQCHIP */ 316#endif /* CONFIG_GPIOLIB_IRQCHIP */
287 317