Skip to contentSkip to conversation

IDE: palm_bk3710: use ioremap instead of arch-specific IO_ADDRESS()

PATCH Superseded Kevin Hilman 2 participants 5 messages Jan 29, 2009 – Jan 30, 2009 libata

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IDE: palm_bk3710: use ioremap instead of arch-specific IO_ADDRESS()

Cc Sergei Shtylyov <[email protected]>
---
 drivers/ide/palm_bk3710.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/ide/palm_bk3710.c +5 -1
index f38aac7..be9c904 100644
@@ -380,7 +380,11 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 
-	base = IO_ADDRESS(mem->start);
+	base = ioremap(mem->start, mem->end);
+	if (!base) {
+		printk(KERN_ERR "failed to map IO memory\n");
+		return -ENOMEM;
+	}
 
 	/* Configure the Palm Chip controller */
 	palm_bk3710_chipinit(base);
Signature · 1 line
1.6.1
#1 lore raw

Hello.

Quoted 2 lines · Kevin Hilman

Sorry, NAK.

Quoted 5 lines
drivers/ide/palm_bk3710.c +0 -0
index f38aac7..be9c904 100644

drivers/ide/palm_bk3710.c static int __init palm_bk3710_probe(struct platform_device *pdev) · line 387

Quoted 9 lines
drivers/ide/palm_bk3710.c +4 -1
@@ -380,7 +380,11 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 
-	base = IO_ADDRESS(mem->start);
+	base = ioremap(mem->start, mem->end);
+	if (!base) {
+		printk(KERN_ERR "failed to map IO memory\n");
+		return -ENOMEM;
 

Leaks requested memory region.

MBR, Sergei

#2 lore raw
Quoted 9 lines · Sergei Shtylyov

Hello.

Quoted 2 lines · Kevin Hilman

Sorry, NAK.

Quoted 16 lines

drivers/ide/palm_bk3710.c static int __init palm_bk3710_probe(struct platform_device *pdev) · line 387

Quoted 13 lines
drivers/ide/palm_bk3710.c +4 -0
index f38aac7..be9c904 100644
@@ -380,7 +380,11 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 -	base = IO_ADDRESS(mem->start);
+	base = ioremap(mem->start, mem->end);
+	if (!base) {
+		printk(KERN_ERR "failed to map IO memory\n");
+		return -ENOMEM;
 

Leaks requested memory region.

Where would you suggest putting the iounmap? If the driver had a remove hook, I would've put it there.

Which brings up a bigger question, why isn't there a remove hook. I vaguely remember there being some problem way back in the 2.6.18 time frame that wouldn't allow this driver to be removed. Is that still a problem in newer kernels?

Kevin

#3 lore raw

Hello.

Quoted 26 lines · Kevin Hilman
Quoted 11 lines

Hello.

Quoted 3 lines · Kevin Hilman

Sorry, NAK.

Quoted 15 lines
Quoted 5 lines
drivers/ide/palm_bk3710.c +0 -0
index f38aac7..be9c904 100644

drivers/ide/palm_bk3710.c static int __init palm_bk3710_probe(struct platform_device *pdev) · line 388

Quoted 9 lines
drivers/ide/palm_bk3710.c +4 -0
@@ -380,7 +380,11 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 -	base = IO_ADDRESS(mem->start);
+	base = ioremap(mem->start, mem->end);
+	if (!base) {
+		printk(KERN_ERR "failed to map IO memory\n");
+		return -ENOMEM;
 
 

Leaks requested memory region.

Quoted 1 line

Where would you suggest putting the iounmap?

You misunderstood -- you don't call release_mem_region() on the error
path.

Quoted 3 lines

Which brings up a bigger question, why isn't there a remove hook. I vaguely remember there being some problem way back in the 2.6.18 time frame that wouldn't allow this driver to be removed.

The IDE drivers were generally undremovable back then.

Quoted 2 lines

Is that still a problem in newer kernels?

No, shouldn't be -- they've been made removable since.

Quoted 1 line

Kevin

MBR, Sergei

#4 lore raw
Quoted 28 lines · Sergei Shtylyov

Hello.

Quoted 24 lines · Kevin Hilman
Quoted 24 lines

Hello.

Quoted 2 lines · Kevin Hilman

Sorry, NAK.

drivers/ide/palm_bk3710.c static int __init palm_bk3710_probe(struct platform_device *pdev) · line 387

Quoted 13 lines
drivers/ide/palm_bk3710.c +4 -0
index f38aac7..be9c904 100644
@@ -380,7 +380,11 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 -	base = IO_ADDRESS(mem->start);
+	base = ioremap(mem->start, mem->end);
+	if (!base) {
+		printk(KERN_ERR "failed to map IO memory\n");
+		return -ENOMEM;
 

Leaks requested memory region.

Quoted 4 lines
Quoted 1 line

Where would you suggest putting the iounmap?

You misunderstood -- you don't call release_mem_region() on the
error path.

Ah, I see. Good catch. I also noticed ioremap() takes 'size' and not 'end' so that needs to be fixed too. Will resend.

Kevin

Quoted 14 lines
Quoted 3 lines

Which brings up a bigger question, why isn't there a remove hook. I vaguely remember there being some problem way back in the 2.6.18 time frame that wouldn't allow this driver to be removed.

The IDE drivers were generally undremovable back then.

Quoted 2 lines

Is that still a problem in newer kernels?

No, shouldn't be -- they've been made removable since.

Quoted 1 line

Kevin

MBR, Sergei