aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdpart.c
diff options
context:
space:
mode:
authorRichard Cochran <richardcochran@gmail.com>2010-06-14 12:10:33 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-08-02 04:03:41 -0400
commit9938424f0c4d208883cbf32083ec2bfcc220f85b (patch)
treee4f7581c7543673fe63c98f9804e934a77aeb7ef /drivers/mtd/mtdpart.c
parent1df620637fc3b252b69c92ced486b5b6b643dd1a (diff)
mtd: add an ioctl to query the lock status of a flash sector
This patchs adds a way for user space programs to find out whether a flash sector is locked. An optional driver method in the mtd_info struct provides the information. Signed-off-by: Richard Cochran <richard.cochran@omicron.at> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r--drivers/mtd/mtdpart.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index b8043a9ba32d..4c539ded0b70 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -264,6 +264,14 @@ static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
264 return part->master->unlock(part->master, ofs + part->offset, len); 264 return part->master->unlock(part->master, ofs + part->offset, len);
265} 265}
266 266
267static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
268{
269 struct mtd_part *part = PART(mtd);
270 if ((len + ofs) > mtd->size)
271 return -EINVAL;
272 return part->master->is_locked(part->master, ofs + part->offset, len);
273}
274
267static void part_sync(struct mtd_info *mtd) 275static void part_sync(struct mtd_info *mtd)
268{ 276{
269 struct mtd_part *part = PART(mtd); 277 struct mtd_part *part = PART(mtd);
@@ -402,6 +410,8 @@ static struct mtd_part *add_one_partition(struct mtd_info *master,
402 slave->mtd.lock = part_lock; 410 slave->mtd.lock = part_lock;
403 if (master->unlock) 411 if (master->unlock)
404 slave->mtd.unlock = part_unlock; 412 slave->mtd.unlock = part_unlock;
413 if (master->is_locked)
414 slave->mtd.is_locked = part_is_locked;
405 if (master->block_isbad) 415 if (master->block_isbad)
406 slave->mtd.block_isbad = part_block_isbad; 416 slave->mtd.block_isbad = part_block_isbad;
407 if (master->block_markbad) 417 if (master->block_markbad)