aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/lpddr
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-02-03 06:20:43 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-03-26 19:27:19 -0400
commit5e4e6e3fdf48c1b012e2b6e80ed1d7e99d4fa6d1 (patch)
treedade127061f6c466f4146152572cc17c05d44761 /drivers/mtd/lpddr
parente2414f4c20bd4dc62186fbfd7bdec50bce6d2ead (diff)
mtd: return error code from mtd_unpoint
The 'mtd_unpoint()' API function should be able to return an error code because it may fail if you specify incorrect offset. This patch changes this MTD API function and amends all the drivers correspondingly. Also return '-EOPNOTSUPP' from 'mtd_unpoint()' when the '->unpoint()' method is undefined. We do not really need this currently, but this just makes sense to be consistent with 'mtd_point()'. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/lpddr')
-rw-r--r--drivers/mtd/lpddr/lpddr_cmds.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/mtd/lpddr/lpddr_cmds.c b/drivers/mtd/lpddr/lpddr_cmds.c
index fd19d3b1ee90..de960b1d395a 100644
--- a/drivers/mtd/lpddr/lpddr_cmds.c
+++ b/drivers/mtd/lpddr/lpddr_cmds.c
@@ -40,7 +40,7 @@ static int lpddr_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
40static int lpddr_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); 40static int lpddr_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
41static int lpddr_point(struct mtd_info *mtd, loff_t adr, size_t len, 41static int lpddr_point(struct mtd_info *mtd, loff_t adr, size_t len,
42 size_t *retlen, void **mtdbuf, resource_size_t *phys); 42 size_t *retlen, void **mtdbuf, resource_size_t *phys);
43static void lpddr_unpoint(struct mtd_info *mtd, loff_t adr, size_t len); 43static int lpddr_unpoint(struct mtd_info *mtd, loff_t adr, size_t len);
44static int get_chip(struct map_info *map, struct flchip *chip, int mode); 44static int get_chip(struct map_info *map, struct flchip *chip, int mode);
45static int chip_ready(struct map_info *map, struct flchip *chip, int mode); 45static int chip_ready(struct map_info *map, struct flchip *chip, int mode);
46static void put_chip(struct map_info *map, struct flchip *chip); 46static void put_chip(struct map_info *map, struct flchip *chip);
@@ -575,11 +575,11 @@ static int lpddr_point(struct mtd_info *mtd, loff_t adr, size_t len,
575 return 0; 575 return 0;
576} 576}
577 577
578static void lpddr_unpoint (struct mtd_info *mtd, loff_t adr, size_t len) 578static int lpddr_unpoint (struct mtd_info *mtd, loff_t adr, size_t len)
579{ 579{
580 struct map_info *map = mtd->priv; 580 struct map_info *map = mtd->priv;
581 struct lpddr_private *lpddr = map->fldrv_priv; 581 struct lpddr_private *lpddr = map->fldrv_priv;
582 int chipnum = adr >> lpddr->chipshift; 582 int chipnum = adr >> lpddr->chipshift, err = 0;
583 unsigned long ofs; 583 unsigned long ofs;
584 584
585 /* ofs: offset within the first chip that the first read should start */ 585 /* ofs: offset within the first chip that the first read should start */
@@ -603,9 +603,11 @@ static void lpddr_unpoint (struct mtd_info *mtd, loff_t adr, size_t len)
603 chip->ref_point_counter--; 603 chip->ref_point_counter--;
604 if (chip->ref_point_counter == 0) 604 if (chip->ref_point_counter == 0)
605 chip->state = FL_READY; 605 chip->state = FL_READY;
606 } else 606 } else {
607 printk(KERN_WARNING "%s: Warning: unpoint called on non" 607 printk(KERN_WARNING "%s: Warning: unpoint called on non"
608 "pointed region\n", map->name); 608 "pointed region\n", map->name);
609 err = -EINVAL;
610 }
609 611
610 put_chip(map, chip); 612 put_chip(map, chip);
611 mutex_unlock(&chip->mutex); 613 mutex_unlock(&chip->mutex);
@@ -614,6 +616,8 @@ static void lpddr_unpoint (struct mtd_info *mtd, loff_t adr, size_t len)
614 ofs = 0; 616 ofs = 0;
615 chipnum++; 617 chipnum++;
616 } 618 }
619
620 return err;
617} 621}
618 622
619static int lpddr_write_buffers(struct mtd_info *mtd, loff_t to, size_t len, 623static int lpddr_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,