mtd: nand: convert printk() to pr_*()
Instead of directly calling printk, it's simpler to use the built-in pr_* functions. This shortens code and allows easy customization through the definition of a pr_fmt() macro (not used currently). Ideally, we could implement much of this with dev_* functions, but the MTD subsystem does not necessarily register all its master `mtd_info.dev` device, so we cannot use dev_* consistently. See: http://lists.infradead.org/pipermail/linux-mtd/2011-July/036950.html Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
This commit is contained in:

committed by
Artem Bityutskiy

parent
a0f5080ecc
commit
9a4d4d6901
@@ -2179,7 +2179,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
|
||||
|
||||
/* Reject writes, which are not page aligned */
|
||||
if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {
|
||||
printk(KERN_NOTICE "%s: Attempt to write not "
|
||||
pr_notice("%s: Attempt to write not "
|
||||
"page aligned data\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -2570,7 +2570,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
|
||||
/* Heck if we have a bad block, we do not erase bad blocks! */
|
||||
if (nand_block_checkbad(mtd, ((loff_t) page) <<
|
||||
chip->page_shift, 0, allowbbt)) {
|
||||
printk(KERN_WARNING "%s: attempt to erase a bad block "
|
||||
pr_warn("%s: attempt to erase a bad block "
|
||||
"at page 0x%08x\n", __func__, page);
|
||||
instr->state = MTD_ERASE_FAILED;
|
||||
goto erase_exit;
|
||||
@@ -2744,7 +2744,7 @@ static void nand_resume(struct mtd_info *mtd)
|
||||
if (chip->state == FL_PM_SUSPENDED)
|
||||
nand_release_device(mtd);
|
||||
else
|
||||
printk(KERN_ERR "%s called for a chip which is not "
|
||||
pr_err("%s called for a chip which is not "
|
||||
"in suspended state\n", __func__);
|
||||
}
|
||||
|
||||
@@ -2836,13 +2836,13 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
chip->read_byte(mtd) != 'F' || chip->read_byte(mtd) != 'I')
|
||||
return 0;
|
||||
|
||||
printk(KERN_INFO "ONFI flash detected\n");
|
||||
pr_info("ONFI flash detected\n");
|
||||
chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
|
||||
for (i = 0; i < 3; i++) {
|
||||
chip->read_buf(mtd, (uint8_t *)p, sizeof(*p));
|
||||
if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) ==
|
||||
le16_to_cpu(p->crc)) {
|
||||
printk(KERN_INFO "ONFI param page %d valid\n", i);
|
||||
pr_info("ONFI param page %d valid\n", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2866,7 +2866,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
chip->onfi_version = 0;
|
||||
|
||||
if (!chip->onfi_version) {
|
||||
printk(KERN_INFO "%s: unsupported ONFI version: %d\n",
|
||||
pr_info("%s: unsupported ONFI version: %d\n",
|
||||
__func__, val);
|
||||
return 0;
|
||||
}
|
||||
@@ -2932,7 +2932,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
|
||||
id_data[i] = chip->read_byte(mtd);
|
||||
|
||||
if (id_data[0] != *maf_id || id_data[1] != *dev_id) {
|
||||
printk(KERN_INFO "%s: second ID read did not match "
|
||||
pr_info("%s: second ID read did not match "
|
||||
"%02x,%02x against %02x,%02x\n", __func__,
|
||||
*maf_id, *dev_id, id_data[0], id_data[1]);
|
||||
return ERR_PTR(-ENODEV);
|
||||
@@ -3077,10 +3077,10 @@ ident_done:
|
||||
* chip correct!
|
||||
*/
|
||||
if (busw != (chip->options & NAND_BUSWIDTH_16)) {
|
||||
printk(KERN_INFO "NAND device: Manufacturer ID:"
|
||||
pr_info("NAND device: Manufacturer ID:"
|
||||
" 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id,
|
||||
*dev_id, nand_manuf_ids[maf_idx].name, mtd->name);
|
||||
printk(KERN_WARNING "NAND bus width %d instead %d bit\n",
|
||||
pr_warn("NAND bus width %d instead %d bit\n",
|
||||
(chip->options & NAND_BUSWIDTH_16) ? 16 : 8,
|
||||
busw ? 16 : 8);
|
||||
return ERR_PTR(-EINVAL);
|
||||
@@ -3138,7 +3138,7 @@ ident_done:
|
||||
if (mtd->writesize > 512 && chip->cmdfunc == nand_command)
|
||||
chip->cmdfunc = nand_command_lp;
|
||||
|
||||
printk(KERN_INFO "NAND device: Manufacturer ID:"
|
||||
pr_info("NAND device: Manufacturer ID:"
|
||||
" 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
|
||||
nand_manuf_ids[maf_idx].name,
|
||||
chip->onfi_version ? chip->onfi_params.model : type->name);
|
||||
@@ -3175,7 +3175,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
|
||||
|
||||
if (IS_ERR(type)) {
|
||||
if (!(chip->options & NAND_SCAN_SILENT_NODEV))
|
||||
printk(KERN_WARNING "No NAND device found.\n");
|
||||
pr_warn("No NAND device found.\n");
|
||||
chip->select_chip(mtd, -1);
|
||||
return PTR_ERR(type);
|
||||
}
|
||||
@@ -3193,7 +3193,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
|
||||
break;
|
||||
}
|
||||
if (i > 1)
|
||||
printk(KERN_INFO "%d NAND chips detected\n", i);
|
||||
pr_info("%d NAND chips detected\n", i);
|
||||
|
||||
/* Store the number of chips and calc total size for mtd */
|
||||
chip->numchips = i;
|
||||
@@ -3243,7 +3243,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
||||
chip->ecc.layout = &nand_oob_128;
|
||||
break;
|
||||
default:
|
||||
printk(KERN_WARNING "No oob scheme defined for "
|
||||
pr_warn("No oob scheme defined for "
|
||||
"oobsize %d\n", mtd->oobsize);
|
||||
BUG();
|
||||
}
|
||||
@@ -3262,7 +3262,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
||||
/* Similar to NAND_ECC_HW, but a separate read_page handle */
|
||||
if (!chip->ecc.calculate || !chip->ecc.correct ||
|
||||
!chip->ecc.hwctl) {
|
||||
printk(KERN_WARNING "No ECC functions supplied; "
|
||||
pr_warn("No ECC functions supplied; "
|
||||
"Hardware ECC not possible\n");
|
||||
BUG();
|
||||
}
|
||||
@@ -3291,7 +3291,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
||||
chip->ecc.read_page == nand_read_page_hwecc ||
|
||||
!chip->ecc.write_page ||
|
||||
chip->ecc.write_page == nand_write_page_hwecc)) {
|
||||
printk(KERN_WARNING "No ECC functions supplied; "
|
||||
pr_warn("No ECC functions supplied; "
|
||||
"Hardware ECC not possible\n");
|
||||
BUG();
|
||||
}
|
||||
@@ -3311,7 +3311,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
||||
|
||||
if (mtd->writesize >= chip->ecc.size)
|
||||
break;
|
||||
printk(KERN_WARNING "%d byte HW ECC not possible on "
|
||||
pr_warn("%d byte HW ECC not possible on "
|
||||
"%d byte page size, fallback to SW ECC\n",
|
||||
chip->ecc.size, mtd->writesize);
|
||||
chip->ecc.mode = NAND_ECC_SOFT;
|
||||
@@ -3333,7 +3333,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
||||
|
||||
case NAND_ECC_SOFT_BCH:
|
||||
if (!mtd_nand_has_bch()) {
|
||||
printk(KERN_WARNING "CONFIG_MTD_ECC_BCH not enabled\n");
|
||||
pr_warn("CONFIG_MTD_ECC_BCH not enabled\n");
|
||||
BUG();
|
||||
}
|
||||
chip->ecc.calculate = nand_bch_calculate_ecc;
|
||||
@@ -3360,13 +3360,13 @@ int nand_scan_tail(struct mtd_info *mtd)
|
||||
chip->ecc.bytes,
|
||||
&chip->ecc.layout);
|
||||
if (!chip->ecc.priv) {
|
||||
printk(KERN_WARNING "BCH ECC initialization failed!\n");
|
||||
pr_warn("BCH ECC initialization failed!\n");
|
||||
BUG();
|
||||
}
|
||||
break;
|
||||
|
||||
case NAND_ECC_NONE:
|
||||
printk(KERN_WARNING "NAND_ECC_NONE selected by board driver. "
|
||||
pr_warn("NAND_ECC_NONE selected by board driver. "
|
||||
"This is not recommended !!\n");
|
||||
chip->ecc.read_page = nand_read_page_raw;
|
||||
chip->ecc.write_page = nand_write_page_raw;
|
||||
@@ -3379,7 +3379,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(KERN_WARNING "Invalid NAND_ECC_MODE %d\n",
|
||||
pr_warn("Invalid NAND_ECC_MODE %d\n",
|
||||
chip->ecc.mode);
|
||||
BUG();
|
||||
}
|
||||
@@ -3401,7 +3401,7 @@ int nand_scan_tail(struct mtd_info *mtd)
|
||||
*/
|
||||
chip->ecc.steps = mtd->writesize / chip->ecc.size;
|
||||
if (chip->ecc.steps * chip->ecc.size != mtd->writesize) {
|
||||
printk(KERN_WARNING "Invalid ECC parameters\n");
|
||||
pr_warn("Invalid ECC parameters\n");
|
||||
BUG();
|
||||
}
|
||||
chip->ecc.total = chip->ecc.steps * chip->ecc.bytes;
|
||||
@@ -3492,7 +3492,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
|
||||
|
||||
/* Many callers got this wrong, so check for it for a while... */
|
||||
if (!mtd->owner && caller_is_module()) {
|
||||
printk(KERN_CRIT "%s called with NULL mtd->owner!\n",
|
||||
pr_crit("%s called with NULL mtd->owner!\n",
|
||||
__func__);
|
||||
BUG();
|
||||
}
|
||||
|
Reference in New Issue
Block a user