--- zzzz-none-000/linux-3.10.107/drivers/gpio/gpio-pch.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/gpio/gpio-pch.c 2021-02-04 17:41:59.000000000 +0000 @@ -20,6 +20,7 @@ #include #include #include +#include #define PCH_EDGE_FALLING 0 #define PCH_EDGE_RISING BIT(0) @@ -138,9 +139,6 @@ unsigned long flags; spin_lock_irqsave(&chip->spinlock, flags); - pm = ioread32(&chip->reg->pm) & ((1 << gpio_pins[chip->ioh]) - 1); - pm |= (1 << nr); - iowrite32(pm, &chip->reg->pm); reg_val = ioread32(&chip->reg->po); if (val) @@ -148,6 +146,11 @@ else reg_val &= ~(1 << nr); iowrite32(reg_val, &chip->reg->po); + + pm = ioread32(&chip->reg->pm) & ((1 << gpio_pins[chip->ioh]) - 1); + pm |= (1 << nr); + iowrite32(pm, &chip->reg->pm); + spin_unlock_irqrestore(&chip->spinlock, flags); return 0; @@ -168,6 +171,7 @@ return 0; } +#ifdef CONFIG_PM /* * Save register configuration and disable interrupts. */ @@ -203,6 +207,7 @@ iowrite32(chip->pch_gpio_reg.gpio_use_sel_reg, &chip->reg->gpio_use_sel); } +#endif static int pch_gpio_to_irq(struct gpio_chip *gpio, unsigned offset) { @@ -224,7 +229,7 @@ gpio->dbg_show = NULL; gpio->base = -1; gpio->ngpio = gpio_pins[chip->ioh]; - gpio->can_sleep = 0; + gpio->can_sleep = false; gpio->to_irq = pch_gpio_to_irq; } @@ -276,9 +281,9 @@ /* And the handler */ if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) - __irq_set_handler_locked(d->irq, handle_level_irq); + irq_set_handler_locked(d, handle_level_irq); else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) - __irq_set_handler_locked(d->irq, handle_edge_irq); + irq_set_handler_locked(d, handle_edge_irq); unlock: spin_unlock_irqrestore(&chip->spinlock, flags); @@ -423,9 +428,7 @@ err_request_irq: irq_free_descs(irq_base, gpio_pins[chip->ioh]); - - if (gpiochip_remove(&chip->gpio)) - dev_err(&pdev->dev, "%s gpiochip_remove failed\n", __func__); + gpiochip_remove(&chip->gpio); err_gpiochip_add: pci_iounmap(pdev, chip->base); @@ -444,7 +447,6 @@ static void pch_gpio_remove(struct pci_dev *pdev) { - int err; struct pch_gpio *chip = pci_get_drvdata(pdev); if (chip->irq_base != -1) { @@ -453,10 +455,7 @@ irq_free_descs(chip->irq_base, gpio_pins[chip->ioh]); } - err = gpiochip_remove(&chip->gpio); - if (err) - dev_err(&pdev->dev, "Failed gpiochip_remove\n"); - + gpiochip_remove(&chip->gpio); pci_iounmap(pdev, chip->base); pci_release_regions(pdev); pci_disable_device(pdev); @@ -518,7 +517,7 @@ #endif #define PCI_VENDOR_ID_ROHM 0x10DB -static DEFINE_PCI_DEVICE_TABLE(pch_gpio_pcidev_id) = { +static const struct pci_device_id pch_gpio_pcidev_id[] = { { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8803) }, { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8014) }, { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8043) },