aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/bast-flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps/bast-flash.c')
-rw-r--r--drivers/mtd/maps/bast-flash.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/mtd/maps/bast-flash.c b/drivers/mtd/maps/bast-flash.c
index bfe994e59265..b7858eb93534 100644
--- a/drivers/mtd/maps/bast-flash.c
+++ b/drivers/mtd/maps/bast-flash.c
@@ -9,7 +9,7 @@
9 * 20-Sep-2004 BJD Initial version 9 * 20-Sep-2004 BJD Initial version
10 * 17-Jan-2005 BJD Add whole device if no partitions found 10 * 17-Jan-2005 BJD Add whole device if no partitions found
11 * 11 *
12 * $Id: bast-flash.c,v 1.2 2005/01/18 11:13:47 bjd Exp $ 12 * $Id: bast-flash.c,v 1.5 2005/11/07 11:14:26 gleixner Exp $
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by 15 * it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@ static void bast_flash_setrw(int to)
75 75
76 local_irq_save(flags); 76 local_irq_save(flags);
77 val = __raw_readb(BAST_VA_CTRL3); 77 val = __raw_readb(BAST_VA_CTRL3);
78 78
79 if (to) 79 if (to)
80 val |= BAST_CPLD_CTRL3_ROMWEN; 80 val |= BAST_CPLD_CTRL3_ROMWEN;
81 else 81 else
@@ -93,7 +93,7 @@ static int bast_flash_remove(struct device *dev)
93 93
94 dev_set_drvdata(dev, NULL); 94 dev_set_drvdata(dev, NULL);
95 95
96 if (info == NULL) 96 if (info == NULL)
97 return 0; 97 return 0;
98 98
99 if (info->map.virt != NULL) 99 if (info->map.virt != NULL)
@@ -104,14 +104,13 @@ static int bast_flash_remove(struct device *dev)
104 map_destroy(info->mtd); 104 map_destroy(info->mtd);
105 } 105 }
106 106
107 if (info->partitions) 107 kfree(info->partitions);
108 kfree(info->partitions);
109 108
110 if (info->area) { 109 if (info->area) {
111 release_resource(info->area); 110 release_resource(info->area);
112 kfree(info->area); 111 kfree(info->area);
113 } 112 }
114 113
115 kfree(info); 114 kfree(info);
116 115
117 return 0; 116 return 0;
@@ -138,15 +137,15 @@ static int bast_flash_probe(struct device *dev)
138 137
139 info->map.phys = res->start; 138 info->map.phys = res->start;
140 info->map.size = res->end - res->start + 1; 139 info->map.size = res->end - res->start + 1;
141 info->map.name = dev->bus_id; 140 info->map.name = dev->bus_id;
142 info->map.bankwidth = 2; 141 info->map.bankwidth = 2;
143 142
144 if (info->map.size > AREA_MAXSIZE) 143 if (info->map.size > AREA_MAXSIZE)
145 info->map.size = AREA_MAXSIZE; 144 info->map.size = AREA_MAXSIZE;
146 145
147 pr_debug("%s: area %08lx, size %ld\n", __FUNCTION__, 146 pr_debug("%s: area %08lx, size %ld\n", __FUNCTION__,
148 info->map.phys, info->map.size); 147 info->map.phys, info->map.size);
149 148
150 info->area = request_mem_region(res->start, info->map.size, 149 info->area = request_mem_region(res->start, info->map.size,
151 pdev->name); 150 pdev->name);
152 if (info->area == NULL) { 151 if (info->area == NULL) {
@@ -163,7 +162,7 @@ static int bast_flash_probe(struct device *dev)
163 err = -EIO; 162 err = -EIO;
164 goto exit_error; 163 goto exit_error;
165 } 164 }
166 165
167 simple_map_init(&info->map); 166 simple_map_init(&info->map);
168 167
169 /* enable the write to the flash area */ 168 /* enable the write to the flash area */
@@ -188,7 +187,7 @@ static int bast_flash_probe(struct device *dev)
188 err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0); 187 err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0);
189 if (err > 0) { 188 if (err > 0) {
190 err = add_mtd_partitions(info->mtd, info->partitions, err); 189 err = add_mtd_partitions(info->mtd, info->partitions, err);
191 if (err) 190 if (err)
192 printk(KERN_ERR PFX "cannot add/parse partitions\n"); 191 printk(KERN_ERR PFX "cannot add/parse partitions\n");
193 } else { 192 } else {
194 err = add_mtd_device(info->mtd); 193 err = add_mtd_device(info->mtd);
@@ -206,6 +205,7 @@ static int bast_flash_probe(struct device *dev)
206 205
207static struct device_driver bast_flash_driver = { 206static struct device_driver bast_flash_driver = {
208 .name = "bast-nor", 207 .name = "bast-nor",
208 .owner = THIS_MODULE,
209 .bus = &platform_bus_type, 209 .bus = &platform_bus_type,
210 .probe = bast_flash_probe, 210 .probe = bast_flash_probe,
211 .remove = bast_flash_remove, 211 .remove = bast_flash_remove,