mtd/drivers/mtd/maps ichxrom.c,1.11,1.12

ebiederman at lnxi.com ebiederman at lnxi.com
Fri Sep 17 02:29:17 EDT 2004


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

Modified Files:
	ichxrom.c 
Log Message:
- clean up the iomem changes. 
- Improve the error handling slightly.


Index: ichxrom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ichxrom.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ichxrom.c	16 Sep 2004 23:27:13 -0000	1.11
+++ ichxrom.c	17 Sep 2004 06:29:14 -0000	1.12
@@ -34,7 +34,7 @@
 #define FWH_SEL2	0xEE
 
 struct ichxrom_window {
-	void * virt;
+	void __iomem* virt;
 	unsigned long phys;
 	unsigned long size;
 	struct list_head maps;
@@ -89,7 +89,7 @@
 {
 	static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL };
 	struct ichxrom_window *window = &ichxrom_window;
-	struct ichxrom_map_info *map;
+	struct ichxrom_map_info *map = 0;
 	unsigned long map_top;
 	u8 byte;
 	u16 word;
@@ -149,7 +149,7 @@
 
 	if (window->phys == 0) {
 		printk(KERN_ERR MOD_NAME ": Rom window is closed\n");
-		goto failed;
+		goto out;
 	}
 	window->phys -= 0x400000UL;
 	window->size = (0xffffffffUL - window->phys) + 1UL;
@@ -161,7 +161,7 @@
 		 * this device, so don't even try.
 		 */
 		printk(KERN_ERR MOD_NAME ": firmware access control, I can't enable writes\n");
-		goto failed;
+		goto out;
 	}
 	pci_write_config_word(pdev, BIOS_CNTL, word | 1);
 
@@ -187,7 +187,7 @@
 	if (!window->virt) {
 		printk(KERN_ERR MOD_NAME ": ioremap(%08lx, %08lx) failed\n",
 			window->phys, window->size);
-		goto failed;
+		goto out;
 	}
 
 	/* Get the first address to look for an rom chip at */
@@ -206,7 +206,6 @@
 #endif
 
 	/* Loop through and look for a rom chips */
-	map = 0;
 	while((map_top - 1) < 0xffffffffUL) {
 		struct cfi_private *cfi;
 		unsigned long offset;
@@ -217,14 +216,15 @@
 		}
 		if (!map) {
 			printk(KERN_ERR MOD_NAME ": kmalloc failed");
-			goto failed;
+			goto out;
 		}
 		memset(map, 0, sizeof(*map));
 		INIT_LIST_HEAD(&map->list);
 		map->map.name = map->map_name;
 		map->map.phys = map_top;
 		offset = map_top - window->phys;
-		map->map.virt = ((void __iomem *)(window->virt)) + offset;
+		map->map.virt = (void __iomem *)
+			(((unsigned long)(window->virt)) + offset);
 		map->map.size = 0xffffffffUL - map_top + 1UL;
 		/* Set the name of the map to the address I am trying */
 		sprintf(map->map_name, "%s @%08lx",
@@ -281,7 +281,7 @@
 		}
 
 		/* Make the whole region visible in the map */
-		map->map.virt = (void __iomem *)(window->virt);
+		map->map.virt = window->virt;
 		map->map.phys = window->phys;
 		cfi = map->map.fldrv_priv;
 		for(i = 0; i < cfi->numchips; i++) {
@@ -301,16 +301,17 @@
 		map = 0;
 	}
 
+ out:
 	/* Free any left over map structures */
 	if (map) {
 		kfree(map);
 	}
-
+	if (list_empty(&window->maps)) {
+		ichxrom_cleanup(window);
+		return -ENODEV;
+	}
 	return 0;
 
- failed:
-	ichxrom_cleanup(window);
-	return -ENODEV;
 }
 
 





More information about the linux-mtd-cvs mailing list