kernel/irq: Extend lockdep class for request mutex
The IRQ code already has support for lockdep class for the lock mutex in an interrupt descriptor. Extend this to add a second class for the request mutex in the descriptor. Not having a class is resulting in false positive splats in some code paths. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: linus.walleij@linaro.org Cc: grygorii.strashko@ti.com Cc: f.fainelli@gmail.com Link: https://lkml.kernel.org/r/1512234664-21555-1-git-send-email-andrew@lunn.ch
This commit is contained in:

committed by
Thomas Gleixner

parent
beacbc68ac
commit
39c3fd5895
@@ -522,6 +522,7 @@ static struct of_device_id const bcm_kona_gpio_of_match[] = {
|
||||
* category than their parents, so it won't report false recursion.
|
||||
*/
|
||||
static struct lock_class_key gpio_lock_class;
|
||||
static struct lock_class_key gpio_request_class;
|
||||
|
||||
static int bcm_kona_gpio_irq_map(struct irq_domain *d, unsigned int irq,
|
||||
irq_hw_number_t hwirq)
|
||||
@@ -531,7 +532,7 @@ static int bcm_kona_gpio_irq_map(struct irq_domain *d, unsigned int irq,
|
||||
ret = irq_set_chip_data(irq, d->host_data);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
irq_set_lockdep_class(irq, &gpio_lock_class);
|
||||
irq_set_lockdep_class(irq, &gpio_lock_class, &gpio_request_class);
|
||||
irq_set_chip_and_handler(irq, &bcm_gpio_irq_chip, handle_simple_irq);
|
||||
irq_set_noprobe(irq);
|
||||
|
||||
|
@@ -327,6 +327,7 @@ static struct brcmstb_gpio_bank *brcmstb_gpio_hwirq_to_bank(
|
||||
* category than their parents, so it won't report false recursion.
|
||||
*/
|
||||
static struct lock_class_key brcmstb_gpio_irq_lock_class;
|
||||
static struct lock_class_key brcmstb_gpio_irq_request_class;
|
||||
|
||||
|
||||
static int brcmstb_gpio_irq_map(struct irq_domain *d, unsigned int irq,
|
||||
@@ -346,7 +347,8 @@ static int brcmstb_gpio_irq_map(struct irq_domain *d, unsigned int irq,
|
||||
ret = irq_set_chip_data(irq, &bank->gc);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
irq_set_lockdep_class(irq, &brcmstb_gpio_irq_lock_class);
|
||||
irq_set_lockdep_class(irq, &brcmstb_gpio_irq_lock_class,
|
||||
&brcmstb_gpio_irq_lock_class);
|
||||
irq_set_chip_and_handler(irq, &priv->irq_chip, handle_level_irq);
|
||||
irq_set_noprobe(irq);
|
||||
return 0;
|
||||
|
@@ -565,6 +565,7 @@ static const struct dev_pm_ops tegra_gpio_pm_ops = {
|
||||
* than their parents, so it won't report false recursion.
|
||||
*/
|
||||
static struct lock_class_key gpio_lock_class;
|
||||
static struct lock_class_key gpio_request_class;
|
||||
|
||||
static int tegra_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
@@ -670,7 +671,8 @@ static int tegra_gpio_probe(struct platform_device *pdev)
|
||||
|
||||
bank = &tgi->bank_info[GPIO_BANK(gpio)];
|
||||
|
||||
irq_set_lockdep_class(irq, &gpio_lock_class);
|
||||
irq_set_lockdep_class(irq, &gpio_lock_class,
|
||||
&gpio_request_class);
|
||||
irq_set_chip_data(irq, bank);
|
||||
irq_set_chip_and_handler(irq, &tgi->ic, handle_simple_irq);
|
||||
}
|
||||
|
@@ -73,7 +73,8 @@ LIST_HEAD(gpio_devices);
|
||||
|
||||
static void gpiochip_free_hogs(struct gpio_chip *chip);
|
||||
static int gpiochip_add_irqchip(struct gpio_chip *gpiochip,
|
||||
struct lock_class_key *key);
|
||||
struct lock_class_key *lock_key,
|
||||
struct lock_class_key *request_key);
|
||||
static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip);
|
||||
static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gpiochip);
|
||||
static void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip);
|
||||
@@ -1100,7 +1101,8 @@ static void gpiochip_setup_devs(void)
|
||||
}
|
||||
|
||||
int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
|
||||
struct lock_class_key *key)
|
||||
struct lock_class_key *lock_key,
|
||||
struct lock_class_key *request_key)
|
||||
{
|
||||
unsigned long flags;
|
||||
int status = 0;
|
||||
@@ -1246,7 +1248,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data,
|
||||
if (status)
|
||||
goto err_remove_from_list;
|
||||
|
||||
status = gpiochip_add_irqchip(chip, key);
|
||||
status = gpiochip_add_irqchip(chip, lock_key, request_key);
|
||||
if (status)
|
||||
goto err_remove_chip;
|
||||
|
||||
@@ -1632,7 +1634,7 @@ int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
|
||||
* This lock class tells lockdep that GPIO irqs are in a different
|
||||
* category than their parents, so it won't report false recursion.
|
||||
*/
|
||||
irq_set_lockdep_class(irq, chip->irq.lock_key);
|
||||
irq_set_lockdep_class(irq, chip->irq.lock_key, chip->irq.request_key);
|
||||
irq_set_chip_and_handler(irq, chip->irq.chip, chip->irq.handler);
|
||||
/* Chips that use nested thread handlers have them marked */
|
||||
if (chip->irq.threaded)
|
||||
@@ -1712,10 +1714,12 @@ static int gpiochip_to_irq(struct gpio_chip *chip, unsigned offset)
|
||||
/**
|
||||
* gpiochip_add_irqchip() - adds an IRQ chip to a GPIO chip
|
||||
* @gpiochip: the GPIO chip to add the IRQ chip to
|
||||
* @lock_key: lockdep class
|
||||
* @lock_key: lockdep class for IRQ lock
|
||||
* @request_key: lockdep class for IRQ request
|
||||
*/
|
||||
static int gpiochip_add_irqchip(struct gpio_chip *gpiochip,
|
||||
struct lock_class_key *lock_key)
|
||||
struct lock_class_key *lock_key,
|
||||
struct lock_class_key *request_key)
|
||||
{
|
||||
struct irq_chip *irqchip = gpiochip->irq.chip;
|
||||
const struct irq_domain_ops *ops;
|
||||
@@ -1753,6 +1757,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip,
|
||||
gpiochip->to_irq = gpiochip_to_irq;
|
||||
gpiochip->irq.default_type = type;
|
||||
gpiochip->irq.lock_key = lock_key;
|
||||
gpiochip->irq.request_key = request_key;
|
||||
|
||||
if (gpiochip->irq.domain_ops)
|
||||
ops = gpiochip->irq.domain_ops;
|
||||
@@ -1850,7 +1855,8 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip)
|
||||
* @type: the default type for IRQs on this irqchip, pass IRQ_TYPE_NONE
|
||||
* to have the core avoid setting up any default type in the hardware.
|
||||
* @threaded: whether this irqchip uses a nested thread handler
|
||||
* @lock_key: lockdep class
|
||||
* @lock_key: lockdep class for IRQ lock
|
||||
* @request_key: lockdep class for IRQ request
|
||||
*
|
||||
* This function closely associates a certain irqchip with a certain
|
||||
* gpiochip, providing an irq domain to translate the local IRQs to
|
||||
@@ -1872,7 +1878,8 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
|
||||
irq_flow_handler_t handler,
|
||||
unsigned int type,
|
||||
bool threaded,
|
||||
struct lock_class_key *lock_key)
|
||||
struct lock_class_key *lock_key,
|
||||
struct lock_class_key *request_key)
|
||||
{
|
||||
struct device_node *of_node;
|
||||
|
||||
@@ -1913,6 +1920,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
|
||||
gpiochip->irq.default_type = type;
|
||||
gpiochip->to_irq = gpiochip_to_irq;
|
||||
gpiochip->irq.lock_key = lock_key;
|
||||
gpiochip->irq.request_key = request_key;
|
||||
gpiochip->irq.domain = irq_domain_add_simple(of_node,
|
||||
gpiochip->ngpio, first_irq,
|
||||
&gpiochip_domain_ops, gpiochip);
|
||||
@@ -1940,7 +1948,8 @@ EXPORT_SYMBOL_GPL(gpiochip_irqchip_add_key);
|
||||
#else /* CONFIG_GPIOLIB_IRQCHIP */
|
||||
|
||||
static inline int gpiochip_add_irqchip(struct gpio_chip *gpiochip,
|
||||
struct lock_class_key *key)
|
||||
struct lock_class_key *lock_key,
|
||||
struct lock_class_key *request_key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user