diff options
Diffstat (limited to 'drivers/mtd/maps/ixp4xx.c')
-rw-r--r-- | drivers/mtd/maps/ixp4xx.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 10debfea81e7..d6b2451eab1d 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/err.h> | ||
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/types.h> | 18 | #include <linux/types.h> |
18 | #include <linux/init.h> | 19 | #include <linux/init.h> |
@@ -162,13 +163,6 @@ static int ixp4xx_flash_remove(struct platform_device *dev) | |||
162 | mtd_device_unregister(info->mtd); | 163 | mtd_device_unregister(info->mtd); |
163 | map_destroy(info->mtd); | 164 | map_destroy(info->mtd); |
164 | } | 165 | } |
165 | if (info->map.virt) | ||
166 | iounmap(info->map.virt); | ||
167 | |||
168 | if (info->res) { | ||
169 | release_resource(info->res); | ||
170 | kfree(info->res); | ||
171 | } | ||
172 | 166 | ||
173 | if (plat->exit) | 167 | if (plat->exit) |
174 | plat->exit(); | 168 | plat->exit(); |
@@ -194,7 +188,8 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
194 | return err; | 188 | return err; |
195 | } | 189 | } |
196 | 190 | ||
197 | info = kzalloc(sizeof(struct ixp4xx_flash_info), GFP_KERNEL); | 191 | info = devm_kzalloc(&dev->dev, sizeof(struct ixp4xx_flash_info), |
192 | GFP_KERNEL); | ||
198 | if(!info) { | 193 | if(!info) { |
199 | err = -ENOMEM; | 194 | err = -ENOMEM; |
200 | goto Error; | 195 | goto Error; |
@@ -220,20 +215,9 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
220 | info->map.write = ixp4xx_probe_write16; | 215 | info->map.write = ixp4xx_probe_write16; |
221 | info->map.copy_from = ixp4xx_copy_from; | 216 | info->map.copy_from = ixp4xx_copy_from; |
222 | 217 | ||
223 | info->res = request_mem_region(dev->resource->start, | 218 | info->map.virt = devm_ioremap_resource(&dev->dev, dev->resource); |
224 | resource_size(dev->resource), | 219 | if (IS_ERR(info->map.virt)) { |
225 | "IXP4XXFlash"); | 220 | err = PTR_ERR(info->map.virt); |
226 | if (!info->res) { | ||
227 | printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n"); | ||
228 | err = -ENOMEM; | ||
229 | goto Error; | ||
230 | } | ||
231 | |||
232 | info->map.virt = ioremap(dev->resource->start, | ||
233 | resource_size(dev->resource)); | ||
234 | if (!info->map.virt) { | ||
235 | printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n"); | ||
236 | err = -EIO; | ||
237 | goto Error; | 221 | goto Error; |
238 | } | 222 | } |
239 | 223 | ||