Skip to content

Commit 2788938

Browse files
Cixi GengBartosz Golaszewski
authored andcommitted
gpio: eic-sprd: Make the irqchip immutable
Remove the irq_chip from pmic_eic structure, use the various calls by defining the statically irq_chip structure. Signed-off-by: Cixi Geng <[email protected]> Reviewed-by: Baolin Wang <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 90fee3d commit 2788938

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

drivers/gpio/gpio-eic-sprd.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ enum sprd_eic_type {
9191

9292
struct sprd_eic {
9393
struct gpio_chip chip;
94-
struct irq_chip intc;
9594
void __iomem *base[SPRD_EIC_MAX_BANK];
9695
enum sprd_eic_type type;
9796
spinlock_t lock;
@@ -255,6 +254,8 @@ static void sprd_eic_irq_mask(struct irq_data *data)
255254
default:
256255
dev_err(chip->parent, "Unsupported EIC type.\n");
257256
}
257+
258+
gpiochip_disable_irq(chip, offset);
258259
}
259260

260261
static void sprd_eic_irq_unmask(struct irq_data *data)
@@ -263,6 +264,8 @@ static void sprd_eic_irq_unmask(struct irq_data *data)
263264
struct sprd_eic *sprd_eic = gpiochip_get_data(chip);
264265
u32 offset = irqd_to_hwirq(data);
265266

267+
gpiochip_enable_irq(chip, offset);
268+
266269
switch (sprd_eic->type) {
267270
case SPRD_EIC_DEBOUNCE:
268271
sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IE, 1);
@@ -564,6 +567,15 @@ static void sprd_eic_irq_handler(struct irq_desc *desc)
564567
chained_irq_exit(ic, desc);
565568
}
566569

570+
static const struct irq_chip sprd_eic_irq = {
571+
.name = "sprd-eic",
572+
.irq_ack = sprd_eic_irq_ack,
573+
.irq_mask = sprd_eic_irq_mask,
574+
.irq_unmask = sprd_eic_irq_unmask,
575+
.irq_set_type = sprd_eic_irq_set_type,
576+
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE,
577+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
578+
};
567579
static int sprd_eic_probe(struct platform_device *pdev)
568580
{
569581
const struct sprd_eic_variant_data *pdata;
@@ -626,15 +638,8 @@ static int sprd_eic_probe(struct platform_device *pdev)
626638
break;
627639
}
628640

629-
sprd_eic->intc.name = dev_name(&pdev->dev);
630-
sprd_eic->intc.irq_ack = sprd_eic_irq_ack;
631-
sprd_eic->intc.irq_mask = sprd_eic_irq_mask;
632-
sprd_eic->intc.irq_unmask = sprd_eic_irq_unmask;
633-
sprd_eic->intc.irq_set_type = sprd_eic_irq_set_type;
634-
sprd_eic->intc.flags = IRQCHIP_SKIP_SET_WAKE;
635-
636641
irq = &sprd_eic->chip.irq;
637-
irq->chip = &sprd_eic->intc;
642+
gpio_irq_chip_set_chip(irq, &sprd_eic_irq);
638643
irq->handler = handle_bad_irq;
639644
irq->default_type = IRQ_TYPE_NONE;
640645
irq->parent_handler = sprd_eic_irq_handler;

0 commit comments

Comments
 (0)