Skip to content

Commit e6ef4f8

Browse files
tq-steinaBartosz Golaszewski
authored andcommitted
gpio: vf610: 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: Alexander Stein <alexander.stein@ew.tq-group.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent ceaa837 commit e6ef4f8

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

drivers/gpio/gpio-vf610.c

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ struct fsl_gpio_soc_data {
3030

3131
struct vf610_gpio_port {
3232
struct gpio_chip gc;
33-
struct irq_chip ic;
3433
void __iomem *base;
3534
void __iomem *gpio_base;
3635
const struct fsl_gpio_soc_data *sdata;
@@ -207,20 +206,24 @@ static int vf610_gpio_irq_set_type(struct irq_data *d, u32 type)
207206

208207
static void vf610_gpio_irq_mask(struct irq_data *d)
209208
{
210-
struct vf610_gpio_port *port =
211-
gpiochip_get_data(irq_data_get_irq_chip_data(d));
212-
void __iomem *pcr_base = port->base + PORT_PCR(d->hwirq);
209+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
210+
struct vf610_gpio_port *port = gpiochip_get_data(gc);
211+
irq_hw_number_t gpio_num = irqd_to_hwirq(d);
212+
void __iomem *pcr_base = port->base + PORT_PCR(gpio_num);
213213

214214
vf610_gpio_writel(0, pcr_base);
215+
gpiochip_disable_irq(gc, gpio_num);
215216
}
216217

217218
static void vf610_gpio_irq_unmask(struct irq_data *d)
218219
{
219-
struct vf610_gpio_port *port =
220-
gpiochip_get_data(irq_data_get_irq_chip_data(d));
221-
void __iomem *pcr_base = port->base + PORT_PCR(d->hwirq);
220+
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
221+
struct vf610_gpio_port *port = gpiochip_get_data(gc);
222+
irq_hw_number_t gpio_num = irqd_to_hwirq(d);
223+
void __iomem *pcr_base = port->base + PORT_PCR(gpio_num);
222224

223-
vf610_gpio_writel(port->irqc[d->hwirq] << PORT_PCR_IRQC_OFFSET,
225+
gpiochip_enable_irq(gc, gpio_num);
226+
vf610_gpio_writel(port->irqc[gpio_num] << PORT_PCR_IRQC_OFFSET,
224227
pcr_base);
225228
}
226229

@@ -237,6 +240,17 @@ static int vf610_gpio_irq_set_wake(struct irq_data *d, u32 enable)
237240
return 0;
238241
}
239242

243+
static const struct irq_chip vf610_irqchip = {
244+
.name = "gpio-vf610",
245+
.irq_ack = vf610_gpio_irq_ack,
246+
.irq_mask = vf610_gpio_irq_mask,
247+
.irq_unmask = vf610_gpio_irq_unmask,
248+
.irq_set_type = vf610_gpio_irq_set_type,
249+
.irq_set_wake = vf610_gpio_irq_set_wake,
250+
.flags = IRQCHIP_IMMUTABLE,
251+
GPIOCHIP_IRQ_RESOURCE_HELPERS,
252+
};
253+
240254
static void vf610_gpio_disable_clk(void *data)
241255
{
242256
clk_disable_unprepare(data);
@@ -249,7 +263,6 @@ static int vf610_gpio_probe(struct platform_device *pdev)
249263
struct vf610_gpio_port *port;
250264
struct gpio_chip *gc;
251265
struct gpio_irq_chip *girq;
252-
struct irq_chip *ic;
253266
int i;
254267
int ret;
255268

@@ -315,14 +328,6 @@ static int vf610_gpio_probe(struct platform_device *pdev)
315328
gc->direction_output = vf610_gpio_direction_output;
316329
gc->set = vf610_gpio_set;
317330

318-
ic = &port->ic;
319-
ic->name = "gpio-vf610";
320-
ic->irq_ack = vf610_gpio_irq_ack;
321-
ic->irq_mask = vf610_gpio_irq_mask;
322-
ic->irq_unmask = vf610_gpio_irq_unmask;
323-
ic->irq_set_type = vf610_gpio_irq_set_type;
324-
ic->irq_set_wake = vf610_gpio_irq_set_wake;
325-
326331
/* Mask all GPIO interrupts */
327332
for (i = 0; i < gc->ngpio; i++)
328333
vf610_gpio_writel(0, port->base + PORT_PCR(i));
@@ -331,7 +336,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
331336
vf610_gpio_writel(~0, port->base + PORT_ISFR);
332337

333338
girq = &gc->irq;
334-
girq->chip = ic;
339+
gpio_irq_chip_set_chip(girq, &vf610_irqchip);
335340
girq->parent_handler = vf610_gpio_irq_handler;
336341
girq->num_parents = 1;
337342
girq->parents = devm_kcalloc(&pdev->dev, 1,

0 commit comments

Comments
 (0)