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.
Unified · Split
| @@ -220,10 +220,8 @@ static void mrfld_irq_ack(struct irq_data *d) · 219 unmodified lines | ||
| 220 | 220 | raw_spin_unlock_irqrestore(&priv->lock, flags); |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | −static void mrfld_irq_unmask_mask(struct irq_data *d, bool unmask) | |
| 223 | +static void mrfld_irq_unmask_mask(struct mrfld_gpio *priv, u32 gpio, bool unmask) | |
| 224 | 224 | { |
| 225 | − struct mrfld_gpio *priv = irq_data_get_irq_chip_data(d); | |
| 226 | − u32 gpio = irqd_to_hwirq(d); | |
| 227 | 225 | void __iomem *gimr = gpio_reg(&priv->chip, gpio, GIMR); |
| 228 | 226 | unsigned long flags; |
| 229 | 227 | u32 value; |
| @@ -241,12 +239,20 @@ static void mrfld_irq_unmask_mask(struct irq_data *d, bool unmask) · 11 unmodified lines | ||
| 241 | 239 | |
| 242 | 240 | static void mrfld_irq_mask(struct irq_data *d) |
| 243 | 241 | { |
| 244 | − mrfld_irq_unmask_mask(d, false); | |
| 242 | + struct mrfld_gpio *priv = irq_data_get_irq_chip_data(d); | |
| 243 | + u32 gpio = irqd_to_hwirq(d); | |
| 244 | + | |
| 245 | + mrfld_irq_unmask_mask(priv, gpio, false); | |
| 246 | + gpiochip_disable_irq(&priv->chip, gpio); | |
| 245 | 247 | } |
| 246 | 248 | |
| 247 | 249 | static void mrfld_irq_unmask(struct irq_data *d) |
| 248 | 250 | { |
| 249 | − mrfld_irq_unmask_mask(d, true); | |
| 251 | + struct mrfld_gpio *priv = irq_data_get_irq_chip_data(d); | |
| 252 | + u32 gpio = irqd_to_hwirq(d); | |
| 253 | + | |
| 254 | + gpiochip_enable_irq(&priv->chip, gpio); | |
| 255 | + mrfld_irq_unmask_mask(priv, gpio, true); | |
| 250 | 256 | } |
| 251 | 257 | |
| 252 | 258 | static int mrfld_irq_set_type(struct irq_data *d, unsigned int type) |
| @@ -329,13 +335,15 @@ static int mrfld_irq_set_wake(struct irq_data *d, unsigned int on) · 76 unmodified lines | ||
| 329 | 335 | return 0; |
| 330 | 336 | } |
| 331 | 337 | |
| 332 | −static struct irq_chip mrfld_irqchip = { | |
| 338 | +static const struct irq_chip mrfld_irqchip = { | |
| 333 | 339 | .name = "gpio-merrifield", |
| 334 | 340 | .irq_ack = mrfld_irq_ack, |
| 335 | 341 | .irq_mask = mrfld_irq_mask, |
| 336 | 342 | .irq_unmask = mrfld_irq_unmask, |
| 337 | 343 | .irq_set_type = mrfld_irq_set_type, |
| 338 | 344 | .irq_set_wake = mrfld_irq_set_wake, |
| 345 | + .flags = IRQCHIP_IMMUTABLE, | |
| 346 | + GPIOCHIP_IRQ_RESOURCE_HELPERS, | |
| 339 | 347 | }; |
| 340 | 348 | |
| 341 | 349 | static void mrfld_irq_handler(struct irq_desc *desc) |
| @@ -482,7 +490,7 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id · 140 unmodified lines | ||
| 482 | 490 | return retval; |
| 483 | 491 | |
| 484 | 492 | girq = &priv->chip.irq; |
| 485 | − girq->chip = &mrfld_irqchip; | |
| 493 | + gpio_irq_chip_set_chip(girq, &mrfld_irqchip); | |
| 486 | 494 | girq->init_hw = mrfld_irq_init_hw; |
| 487 | 495 | girq->parent_handler = mrfld_irq_handler; |
| 488 | 496 | girq->num_parents = 1; |