linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] palm_bk3710: fix resource management (take 2)
@ 2008-06-16 19:48 Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2008-06-16 19:48 UTC (permalink / raw)
  To: bzolnier; +Cc: linux-ide

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>

---
Argh! I have finally run checkpatch.pl and it detected some whitespace damage.
So, here's take 2 of that stupid patch...

 drivers/ide/arm/palm_bk3710.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

Index: linux-2.6/drivers/ide/arm/palm_bk3710.c
===================================================================
--- linux-2.6.orig/drivers/ide/arm/palm_bk3710.c
+++ linux-2.6/drivers/ide/arm/palm_bk3710.c
@@ -353,8 +353,8 @@ static int __devinit palm_bk3710_probe(s
 	struct clk *clkp;
 	struct resource *mem, *irq;
 	ide_hwif_t *hwif;
-	void __iomem *base;
-	int pribase, i;
+	unsigned long base;
+	int i;
 	hw_regs_t hw;
 	u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
@@ -374,22 +374,27 @@ static int __devinit palm_bk3710_probe(s
 		printk(KERN_ERR "failed to get memory region resource\n");
 		return -ENODEV;
 	}
+
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (irq == NULL) {
 		printk(KERN_ERR "failed to get IRQ resource\n");
 		return -ENODEV;
 	}
 
-	base = (void *)mem->start;
+	if (request_mem_region(mem->start, mem->end - mem->start + 1,
+			       "palm_bk3710") == NULL) {
+		printk(KERN_ERR "failed to request memory region\n");
+		return -EBUSY;
+	}
+
+	base = IO_ADDRESS(mem->start);
 
 	/* Configure the Palm Chip controller */
-	palm_bk3710_chipinit(base);
+	palm_bk3710_chipinit((void __iomem *)base);
 
-	pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET;
 	for (i = 0; i < IDE_NR_PORTS - 2; i++)
-		hw.io_ports_array[i] = pribase + i;
-	hw.io_ports.ctl_addr = mem->start +
-			IDE_PALM_ATA_PRI_CTL_OFFSET;
+ 		hw.io_ports_array[i] = base + IDE_PALM_ATA_PRI_REG_OFFSET + i;
+	hw.io_ports.ctl_addr = base + IDE_PALM_ATA_PRI_CTL_OFFSET;
 	hw.irq = irq->start;
 	hw.chipset = ide_palm3710;
 
@@ -434,4 +439,3 @@ static int __init palm_bk3710_init(void)
 
 module_init(palm_bk3710_init);
 MODULE_LICENSE("GPL");
-


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] palm_bk3710: fix resource management (take 2)
@ 2008-06-16 19:51 Sergei Shtylyov
  2008-06-16 20:10 ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2008-06-16 19:51 UTC (permalink / raw)
  To: bzolnier; +Cc: linux-ide

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>

---
Argh! I have finally run checkpatch.pl and it detected some whitespace damage.
And of course, I then re-sent it without fixing that!
So, here's take 2 of that stupid patch for real now. Sorry for the mess... :-<

 drivers/ide/arm/palm_bk3710.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

Index: linux-2.6/drivers/ide/arm/palm_bk3710.c
===================================================================
--- linux-2.6.orig/drivers/ide/arm/palm_bk3710.c
+++ linux-2.6/drivers/ide/arm/palm_bk3710.c
@@ -353,8 +353,8 @@ static int __devinit palm_bk3710_probe(s
 	struct clk *clkp;
 	struct resource *mem, *irq;
 	ide_hwif_t *hwif;
-	void __iomem *base;
-	int pribase, i;
+	unsigned long base;
+	int i;
 	hw_regs_t hw;
 	u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
@@ -374,22 +374,27 @@ static int __devinit palm_bk3710_probe(s
 		printk(KERN_ERR "failed to get memory region resource\n");
 		return -ENODEV;
 	}
+
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (irq == NULL) {
 		printk(KERN_ERR "failed to get IRQ resource\n");
 		return -ENODEV;
 	}
 
-	base = (void *)mem->start;
+	if (request_mem_region(mem->start, mem->end - mem->start + 1,
+			       "palm_bk3710") == NULL) {
+		printk(KERN_ERR "failed to request memory region\n");
+		return -EBUSY;
+	}
+
+	base = IO_ADDRESS(mem->start);
 
 	/* Configure the Palm Chip controller */
-	palm_bk3710_chipinit(base);
+	palm_bk3710_chipinit((void __iomem *)base);
 
-	pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET;
 	for (i = 0; i < IDE_NR_PORTS - 2; i++)
-		hw.io_ports_array[i] = pribase + i;
-	hw.io_ports.ctl_addr = mem->start +
-			IDE_PALM_ATA_PRI_CTL_OFFSET;
+		hw.io_ports_array[i] = base + IDE_PALM_ATA_PRI_REG_OFFSET + i;
+	hw.io_ports.ctl_addr = base + IDE_PALM_ATA_PRI_CTL_OFFSET;
 	hw.irq = irq->start;
 	hw.chipset = ide_palm3710;
 
@@ -434,4 +439,3 @@ static int __init palm_bk3710_init(void)
 
 module_init(palm_bk3710_init);
 MODULE_LICENSE("GPL");
-


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] palm_bk3710: fix resource management (take 2)
  2008-06-16 19:51 [PATCH] palm_bk3710: fix resource management (take 2) Sergei Shtylyov
@ 2008-06-16 20:10 ` Bartlomiej Zolnierkiewicz
  2008-06-16 22:35   ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-06-16 20:10 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-ide

On Monday 16 June 2008, Sergei Shtylyov wrote:
> 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>
> 
> ---
> Argh! I have finally run checkpatch.pl and it detected some whitespace damage.
> And of course, I then re-sent it without fixing that!
> So, here's take 2 of that stupid patch for real now. Sorry for the mess... :-<

I've already fixed it while applying "take 1" but I was too lazy to
mention it (not that single " " removal is worth mentioning)... :)

[ However please integrate checkpatch.pl into your workflow... ]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] palm_bk3710: fix resource management (take 2)
  2008-06-16 20:10 ` Bartlomiej Zolnierkiewicz
@ 2008-06-16 22:35   ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2008-06-16 22:35 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: linux-ide

Hello.

Bartlomiej Zolnierkiewicz wrote:
> On Monday 16 June 2008, Sergei Shtylyov wrote:
>   
>> 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>
>>
>> ---
>> Argh! I have finally run checkpatch.pl and it detected some whitespace damage.
>> And of course, I then re-sent it without fixing that!
>> So, here's take 2 of that stupid patch for real now. Sorry for the mess... :-<
>>     
>
> I've already fixed it while applying "take 1" but I was too lazy to
> mention it (not that single " " removal is worth mentioning)... :)
>   

   I do that kind of mistakes in reject resolution very rarely. This 
just wasn't my day it seems... :-)

> [ However please integrate checkpatch.pl into your workflow... ]
>
>   
   The forgotten signoff is surely my problem, so indeed I should... if 
I don't forget. ;-)

WBR. Sergei



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-16 22:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-16 19:51 [PATCH] palm_bk3710: fix resource management (take 2) Sergei Shtylyov
2008-06-16 20:10 ` Bartlomiej Zolnierkiewicz
2008-06-16 22:35   ` Sergei Shtylyov
  -- strict thread matches above, loose matches on Subject: below --
2008-06-16 19:48 Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).