diff options
author | Richard Weinberger <richard@nod.at> | 2016-09-21 05:43:56 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2016-09-28 16:00:45 -0400 |
commit | 5e149073ba427f99c5e751e558670d034a278f77 (patch) | |
tree | d771a8c58a62f21ef378106b4cff4580a2e6f31b /drivers/mtd | |
parent | f6d7c1b5598b6407c3f1da795dd54acf99c1990c (diff) |
mtdpart: Propagate _get/put_device()
If the master device has callbacks for _get/put_device()
and this MTD has slaves a get_mtd_device() call on paritions
will never issue the registered callbacks.
Fix this by propagating _get/put_device() down.
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/mtdpart.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 1f13e32556f8..ec852fa9200f 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -317,6 +317,18 @@ static int part_block_markbad(struct mtd_info *mtd, loff_t ofs) | |||
317 | return res; | 317 | return res; |
318 | } | 318 | } |
319 | 319 | ||
320 | static int part_get_device(struct mtd_info *mtd) | ||
321 | { | ||
322 | struct mtd_part *part = mtd_to_part(mtd); | ||
323 | return part->master->_get_device(part->master); | ||
324 | } | ||
325 | |||
326 | static void part_put_device(struct mtd_info *mtd) | ||
327 | { | ||
328 | struct mtd_part *part = mtd_to_part(mtd); | ||
329 | part->master->_put_device(part->master); | ||
330 | } | ||
331 | |||
320 | static int part_ooblayout_ecc(struct mtd_info *mtd, int section, | 332 | static int part_ooblayout_ecc(struct mtd_info *mtd, int section, |
321 | struct mtd_oob_region *oobregion) | 333 | struct mtd_oob_region *oobregion) |
322 | { | 334 | { |
@@ -463,6 +475,12 @@ static struct mtd_part *allocate_partition(struct mtd_info *master, | |||
463 | slave->mtd._block_isbad = part_block_isbad; | 475 | slave->mtd._block_isbad = part_block_isbad; |
464 | if (master->_block_markbad) | 476 | if (master->_block_markbad) |
465 | slave->mtd._block_markbad = part_block_markbad; | 477 | slave->mtd._block_markbad = part_block_markbad; |
478 | |||
479 | if (master->_get_device) | ||
480 | slave->mtd._get_device = part_get_device; | ||
481 | if (master->_put_device) | ||
482 | slave->mtd._put_device = part_put_device; | ||
483 | |||
466 | slave->mtd._erase = part_erase; | 484 | slave->mtd._erase = part_erase; |
467 | slave->master = master; | 485 | slave->master = master; |
468 | slave->offset = part->offset; | 486 | slave->offset = part->offset; |