From: Andy Shevchenko Date: Wed, 22 May 2013 10:20:11 +0000 (+0300) Subject: gpio-langwell: do not use direct access to iomapped memory X-Git-Tag: firefly_0821_release~176^2~5800^2~24 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=64c8cbc17c8d4af3b600c66247e47eac99e46aaf;p=firefly-linux-kernel-4.4.55.git gpio-langwell: do not use direct access to iomapped memory We better to use readl() function instead of bad looking direct access. Signed-off-by: Andy Shevchenko Acked-by: Mika Westerberg Acked-by: David Cohen Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c index a0190de14371..fff661126dc7 100644 --- a/drivers/gpio/gpio-langwell.c +++ b/drivers/gpio/gpio-langwell.c @@ -65,7 +65,7 @@ enum GPIO_REG { struct lnw_gpio { struct gpio_chip chip; - void *reg_base; + void __iomem *reg_base; spinlock_t lock; struct pci_dev *pdev; struct irq_domain *domain; @@ -318,9 +318,9 @@ static const struct dev_pm_ops lnw_gpio_pm_ops = { }; static int lnw_gpio_probe(struct pci_dev *pdev, - const struct pci_device_id *id) + const struct pci_device_id *id) { - void *base; + void __iomem *base; resource_size_t start, len; struct lnw_gpio *lnw; u32 gpio_base; @@ -346,8 +346,10 @@ static int lnw_gpio_probe(struct pci_dev *pdev, retval = -EFAULT; goto err_ioremap; } - irq_base = *(u32 *)base; - gpio_base = *((u32 *)base + 1); + + irq_base = readl(base); + gpio_base = readl(sizeof(u32) + base); + /* release the IO mapping, since we already get the info from bar1 */ iounmap(base); /* get the register base from bar0 */