Commit 20d8e248 authored by vimal singh's avatar vimal singh Committed by David Woodhouse

mtd: nand_base: use __func__ instead of typing names

Correcting debug prints by removing function names from print messages
and using '__func__' macro instead.

Function names were wrong in few places.
Signed-off-by: default avatarVimal Singh <vimalsingh@ti.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent b8b3ee9a
...@@ -1412,8 +1412,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from, ...@@ -1412,8 +1412,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
int len; int len;
uint8_t *buf = ops->oobbuf; uint8_t *buf = ops->oobbuf;
DEBUG(MTD_DEBUG_LEVEL3, "nand_read_oob: from = 0x%08Lx, len = %i\n", DEBUG(MTD_DEBUG_LEVEL3, "%s: from = 0x%08Lx, len = %i\n",
(unsigned long long)from, readlen); __func__, (unsigned long long)from, readlen);
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OOB_AUTO)
len = chip->ecc.layout->oobavail; len = chip->ecc.layout->oobavail;
...@@ -1421,8 +1421,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from, ...@@ -1421,8 +1421,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
len = mtd->oobsize; len = mtd->oobsize;
if (unlikely(ops->ooboffs >= len)) { if (unlikely(ops->ooboffs >= len)) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_read_oob: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start read "
"Attempt to start read outside oob\n"); "outside oob\n", __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -1430,8 +1430,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from, ...@@ -1430,8 +1430,8 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
if (unlikely(from >= mtd->size || if (unlikely(from >= mtd->size ||
ops->ooboffs + readlen > ((mtd->size >> chip->page_shift) - ops->ooboffs + readlen > ((mtd->size >> chip->page_shift) -
(from >> chip->page_shift)) * len)) { (from >> chip->page_shift)) * len)) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_read_oob: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt read beyond end "
"Attempt read beyond end of device\n"); "of device\n", __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -1505,8 +1505,8 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from, ...@@ -1505,8 +1505,8 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
/* Do not allow reads past end of device */ /* Do not allow reads past end of device */
if (ops->datbuf && (from + ops->len) > mtd->size) { if (ops->datbuf && (from + ops->len) > mtd->size) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_read_oob: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt read "
"Attempt read beyond end of device\n"); "beyond end of device\n", __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -1815,8 +1815,8 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to, ...@@ -1815,8 +1815,8 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
/* reject writes, which are not page aligned */ /* reject writes, which are not page aligned */
if (NOTALIGNED(to) || NOTALIGNED(ops->len)) { if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {
printk(KERN_NOTICE "nand_write: " printk(KERN_NOTICE "%s: Attempt to write not "
"Attempt to write not page aligned data\n"); "page aligned data\n", __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -1943,8 +1943,8 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, ...@@ -1943,8 +1943,8 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
int chipnr, page, status, len; int chipnr, page, status, len;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd->priv;
DEBUG(MTD_DEBUG_LEVEL3, "nand_write_oob: to = 0x%08x, len = %i\n", DEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, len = %i\n",
(unsigned int)to, (int)ops->ooblen); __func__, (unsigned int)to, (int)ops->ooblen);
if (ops->mode == MTD_OOB_AUTO) if (ops->mode == MTD_OOB_AUTO)
len = chip->ecc.layout->oobavail; len = chip->ecc.layout->oobavail;
...@@ -1953,14 +1953,14 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, ...@@ -1953,14 +1953,14 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
/* Do not allow write past end of page */ /* Do not allow write past end of page */
if ((ops->ooboffs + ops->ooblen) > len) { if ((ops->ooboffs + ops->ooblen) > len) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_write_oob: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to write "
"Attempt to write past end of page\n"); "past end of page\n", __func__);
return -EINVAL; return -EINVAL;
} }
if (unlikely(ops->ooboffs >= len)) { if (unlikely(ops->ooboffs >= len)) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_do_write_oob: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt to start "
"Attempt to start write outside oob\n"); "write outside oob\n", __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -1969,8 +1969,8 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, ...@@ -1969,8 +1969,8 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
ops->ooboffs + ops->ooblen > ops->ooboffs + ops->ooblen >
((mtd->size >> chip->page_shift) - ((mtd->size >> chip->page_shift) -
(to >> chip->page_shift)) * len)) { (to >> chip->page_shift)) * len)) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_do_write_oob: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt write beyond "
"Attempt write beyond end of device\n"); "end of device\n", __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -2025,8 +2025,8 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to, ...@@ -2025,8 +2025,8 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to,
/* Do not allow writes past end of device */ /* Do not allow writes past end of device */
if (ops->datbuf && (to + ops->len) > mtd->size) { if (ops->datbuf && (to + ops->len) > mtd->size) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_write_oob: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Attempt write beyond "
"Attempt write beyond end of device\n"); "end of device\n", __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -2116,26 +2116,27 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, ...@@ -2116,26 +2116,27 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
unsigned int bbt_masked_page = 0xffffffff; unsigned int bbt_masked_page = 0xffffffff;
loff_t len; loff_t len;
DEBUG(MTD_DEBUG_LEVEL3, "nand_erase: start = 0x%012llx, len = %llu\n", DEBUG(MTD_DEBUG_LEVEL3, "%s: start = 0x%012llx, len = %llu\n",
(unsigned long long)instr->addr, (unsigned long long)instr->len); __func__, (unsigned long long)instr->addr,
(unsigned long long)instr->len);
/* Start address must align on block boundary */ /* Start address must align on block boundary */
if (instr->addr & ((1 << chip->phys_erase_shift) - 1)) { if (instr->addr & ((1 << chip->phys_erase_shift) - 1)) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_erase: Unaligned address\n"); DEBUG(MTD_DEBUG_LEVEL0, "%s: Unaligned address\n", __func__);
return -EINVAL; return -EINVAL;
} }
/* Length must align on block boundary */ /* Length must align on block boundary */
if (instr->len & ((1 << chip->phys_erase_shift) - 1)) { if (instr->len & ((1 << chip->phys_erase_shift) - 1)) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_erase: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Length not block aligned\n",
"Length not block aligned\n"); __func__);
return -EINVAL; return -EINVAL;
} }
/* Do not allow erase past end of device */ /* Do not allow erase past end of device */
if ((instr->len + instr->addr) > mtd->size) { if ((instr->len + instr->addr) > mtd->size) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_erase: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Erase past end of device\n",
"Erase past end of device\n"); __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -2156,8 +2157,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, ...@@ -2156,8 +2157,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
/* Check, if it is write protected */ /* Check, if it is write protected */
if (nand_check_wp(mtd)) { if (nand_check_wp(mtd)) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_erase: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Device is write protected!!!\n",
"Device is write protected!!!\n"); __func__);
instr->state = MTD_ERASE_FAILED; instr->state = MTD_ERASE_FAILED;
goto erase_exit; goto erase_exit;
} }
...@@ -2182,8 +2183,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, ...@@ -2182,8 +2183,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
*/ */
if (nand_block_checkbad(mtd, ((loff_t) page) << if (nand_block_checkbad(mtd, ((loff_t) page) <<
chip->page_shift, 0, allowbbt)) { chip->page_shift, 0, allowbbt)) {
printk(KERN_WARNING "nand_erase: attempt to erase a " printk(KERN_WARNING "%s: attempt to erase a bad block "
"bad block at page 0x%08x\n", page); "at page 0x%08x\n", __func__, page);
instr->state = MTD_ERASE_FAILED; instr->state = MTD_ERASE_FAILED;
goto erase_exit; goto erase_exit;
} }
...@@ -2210,8 +2211,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, ...@@ -2210,8 +2211,8 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
/* See if block erase succeeded */ /* See if block erase succeeded */
if (status & NAND_STATUS_FAIL) { if (status & NAND_STATUS_FAIL) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_erase: " DEBUG(MTD_DEBUG_LEVEL0, "%s: Failed erase, "
"Failed erase, page 0x%08x\n", page); "page 0x%08x\n", __func__, page);
instr->state = MTD_ERASE_FAILED; instr->state = MTD_ERASE_FAILED;
instr->fail_addr = instr->fail_addr =
((loff_t)page << chip->page_shift); ((loff_t)page << chip->page_shift);
...@@ -2271,9 +2272,9 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, ...@@ -2271,9 +2272,9 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
if (!rewrite_bbt[chipnr]) if (!rewrite_bbt[chipnr])
continue; continue;
/* update the BBT for chip */ /* update the BBT for chip */
DEBUG(MTD_DEBUG_LEVEL0, "nand_erase_nand: nand_update_bbt " DEBUG(MTD_DEBUG_LEVEL0, "%s: nand_update_bbt "
"(%d:0x%0llx 0x%0x)\n", chipnr, rewrite_bbt[chipnr], "(%d:0x%0llx 0x%0x)\n", __func__, chipnr,
chip->bbt_td->pages[chipnr]); rewrite_bbt[chipnr], chip->bbt_td->pages[chipnr]);
nand_update_bbt(mtd, rewrite_bbt[chipnr]); nand_update_bbt(mtd, rewrite_bbt[chipnr]);
} }
...@@ -2291,7 +2292,7 @@ static void nand_sync(struct mtd_info *mtd) ...@@ -2291,7 +2292,7 @@ static void nand_sync(struct mtd_info *mtd)
{ {
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd->priv;
DEBUG(MTD_DEBUG_LEVEL3, "nand_sync: called\n"); DEBUG(MTD_DEBUG_LEVEL3, "%s: called\n", __func__);
/* Grab the lock and see if the device is available */ /* Grab the lock and see if the device is available */
nand_get_device(chip, mtd, FL_SYNCING); nand_get_device(chip, mtd, FL_SYNCING);
...@@ -2355,8 +2356,8 @@ static void nand_resume(struct mtd_info *mtd) ...@@ -2355,8 +2356,8 @@ static void nand_resume(struct mtd_info *mtd)
if (chip->state == FL_PM_SUSPENDED) if (chip->state == FL_PM_SUSPENDED)
nand_release_device(mtd); nand_release_device(mtd);
else else
printk(KERN_ERR "nand_resume() called for a chip which is not " printk(KERN_ERR "%s called for a chip which is not "
"in suspended state\n"); "in suspended state\n", __func__);
} }
/* /*
...@@ -2857,7 +2858,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips) ...@@ -2857,7 +2858,8 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
/* Many callers got this wrong, so check for it for a while... */ /* Many callers got this wrong, so check for it for a while... */
if (!mtd->owner && caller_is_module()) { if (!mtd->owner && caller_is_module()) {
printk(KERN_CRIT "nand_scan() called with NULL mtd->owner!\n"); printk(KERN_CRIT "%s called with NULL mtd->owner!\n",
__func__);
BUG(); BUG();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment