palm_bk3710: fix resource management

The driver expected a *virtual* address in the IDE platform device's memory
resource and didn't request the memory region for the register block. Fix this
taking into account the fact that DaVinci SoC devices are fixed-mapped to the
virtual memory early and we can get their virtual addresses using IO_ADDRESS()
macro, not having to call ioremap()...

While at it, also do some cosmetic changes...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

authored by Sergei Shtylyov and committed by Bartlomiej Zolnierkiewicz ce42a549 9bedbcb2

+13 -9
+13 -9
drivers/ide/arm/palm_bk3710.c
··· 353 353 struct clk *clkp; 354 354 struct resource *mem, *irq; 355 355 ide_hwif_t *hwif; 356 - void __iomem *base; 357 - int pribase, i; 356 + unsigned long base; 357 + int i; 358 358 hw_regs_t hw; 359 359 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 360 360 ··· 374 374 printk(KERN_ERR "failed to get memory region resource\n"); 375 375 return -ENODEV; 376 376 } 377 + 377 378 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 378 379 if (irq == NULL) { 379 380 printk(KERN_ERR "failed to get IRQ resource\n"); 380 381 return -ENODEV; 381 382 } 382 383 383 - base = (void *)mem->start; 384 + if (request_mem_region(mem->start, mem->end - mem->start + 1, 385 + "palm_bk3710") == NULL) { 386 + printk(KERN_ERR "failed to request memory region\n"); 387 + return -EBUSY; 388 + } 389 + 390 + base = IO_ADDRESS(mem->start); 384 391 385 392 /* Configure the Palm Chip controller */ 386 - palm_bk3710_chipinit(base); 393 + palm_bk3710_chipinit((void __iomem *)base); 387 394 388 - pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET; 389 395 for (i = 0; i < IDE_NR_PORTS - 2; i++) 390 - hw.io_ports_array[i] = pribase + i; 391 - hw.io_ports.ctl_addr = mem->start + 392 - IDE_PALM_ATA_PRI_CTL_OFFSET; 396 + hw.io_ports_array[i] = base + IDE_PALM_ATA_PRI_REG_OFFSET + i; 397 + hw.io_ports.ctl_addr = base + IDE_PALM_ATA_PRI_CTL_OFFSET; 393 398 hw.irq = irq->start; 394 399 hw.chipset = ide_palm3710; 395 400 ··· 439 434 440 435 module_init(palm_bk3710_init); 441 436 MODULE_LICENSE("GPL"); 442 -