Skip to content

Commit 6fb6f8b

Browse files
committed
pinctrl: intel: make irq_chip immutable
Since recently, the kernel is nagging about mutable irq_chips: "not an immutable chip, please consider fixing it!" Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new helper functions and call the appropriate gpiolib functions. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent 68aa84f commit 6fb6f8b

1 file changed

Lines changed: 25 additions & 15 deletions

File tree

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,15 +1039,14 @@ static void intel_gpio_irq_ack(struct irq_data *d)
10391039
}
10401040
}
10411041

1042-
static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
1042+
static void intel_gpio_irq_mask_unmask(struct gpio_chip *gc, irq_hw_number_t hwirq, bool mask)
10431043
{
1044-
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
10451044
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
10461045
const struct intel_community *community;
10471046
const struct intel_padgroup *padgrp;
10481047
int pin;
10491048

1050-
pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), &community, &padgrp);
1049+
pin = intel_gpio_to_pin(pctrl, hwirq, &community, &padgrp);
10511050
if (pin >= 0) {
10521051
unsigned int gpp, gpp_offset;
10531052
unsigned long flags;
@@ -1077,12 +1076,20 @@ static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
10771076

10781077
static void intel_gpio_irq_mask(struct irq_data *d)
10791078
{
1080-
intel_gpio_irq_mask_unmask(d, true);
1079+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1080+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
1081+
1082+
intel_gpio_irq_mask_unmask(gc, hwirq, true);
1083+
gpiochip_disable_irq(gc, hwirq);
10811084
}
10821085

10831086
static void intel_gpio_irq_unmask(struct irq_data *d)
10841087
{
1085-
intel_gpio_irq_mask_unmask(d, false);
1088+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
1089+
irq_hw_number_t hwirq = irqd_to_hwirq(d);
1090+
1091+
gpiochip_enable_irq(gc, hwirq);
1092+
intel_gpio_irq_mask_unmask(gc, hwirq, false);
10861093
}
10871094

10881095
static int intel_gpio_irq_type(struct irq_data *d, unsigned int type)
@@ -1157,6 +1164,17 @@ static int intel_gpio_irq_wake(struct irq_data *d, unsigned int on)
11571164
return 0;
11581165
}
11591166

1167+
static const struct irq_chip intel_gpio_irq_chip = {
1168+
.name = "intel-gpio",
1169+
.irq_ack = intel_gpio_irq_ack,
1170+
.irq_mask = intel_gpio_irq_mask,
1171+
.irq_unmask = intel_gpio_irq_unmask,
1172+
.irq_set_type = intel_gpio_irq_type,
1173+
.irq_set_wake = intel_gpio_irq_wake,
1174+
.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE,
1175+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
1176+
};
1177+
11601178
static int intel_gpio_community_irq_handler(struct intel_pinctrl *pctrl,
11611179
const struct intel_community *community)
11621180
{
@@ -1319,15 +1337,6 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
13191337
pctrl->chip.add_pin_ranges = intel_gpio_add_pin_ranges;
13201338
pctrl->irq = irq;
13211339

1322-
/* Setup IRQ chip */
1323-
pctrl->irqchip.name = dev_name(pctrl->dev);
1324-
pctrl->irqchip.irq_ack = intel_gpio_irq_ack;
1325-
pctrl->irqchip.irq_mask = intel_gpio_irq_mask;
1326-
pctrl->irqchip.irq_unmask = intel_gpio_irq_unmask;
1327-
pctrl->irqchip.irq_set_type = intel_gpio_irq_type;
1328-
pctrl->irqchip.irq_set_wake = intel_gpio_irq_wake;
1329-
pctrl->irqchip.flags = IRQCHIP_MASK_ON_SUSPEND;
1330-
13311340
/*
13321341
* On some platforms several GPIO controllers share the same interrupt
13331342
* line.
@@ -1340,8 +1349,9 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
13401349
return ret;
13411350
}
13421351

1352+
/* Setup IRQ chip */
13431353
girq = &pctrl->chip.irq;
1344-
girq->chip = &pctrl->irqchip;
1354+
gpio_irq_chip_set_chip(girq, &intel_gpio_irq_chip);
13451355
/* This will let us handle the IRQ in the driver */
13461356
girq->parent_handler = NULL;
13471357
girq->num_parents = 0;

0 commit comments

Comments
 (0)