Commit 9090ed0b authored by David Vrabel's avatar David Vrabel Committed by Thomas Gleixner

[MTD] maps/ixp4xx: kill some warnings

- Use map.virt instead of map.map_priv_1 since it has the correct type.
- Use readw/writew instead of dereferencing an ioremap'd cookie.
- Remove an unused variable.
Signed-off-by: default avatarDavid Vrabel <dvrabel@arcom.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 87c146dc
/* /*
* $Id: ixp4xx.c,v 1.8 2005/09/08 10:32:20 dvrabel Exp $ * $Id: ixp4xx.c,v 1.11 2005/11/06 11:15:51 gleixner Exp $
* *
* drivers/mtd/maps/ixp4xx.c * drivers/mtd/maps/ixp4xx.c
* *
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs) static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
{ {
map_word val; map_word val;
val.x[0] = *(__u16 *) (map->map_priv_1 + ofs); val.x[0] = le16_to_cpu(readw(map->virt + ofs));
return val; return val;
} }
...@@ -59,17 +59,17 @@ static void ixp4xx_copy_from(struct map_info *map, void *to, ...@@ -59,17 +59,17 @@ static void ixp4xx_copy_from(struct map_info *map, void *to,
{ {
int i; int i;
u8 *dest = (u8 *) to; u8 *dest = (u8 *) to;
u16 *src = (u16 *) (map->map_priv_1 + from); void __iomem *src = map->virt + from;
u16 data; u16 data;
for (i = 0; i < (len / 2); i++) { for (i = 0; i < (len / 2); i++) {
data = src[i]; data = le16_to_cpu(readw(src + 2*i));
dest[i * 2] = BYTE0(data); dest[i * 2] = BYTE0(data);
dest[i * 2 + 1] = BYTE1(data); dest[i * 2 + 1] = BYTE1(data);
} }
if (len & 1) if (len & 1)
dest[len - 1] = BYTE0(src[i]); dest[len - 1] = BYTE0(le16_to_cpu(readw(src + 2*i)));
} }
/* /*
...@@ -79,7 +79,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to, ...@@ -79,7 +79,7 @@ static void ixp4xx_copy_from(struct map_info *map, void *to,
static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr)
{ {
if (!(adr & 1)) if (!(adr & 1))
*(__u16 *) (map->map_priv_1 + adr) = d.x[0]; writew(cpu_to_le16(d.x[0]), map->virt + adr);
} }
/* /*
...@@ -87,7 +87,7 @@ static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long ...@@ -87,7 +87,7 @@ static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long
*/ */
static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr)
{ {
*(__u16 *) (map->map_priv_1 + adr) = d.x[0]; writew(cpu_to_le16(d.x[0]), map->virt + adr);
} }
struct ixp4xx_flash_info { struct ixp4xx_flash_info {
...@@ -104,7 +104,6 @@ static int ixp4xx_flash_remove(struct device *_dev) ...@@ -104,7 +104,6 @@ static int ixp4xx_flash_remove(struct device *_dev)
struct platform_device *dev = to_platform_device(_dev); struct platform_device *dev = to_platform_device(_dev);
struct flash_platform_data *plat = dev->dev.platform_data; struct flash_platform_data *plat = dev->dev.platform_data;
struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev); struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev);
map_word d;
dev_set_drvdata(&dev->dev, NULL); dev_set_drvdata(&dev->dev, NULL);
...@@ -115,8 +114,8 @@ static int ixp4xx_flash_remove(struct device *_dev) ...@@ -115,8 +114,8 @@ static int ixp4xx_flash_remove(struct device *_dev)
del_mtd_partitions(info->mtd); del_mtd_partitions(info->mtd);
map_destroy(info->mtd); map_destroy(info->mtd);
} }
if (info->map.map_priv_1) if (info->map.virt)
iounmap((void *) info->map.map_priv_1); iounmap(info->map.virt);
if (info->partitions) if (info->partitions)
kfree(info->partitions); kfree(info->partitions);
...@@ -184,9 +183,9 @@ static int ixp4xx_flash_probe(struct device *_dev) ...@@ -184,9 +183,9 @@ static int ixp4xx_flash_probe(struct device *_dev)
goto Error; goto Error;
} }
info->map.map_priv_1 = ioremap(dev->resource->start, info->map.virt = ioremap(dev->resource->start,
dev->resource->end - dev->resource->start + 1); dev->resource->end - dev->resource->start + 1);
if (!info->map.map_priv_1) { if (!info->map.virt) {
printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n"); printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
err = -EIO; err = -EIO;
goto Error; goto Error;
...@@ -244,4 +243,3 @@ module_exit(ixp4xx_flash_exit); ...@@ -244,4 +243,3 @@ module_exit(ixp4xx_flash_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems"); MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems");
MODULE_AUTHOR("Deepak Saxena"); MODULE_AUTHOR("Deepak Saxena");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment