Skip to contentSkip to conversation

Fix IXP4xx MTD driver no cast warning

PATCH In review Deepak Saxena 4 participants 6 messages Sep 29, 2005 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix IXP4xx MTD driver no cast warning

Fix following warning:

drivers/mtd/maps/ixp4xx.c: In function 'ixp4xx_flash_probe':
drivers/mtd/maps/ixp4xx.c:199: warning: assignment makes integer from pointer without a cast

drivers/mtd/maps/ixp4xx.c +1 -1
@@ -196,7 +196,7 @@ static int ixp4xx_flash_probe(struct dev
 		goto Error;
 	}
 
-	info->map.map_priv_1 = ioremap(dev->resource->start,
+	info->map.map_priv_1 = (unsigned long)ioremap(dev->resource->start,
 			    dev->resource->end - dev->resource->start + 1);
 	if (!info->map.map_priv_1) {
 		printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
Signature · 3 lines
Deepak Saxena - [email protected] - http://www.plexity.net

Even a stopped clock gives the right time twice a day.
#1 lore raw
Quoted 4 lines · Deepak Saxena

drivers/mtd/maps/ixp4xx.c: In function 'ixp4xx_flash_probe':
drivers/mtd/maps/ixp4xx.c:199: warning: assignment makes integer from pointer without a cast

Please don't. The warning is entirely warranted, as far as I can tell.

Shutting up warnings just because they are warnings is bad practice. Either fix them, or leave them be.

If you do an "ioremap()", then the result is a "(void __iomem *)". If you assign it to something that is "unsigned long", you _should_ get a warning.

Linus

#3 lore raw
In reply to Deepak Saxena
Quoted 12 lines · Deepak Saxena

Fix following warning:

drivers/mtd/maps/ixp4xx.c: In function 'ixp4xx_flash_probe':
drivers/mtd/maps/ixp4xx.c:199: warning: assignment makes integer from pointer without a cast

drivers/mtd/maps/ixp4xx.c static int ixp4xx_flash_probe(struct dev · line 199

Quoted 5 lines
drivers/mtd/maps/ixp4xx.c +1 -1
@@ -196,7 +196,7 @@ static int ixp4xx_flash_probe(struct dev
 		goto Error;
 	}
 
-	info->map.map_priv_1 = ioremap(dev->resource->start,
+	info->map.map_priv_1 = (unsigned long)ioremap(dev->resource->start,

Shouldn't this be using info->map.virt instead of the old map.map_priv_1 ?

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#4 lore raw

On Sep 29 2005, at 21:52, Russell King was caught saying:

Quoted 16 lines · Deepak Saxena
Quoted 15 lines

Fix following warning:

drivers/mtd/maps/ixp4xx.c: In function 'ixp4xx_flash_probe':
drivers/mtd/maps/ixp4xx.c:199: warning: assignment makes integer from pointer without a cast

drivers/mtd/maps/ixp4xx.c +0 -0
@@ -196,7 +196,7 @@ static int ixp4xx_flash_probe(struct dev
 		goto Error;
 	}
 
Quoted 4 lines

drivers/mtd/maps/ixp4xx.c static int ixp4xx_flash_probe(struct dev · line 199

Quoted 2 lines
drivers/mtd/maps/ixp4xx.c +1 -1
-	info->map.map_priv_1 = ioremap(dev->resource->start,
+	info->map.map_priv_1 = (unsigned long)ioremap(dev->resource->start,

Shouldn't this be using info->map.virt instead of the old map.map_priv_1 ?

I think when I wrote this, having a !0 value in map->virt would cause the mtd core to assume that the map driver supported point()ing and direct copy of data. Looking at the mtd code it looks like this assumption might have gone away...will change code.

~Deepak

Signature · 3 lines
Deepak Saxena - [email protected] - http://www.plexity.net

Even a stopped clock gives the right time twice a day.
#2 lore raw
In reply to Linus Torvalds
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · Deepak Saxena

drivers/mtd/maps/ixp4xx.c: In function 'ixp4xx_flash_probe':
drivers/mtd/maps/ixp4xx.c:199: warning: assignment makes integer from pointer without a cast

Quoted 8 lines

Please don't. The warning is entirely warranted, as far as I can tell.

Shutting up warnings just because they are warnings is bad practice. Either fix them, or leave them be.

If you do an "ioremap()", then the result is a "(void __iomem *)". If you assign it to something that is "unsigned long", you _should_ get a warning.

Code is correct, as far as this specific mapping driver is concerned. But it would make some sense to convert one of the map_priv_[12] in struct map_info to (void __iomem *).

Jörn

Signature · 2 lines
It does not matter how slowly you go, so long as you do not stop.
-- Confucius
#5 lore raw
In reply to Deepak Saxena
Quoted 22 lines · Deepak Saxena

On Sep 29 2005, at 21:52, Russell King was caught saying:

Quoted 16 lines · Deepak Saxena
Quoted 15 lines

Fix following warning:

drivers/mtd/maps/ixp4xx.c: In function 'ixp4xx_flash_probe':
drivers/mtd/maps/ixp4xx.c:199: warning: assignment makes integer from pointer without a cast

drivers/mtd/maps/ixp4xx.c +0 -0
@@ -196,7 +196,7 @@ static int ixp4xx_flash_probe(struct dev
 		goto Error;
 	}
 
Quoted 4 lines

drivers/mtd/maps/ixp4xx.c static int ixp4xx_flash_probe(struct dev · line 199

Quoted 2 lines
drivers/mtd/maps/ixp4xx.c +1 -1
-	info->map.map_priv_1 = ioremap(dev->resource->start,
+	info->map.map_priv_1 = (unsigned long)ioremap(dev->resource->start,

Shouldn't this be using info->map.virt instead of the old map.map_priv_1 ?

Quoted 4 lines

I think when I wrote this, having a !0 value in map->virt would cause the mtd core to assume that the map driver supported point()ing and direct copy of data. Looking at the mtd code it looks like this assumption might have gone away...will change code.

A check on this field is still used in cfi_intelext_point(), but you can disable the point stuff by setting map->phys to NO_XIP - as you already do.

Jörn

Signature · 2 lines
All art is but imitation of nature.
-- Lucius Annaeus Seneca