--- zzzz-none-000/linux-3.10.107/drivers/mfd/htc-egpio.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/mfd/htc-egpio.c 2021-02-04 17:41:59.000000000 +0000 @@ -98,7 +98,7 @@ .irq_unmask = egpio_unmask, }; -static void egpio_handler(unsigned int irq, struct irq_desc *desc) +static void egpio_handler(struct irq_desc *desc) { struct egpio_info *ei = irq_desc_get_handler_data(desc); int irqpin; @@ -261,7 +261,7 @@ static int __init egpio_probe(struct platform_device *pdev) { - struct htc_egpio_platform_data *pdata = pdev->dev.platform_data; + struct htc_egpio_platform_data *pdata = dev_get_platdata(&pdev->dev); struct resource *res; struct egpio_info *ei; struct gpio_chip *chip; @@ -270,7 +270,7 @@ int ret; /* Initialize ei data structure. */ - ei = kzalloc(sizeof(*ei), GFP_KERNEL); + ei = devm_kzalloc(&pdev->dev, sizeof(*ei), GFP_KERNEL); if (!ei) return -ENOMEM; @@ -286,7 +286,8 @@ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) goto fail; - ei->base_addr = ioremap_nocache(res->start, resource_size(res)); + ei->base_addr = devm_ioremap_nocache(&pdev->dev, res->start, + resource_size(res)); if (!ei->base_addr) goto fail; pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr); @@ -306,7 +307,9 @@ platform_set_drvdata(pdev, ei); ei->nchips = pdata->num_chips; - ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL); + ei->chip = devm_kzalloc(&pdev->dev, + sizeof(struct egpio_chip) * ei->nchips, + GFP_KERNEL); if (!ei->chip) { ret = -ENOMEM; goto fail; @@ -347,11 +350,11 @@ irq_set_chip_and_handler(irq, &egpio_muxed_chip, handle_simple_irq); irq_set_chip_data(irq, ei); - set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); + irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE); } irq_set_irq_type(ei->chained_irq, IRQ_TYPE_EDGE_RISING); - irq_set_handler_data(ei->chained_irq, ei); - irq_set_chained_handler(ei->chained_irq, egpio_handler); + irq_set_chained_handler_and_data(ei->chained_irq, + egpio_handler, ei); ack_irqs(ei); device_init_wakeup(&pdev->dev, 1); @@ -361,7 +364,6 @@ fail: printk(KERN_ERR "EGPIO failed to setup\n"); - kfree(ei); return ret; } @@ -374,14 +376,11 @@ irq_end = ei->irq_start + ei->nirqs; for (irq = ei->irq_start; irq < irq_end; irq++) { irq_set_chip_and_handler(irq, NULL, NULL); - set_irq_flags(irq, 0); + irq_set_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE); } irq_set_chained_handler(ei->chained_irq, NULL); device_init_wakeup(&pdev->dev, 0); } - iounmap(ei->base_addr); - kfree(ei->chip); - kfree(ei); return 0; }