History

gpio: merrifield: 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.

Andy Shevchenko committed 4 years ago

Commit a80fed91 parent 41a18c41 file · +15 −7Browse files

Unified · Split

drivers/gpio/gpio-merrifield.c+15−7
@@ -220,10 +220,8 @@ static void mrfld_irq_ack(struct irq_data *d) · 219 unmodified lines
220220 raw_spin_unlock_irqrestore(&priv->lock, flags);
221221 }
222222
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)
224224 {
225− struct mrfld_gpio *priv = irq_data_get_irq_chip_data(d);
226− u32 gpio = irqd_to_hwirq(d);
227225 void __iomem *gimr = gpio_reg(&priv->chip, gpio, GIMR);
228226 unsigned long flags;
229227 u32 value;
@@ -241,12 +239,20 @@ static void mrfld_irq_unmask_mask(struct irq_data *d, bool unmask) · 11 unmodified lines
241239
242240 static void mrfld_irq_mask(struct irq_data *d)
243241 {
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);
245247 }
246248
247249 static void mrfld_irq_unmask(struct irq_data *d)
248250 {
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);
250256 }
251257
252258 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
329335 return 0;
330336 }
331337
332−static struct irq_chip mrfld_irqchip = {
338+static const struct irq_chip mrfld_irqchip = {
333339 .name = "gpio-merrifield",
334340 .irq_ack = mrfld_irq_ack,
335341 .irq_mask = mrfld_irq_mask,
336342 .irq_unmask = mrfld_irq_unmask,
337343 .irq_set_type = mrfld_irq_set_type,
338344 .irq_set_wake = mrfld_irq_set_wake,
345+ .flags = IRQCHIP_IMMUTABLE,
346+ GPIOCHIP_IRQ_RESOURCE_HELPERS,
339347 };
340348
341349 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
482490 return retval;
483491
484492 girq = &priv->chip.irq;
485− girq->chip = &mrfld_irqchip;
493+ gpio_irq_chip_set_chip(girq, &mrfld_irqchip);
486494 girq->init_hw = mrfld_irq_init_hw;
487495 girq->parent_handler = mrfld_irq_handler;
488496 girq->num_parents = 1;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t