Skip to content

Commit e9fdcc2

Browse files
committed
Documentation: gpio: Advertise irqd_to_hwirq() helper in the examples
Instead of direct dereferencing the IRQ data in order to get HW IRQ number use the irqd_to_hwirq() helper. Fixes: 5644b66 ("Documentation: Update the recommended pattern for GPIO irqchips") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
1 parent bdb6528 commit e9fdcc2

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

Documentation/driver-api/gpio/driver.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,21 +430,23 @@ call into the core gpiolib code:
430430
static void my_gpio_mask_irq(struct irq_data *d)
431431
{
432432
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
433+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
433434
434435
/*
435436
* Perform any necessary action to mask the interrupt,
436437
* and then call into the core code to synchronise the
437438
* state.
438439
*/
439440
440-
gpiochip_disable_irq(gc, d->hwirq);
441+
gpiochip_disable_irq(gc, hwirq);
441442
}
442443
443444
static void my_gpio_unmask_irq(struct irq_data *d)
444445
{
445446
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
447+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
446448
447-
gpiochip_enable_irq(gc, d->hwirq);
449+
gpiochip_enable_irq(gc, hwirq);
448450
449451
/*
450452
* Perform any necessary action to unmask the interrupt,
@@ -502,21 +504,23 @@ the interrupt separately and go with it:
502504
static void my_gpio_mask_irq(struct irq_data *d)
503505
{
504506
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
507+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
505508
506509
/*
507510
* Perform any necessary action to mask the interrupt,
508511
* and then call into the core code to synchronise the
509512
* state.
510513
*/
511514
512-
gpiochip_disable_irq(gc, d->hwirq);
515+
gpiochip_disable_irq(gc, hwirq);
513516
}
514517
515518
static void my_gpio_unmask_irq(struct irq_data *d)
516519
{
517520
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
521+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
518522
519-
gpiochip_enable_irq(gc, d->hwirq);
523+
gpiochip_enable_irq(gc, hwirq);
520524
521525
/*
522526
* Perform any necessary action to unmask the interrupt,
@@ -577,22 +581,24 @@ In this case the typical set-up will look like this:
577581
static void my_gpio_mask_irq(struct irq_data *d)
578582
{
579583
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
584+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
580585
581586
/*
582587
* Perform any necessary action to mask the interrupt,
583588
* and then call into the core code to synchronise the
584589
* state.
585590
*/
586591
587-
gpiochip_disable_irq(gc, d->hwirq);
592+
gpiochip_disable_irq(gc, hwirq);
588593
irq_mask_mask_parent(d);
589594
}
590595
591596
static void my_gpio_unmask_irq(struct irq_data *d)
592597
{
593598
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
599+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
594600
595-
gpiochip_enable_irq(gc, d->hwirq);
601+
gpiochip_enable_irq(gc, hwirq);
596602
597603
/*
598604
* Perform any necessary action to unmask the interrupt,

0 commit comments

Comments
 (0)