diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2013-11-13 15:59:25 +0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-01-03 11:22:19 -0800 |
commit | 4f0614a020524547d46e85ae5327f531e33cdf47 (patch) | |
tree | 5a7879b5bb859064889927bb04f28cd1f01ba8ef /drivers/mtd | |
parent | 3cb2c1ed4abe19d2881f74aa60c1a5b44524b2d0 (diff) | |
download | linux-4f0614a020524547d46e85ae5327f531e33cdf47.tar.bz2 |
mtd: nand: diskonchip: Request memory region prior ioremap()
This patch adds request_mem_region() prior ioremap() for diskonchip
driver. This will allow to check if memory region is occupied by any
other device, for example in case if we have memory region for several
optional devices and only one device can be used at once.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/diskonchip.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c index b68a4959f700..0afafa049ea1 100644 --- a/drivers/mtd/nand/diskonchip.c +++ b/drivers/mtd/nand/diskonchip.c @@ -1440,10 +1440,13 @@ static int __init doc_probe(unsigned long physadr) int reg, len, numchips; int ret = 0; + if (!request_mem_region(physadr, DOC_IOREMAP_LEN, NULL)) + return -EBUSY; virtadr = ioremap(physadr, DOC_IOREMAP_LEN); if (!virtadr) { printk(KERN_ERR "Diskonchip ioremap failed: 0x%x bytes at 0x%lx\n", DOC_IOREMAP_LEN, physadr); - return -EIO; + ret = -EIO; + goto error_ioremap; } /* It's not possible to cleanly detect the DiskOnChip - the @@ -1629,6 +1632,10 @@ static int __init doc_probe(unsigned long physadr) WriteDOC(save_control, virtadr, DOCControl); fail: iounmap(virtadr); + +error_ioremap: + release_mem_region(physadr, DOC_IOREMAP_LEN); + return ret; } @@ -1645,6 +1652,7 @@ static void release_nanddoc(void) nextmtd = doc->nextdoc; nand_release(mtd); iounmap(doc->virtadr); + release_mem_region(doc->physadr, DOC_IOREMAP_LEN); kfree(mtd); } } |