Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: sch: Switch to memory mapped IO accessors

Convert driver to use memory mapped IO accessors.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: William Breathitt Gray <wbg@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andy Shevchenko and committed by
Andy Shevchenko
abaed898 d8a26a18

+15 -10
+15 -10
drivers/gpio/gpio-sch.c
··· 38 38 39 39 struct sch_gpio { 40 40 struct gpio_chip chip; 41 + void __iomem *regs; 41 42 spinlock_t lock; 42 - unsigned short iobase; 43 43 unsigned short resume_base; 44 44 45 45 /* GPE handling */ ··· 75 75 offset = sch_gpio_offset(sch, gpio, reg); 76 76 bit = sch_gpio_bit(sch, gpio); 77 77 78 - reg_val = !!(inb(sch->iobase + offset) & BIT(bit)); 78 + reg_val = !!(ioread8(sch->regs + offset) & BIT(bit)); 79 79 80 80 return reg_val; 81 81 } ··· 89 89 offset = sch_gpio_offset(sch, gpio, reg); 90 90 bit = sch_gpio_bit(sch, gpio); 91 91 92 - reg_val = inb(sch->iobase + offset); 92 + reg_val = ioread8(sch->regs + offset); 93 93 94 94 if (val) 95 - outb(reg_val | BIT(bit), sch->iobase + offset); 95 + reg_val |= BIT(bit); 96 96 else 97 - outb((reg_val & ~BIT(bit)), sch->iobase + offset); 97 + reg_val &= ~BIT(bit); 98 + 99 + iowrite8(reg_val, sch->regs + offset); 98 100 } 99 101 100 102 static int sch_gpio_direction_in(struct gpio_chip *gc, unsigned int gpio_num) ··· 269 267 270 268 spin_lock_irqsave(&sch->lock, flags); 271 269 272 - core_status = inl(sch->iobase + CORE_BANK_OFFSET + GTS); 273 - resume_status = inl(sch->iobase + RESUME_BANK_OFFSET + GTS); 270 + core_status = ioread32(sch->regs + CORE_BANK_OFFSET + GTS); 271 + resume_status = ioread32(sch->regs + RESUME_BANK_OFFSET + GTS); 274 272 275 273 spin_unlock_irqrestore(&sch->lock, flags); 276 274 ··· 321 319 322 320 static int sch_gpio_probe(struct platform_device *pdev) 323 321 { 322 + struct device *dev = &pdev->dev; 324 323 struct gpio_irq_chip *girq; 325 324 struct sch_gpio *sch; 326 325 struct resource *res; 326 + void __iomem *regs; 327 327 int ret; 328 328 329 329 sch = devm_kzalloc(&pdev->dev, sizeof(*sch), GFP_KERNEL); ··· 336 332 if (!res) 337 333 return -EBUSY; 338 334 339 - if (!devm_request_region(&pdev->dev, res->start, resource_size(res), 340 - pdev->name)) 335 + regs = devm_ioport_map(dev, res->start, resource_size(res)); 336 + if (!regs) 341 337 return -EBUSY; 342 338 339 + sch->regs = regs; 340 + 343 341 spin_lock_init(&sch->lock); 344 - sch->iobase = res->start; 345 342 sch->chip = sch_gpio_chip; 346 343 sch->chip.label = dev_name(&pdev->dev); 347 344 sch->chip.parent = &pdev->dev;