aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdcore.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-02-08 08:13:26 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-03-26 19:32:11 -0400
commit0dd5235f51fb0eb0b8cef3fed35be39b8a06d7bd (patch)
treec828429698c28367a5f5804ce1c3f0972af83ff4 /drivers/mtd/mtdcore.c
parentc3faac4a74c2126e2b68f39d6e8791e88b5f7dbe (diff)
mtd: harmonize mtd_point interface implementation
Some MTD drivers return -EINVAL if the 'phys' parameter is not NULL, trying to convey that they cannot return the physical address. However, this is not very logical because they still can return the virtual address ('virt'). But some drivers (lpddr) just ignore the 'phys' parameter instead, which is a more logical thing to do. Let's harmonize this and: 1. Always initialize 'virt' and 'phys' to 'NULL' in 'mtd_point()'. 2. Do not return an error if the physical address cannot be found. So as a result, all drivers will set 'phys' to 'NULL' if it is not supported. None of the 'mtd_point()' users use 'phys' anyway, so this should not break anything. I guess we could also just delete this parameter later. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdcore.c')
-rw-r--r--drivers/mtd/mtdcore.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index ead52b388492..b20346e9fecb 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -706,6 +706,9 @@ int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
706 void **virt, resource_size_t *phys) 706 void **virt, resource_size_t *phys)
707{ 707{
708 *retlen = 0; 708 *retlen = 0;
709 *virt = NULL;
710 if (phys)
711 *phys = 0;
709 if (!mtd->_point) 712 if (!mtd->_point)
710 return -EOPNOTSUPP; 713 return -EOPNOTSUPP;
711 if (from < 0 || from > mtd->size || len > mtd->size - from) 714 if (from < 0 || from > mtd->size || len > mtd->size - from)