aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-13 14:33:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-13 14:33:09 -0400
commit9ff00d58a915b6747ba2e843ab2d04c712b4dc32 (patch)
tree3c4bed740dae7b6115b89387d766962d6dad7cd6 /drivers/mtd
parent36be50515fe2aef61533b516fa2576a2c7fe7664 (diff)
parentb027274d2e3a332683b73f15e5cea79c240bc9a3 (diff)
Merge tag 'for-linus-3.4-20120513' of git://git.infradead.org/linux-mtd
Pull three MTD fixes from David Woodhouse: - Fix a lock ordering deadlock in JFFS2 - Fix an oops in the dataflash driver, triggered by a dummy call to test whether it has OTP functionality. - Fix request_mem_region() failure on amsdelta NAND driver. * tag 'for-linus-3.4-20120513' of git://git.infradead.org/linux-mtd: mtd: ams-delta: fix request_mem_region() failure jffs2: Fix lock acquisition order bug in gc path mtd: fix oops in dataflash driver
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/mtdchar.c2
-rw-r--r--drivers/mtd/nand/ams-delta.c17
2 files changed, 7 insertions, 12 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 58fc65f5c817..f2f482bec573 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -376,7 +376,7 @@ static int otp_select_filemode(struct mtd_file_info *mfi, int mode)
376 * Make a fake call to mtd_read_fact_prot_reg() to check if OTP 376 * Make a fake call to mtd_read_fact_prot_reg() to check if OTP
377 * operations are supported. 377 * operations are supported.
378 */ 378 */
379 if (mtd_read_fact_prot_reg(mtd, -1, -1, &retlen, NULL) == -EOPNOTSUPP) 379 if (mtd_read_fact_prot_reg(mtd, -1, 0, &retlen, NULL) == -EOPNOTSUPP)
380 return -EOPNOTSUPP; 380 return -EOPNOTSUPP;
381 381
382 switch (mode) { 382 switch (mode) {
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 73416951f4c1..861ca8f7e47d 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -212,18 +212,17 @@ static int __devinit ams_delta_init(struct platform_device *pdev)
212 /* Link the private data with the MTD structure */ 212 /* Link the private data with the MTD structure */
213 ams_delta_mtd->priv = this; 213 ams_delta_mtd->priv = this;
214 214
215 if (!request_mem_region(res->start, resource_size(res), 215 /*
216 dev_name(&pdev->dev))) { 216 * Don't try to request the memory region from here,
217 dev_err(&pdev->dev, "request_mem_region failed\n"); 217 * it should have been already requested from the
218 err = -EBUSY; 218 * gpio-omap driver and requesting it again would fail.
219 goto out_free; 219 */
220 }
221 220
222 io_base = ioremap(res->start, resource_size(res)); 221 io_base = ioremap(res->start, resource_size(res));
223 if (io_base == NULL) { 222 if (io_base == NULL) {
224 dev_err(&pdev->dev, "ioremap failed\n"); 223 dev_err(&pdev->dev, "ioremap failed\n");
225 err = -EIO; 224 err = -EIO;
226 goto out_release_io; 225 goto out_free;
227 } 226 }
228 227
229 this->priv = io_base; 228 this->priv = io_base;
@@ -271,8 +270,6 @@ out_gpio:
271 platform_set_drvdata(pdev, NULL); 270 platform_set_drvdata(pdev, NULL);
272 gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); 271 gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
273 iounmap(io_base); 272 iounmap(io_base);
274out_release_io:
275 release_mem_region(res->start, resource_size(res));
276out_free: 273out_free:
277 kfree(ams_delta_mtd); 274 kfree(ams_delta_mtd);
278 out: 275 out:
@@ -285,7 +282,6 @@ out_free:
285static int __devexit ams_delta_cleanup(struct platform_device *pdev) 282static int __devexit ams_delta_cleanup(struct platform_device *pdev)
286{ 283{
287 void __iomem *io_base = platform_get_drvdata(pdev); 284 void __iomem *io_base = platform_get_drvdata(pdev);
288 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
289 285
290 /* Release resources, unregister device */ 286 /* Release resources, unregister device */
291 nand_release(ams_delta_mtd); 287 nand_release(ams_delta_mtd);
@@ -293,7 +289,6 @@ static int __devexit ams_delta_cleanup(struct platform_device *pdev)
293 gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio)); 289 gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio));
294 gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB); 290 gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
295 iounmap(io_base); 291 iounmap(io_base);
296 release_mem_region(res->start, resource_size(res));
297 292
298 /* Free the MTD device structure */ 293 /* Free the MTD device structure */
299 kfree(ams_delta_mtd); 294 kfree(ams_delta_mtd);