Commit 0dd5235f51fb0eb0b8cef3fed35be39b8a06d7bd
Committed by
David Woodhouse
1 parent
c3faac4a74
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 5 changed files with 3 additions and 14 deletions Side-by-side Diff
drivers/mtd/devices/mtdram.c
... | ... | @@ -43,9 +43,6 @@ |
43 | 43 | static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, |
44 | 44 | size_t *retlen, void **virt, resource_size_t *phys) |
45 | 45 | { |
46 | - /* can we return a physical address with this driver? */ | |
47 | - if (phys) | |
48 | - return -EINVAL; | |
49 | 46 | *virt = mtd->priv + from; |
50 | 47 | *retlen = len; |
51 | 48 | return 0; |
drivers/mtd/devices/phram.c
... | ... | @@ -51,10 +51,6 @@ |
51 | 51 | static int phram_point(struct mtd_info *mtd, loff_t from, size_t len, |
52 | 52 | size_t *retlen, void **virt, resource_size_t *phys) |
53 | 53 | { |
54 | - /* can we return a physical address with this driver? */ | |
55 | - if (phys) | |
56 | - return -EINVAL; | |
57 | - | |
58 | 54 | *virt = mtd->priv + from; |
59 | 55 | *retlen = len; |
60 | 56 | return 0; |
drivers/mtd/devices/pmc551.c
... | ... | @@ -205,10 +205,6 @@ |
205 | 205 | printk(KERN_DEBUG "pmc551_point(%ld, %ld)\n", (long)from, (long)len); |
206 | 206 | #endif |
207 | 207 | |
208 | - /* can we return a physical address with this driver? */ | |
209 | - if (phys) | |
210 | - return -EINVAL; | |
211 | - | |
212 | 208 | soff_hi = from & ~(priv->asize - 1); |
213 | 209 | soff_lo = from & (priv->asize - 1); |
214 | 210 |
drivers/mtd/devices/slram.c
drivers/mtd/mtdcore.c