mtd/drivers/mtd/maps ixp4xx.c,1.9,1.10

dvrabel at infradead.org dvrabel at infradead.org
Tue Nov 1 11:46:19 EST 2005


Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv21449

Modified Files:
	ixp4xx.c 
Log Message:
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: David Vrabel <dvrabel at arcom.com>


Index: ixp4xx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ixp4xx.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ixp4xx.c	29 Sep 2005 07:59:05 -0000	1.9
+++ ixp4xx.c	1 Nov 2005 16:46:15 -0000	1.10
@@ -42,7 +42,7 @@
 static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
 {
 	map_word val;
-	val.x[0] = *(__u16 *) (map->map_priv_1 + ofs);
+	val.x[0] = le16_to_cpu(readw(map->virt + ofs));
 	return val;
 }
 
@@ -56,17 +56,17 @@
 {
 	int i;
 	u8 *dest = (u8 *) to;
-	u16 *src = (u16 *) (map->map_priv_1 + from);
+	void __iomem *src = map->virt + from;
 	u16 data;
 
 	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 + 1] = BYTE1(data);
 	}
 
 	if (len & 1)
-		dest[len - 1] = BYTE0(src[i]);
+		dest[len - 1] = BYTE0(le16_to_cpu(readw(src + 2*i)));
 }
 
 /* 
@@ -76,7 +76,7 @@
 static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr)
 {
 	if (!(adr & 1))
-	       *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
+		writew(cpu_to_le16(d.x[0]), map->virt + adr);
 }
 
 /* 
@@ -84,7 +84,7 @@
  */
 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 {
@@ -101,7 +101,6 @@
 	struct platform_device *dev = to_platform_device(_dev);
 	struct flash_platform_data *plat = dev->dev.platform_data;
 	struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev);
-	map_word d;
 
 	dev_set_drvdata(&dev->dev, NULL);
 
@@ -112,8 +111,8 @@
 		del_mtd_partitions(info->mtd);
 		map_destroy(info->mtd);
 	}
-	if (info->map.map_priv_1)
-		iounmap((void *) info->map.map_priv_1);
+	if (info->map.virt)
+		iounmap(info->map.virt);
 
 	if (info->partitions)
 		kfree(info->partitions);
@@ -181,9 +180,9 @@
 		goto Error;
 	}
 
-	info->map.map_priv_1 = ioremap(dev->resource->start,
-			    dev->resource->end - dev->resource->start + 1);
-	if (!info->map.map_priv_1) {
+	info->map.virt = ioremap(dev->resource->start,
+				 dev->resource->end - dev->resource->start + 1);
+	if (!info->map.virt) {
 		printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
 		err = -EIO;
 		goto Error;





More information about the linux-mtd-cvs mailing list