aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_base.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-07-19 13:06:07 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 08:02:15 -0400
commit9a4d4d69018e7b719ba58fa30fcdd60e547776b8 (patch)
treeba8268500b7abe8c61d3a77d7be7466e55f141bc /drivers/mtd/nand/nand_base.c
parenta0f5080ecc1c75f9c08591d9b0f48451e7ac8ddc (diff)
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>
Diffstat (limited to 'drivers/mtd/nand/nand_base.c')
-rw-r--r--drivers/mtd/nand/nand_base.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 250e86f5592e..1d6c81aef779 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2179,7 +2179,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
2179 2179
2180 /* Reject writes, which are not page aligned */ 2180 /* Reject writes, which are not page aligned */
2181 if (NOTALIGNED(to) || NOTALIGNED(ops->len)) { 2181 if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {
2182 printk(KERN_NOTICE "%s: Attempt to write not " 2182 pr_notice("%s: Attempt to write not "
2183 "page aligned data\n", __func__); 2183 "page aligned data\n", __func__);
2184 return -EINVAL; 2184 return -EINVAL;
2185 } 2185 }
@@ -2570,7 +2570,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
2570 /* Heck if we have a bad block, we do not erase bad blocks! */ 2570 /* Heck if we have a bad block, we do not erase bad blocks! */
2571 if (nand_block_checkbad(mtd, ((loff_t) page) << 2571 if (nand_block_checkbad(mtd, ((loff_t) page) <<
2572 chip->page_shift, 0, allowbbt)) { 2572 chip->page_shift, 0, allowbbt)) {
2573 printk(KERN_WARNING "%s: attempt to erase a bad block " 2573 pr_warn("%s: attempt to erase a bad block "
2574 "at page 0x%08x\n", __func__, page); 2574 "at page 0x%08x\n", __func__, page);
2575 instr->state = MTD_ERASE_FAILED; 2575 instr->state = MTD_ERASE_FAILED;
2576 goto erase_exit; 2576 goto erase_exit;
@@ -2744,7 +2744,7 @@ static void nand_resume(struct mtd_info *mtd)
2744 if (chip->state == FL_PM_SUSPENDED) 2744 if (chip->state == FL_PM_SUSPENDED)
2745 nand_release_device(mtd); 2745 nand_release_device(mtd);
2746 else 2746 else
2747 printk(KERN_ERR "%s called for a chip which is not " 2747 pr_err("%s called for a chip which is not "
2748 "in suspended state\n", __func__); 2748 "in suspended state\n", __func__);
2749} 2749}
2750 2750
@@ -2836,13 +2836,13 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
2836 chip->read_byte(mtd) != 'F' || chip->read_byte(mtd) != 'I') 2836 chip->read_byte(mtd) != 'F' || chip->read_byte(mtd) != 'I')
2837 return 0; 2837 return 0;
2838 2838
2839 printk(KERN_INFO "ONFI flash detected\n"); 2839 pr_info("ONFI flash detected\n");
2840 chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); 2840 chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
2841 for (i = 0; i < 3; i++) { 2841 for (i = 0; i < 3; i++) {
2842 chip->read_buf(mtd, (uint8_t *)p, sizeof(*p)); 2842 chip->read_buf(mtd, (uint8_t *)p, sizeof(*p));
2843 if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) == 2843 if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) ==
2844 le16_to_cpu(p->crc)) { 2844 le16_to_cpu(p->crc)) {
2845 printk(KERN_INFO "ONFI param page %d valid\n", i); 2845 pr_info("ONFI param page %d valid\n", i);
2846 break; 2846 break;
2847 } 2847 }
2848 } 2848 }
@@ -2866,7 +2866,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
2866 chip->onfi_version = 0; 2866 chip->onfi_version = 0;
2867 2867
2868 if (!chip->onfi_version) { 2868 if (!chip->onfi_version) {
2869 printk(KERN_INFO "%s: unsupported ONFI version: %d\n", 2869 pr_info("%s: unsupported ONFI version: %d\n",
2870 __func__, val); 2870 __func__, val);
2871 return 0; 2871 return 0;
2872 } 2872 }
@@ -2932,7 +2932,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
2932 id_data[i] = chip->read_byte(mtd); 2932 id_data[i] = chip->read_byte(mtd);
2933 2933
2934 if (id_data[0] != *maf_id || id_data[1] != *dev_id) { 2934 if (id_data[0] != *maf_id || id_data[1] != *dev_id) {
2935 printk(KERN_INFO "%s: second ID read did not match " 2935 pr_info("%s: second ID read did not match "
2936 "%02x,%02x against %02x,%02x\n", __func__, 2936 "%02x,%02x against %02x,%02x\n", __func__,
2937 *maf_id, *dev_id, id_data[0], id_data[1]); 2937 *maf_id, *dev_id, id_data[0], id_data[1]);
2938 return ERR_PTR(-ENODEV); 2938 return ERR_PTR(-ENODEV);
@@ -3077,10 +3077,10 @@ ident_done:
3077 * chip correct! 3077 * chip correct!
3078 */ 3078 */
3079 if (busw != (chip->options & NAND_BUSWIDTH_16)) { 3079 if (busw != (chip->options & NAND_BUSWIDTH_16)) {
3080 printk(KERN_INFO "NAND device: Manufacturer ID:" 3080 pr_info("NAND device: Manufacturer ID:"
3081 " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, 3081 " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id,
3082 *dev_id, nand_manuf_ids[maf_idx].name, mtd->name); 3082 *dev_id, nand_manuf_ids[maf_idx].name, mtd->name);
3083 printk(KERN_WARNING "NAND bus width %d instead %d bit\n", 3083 pr_warn("NAND bus width %d instead %d bit\n",
3084 (chip->options & NAND_BUSWIDTH_16) ? 16 : 8, 3084 (chip->options & NAND_BUSWIDTH_16) ? 16 : 8,
3085 busw ? 16 : 8); 3085 busw ? 16 : 8);
3086 return ERR_PTR(-EINVAL); 3086 return ERR_PTR(-EINVAL);
@@ -3138,7 +3138,7 @@ ident_done:
3138 if (mtd->writesize > 512 && chip->cmdfunc == nand_command) 3138 if (mtd->writesize > 512 && chip->cmdfunc == nand_command)
3139 chip->cmdfunc = nand_command_lp; 3139 chip->cmdfunc = nand_command_lp;
3140 3140
3141 printk(KERN_INFO "NAND device: Manufacturer ID:" 3141 pr_info("NAND device: Manufacturer ID:"
3142 " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id, 3142 " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
3143 nand_manuf_ids[maf_idx].name, 3143 nand_manuf_ids[maf_idx].name,
3144 chip->onfi_version ? chip->onfi_params.model : type->name); 3144 chip->onfi_version ? chip->onfi_params.model : type->name);
@@ -3175,7 +3175,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
3175 3175
3176 if (IS_ERR(type)) { 3176 if (IS_ERR(type)) {
3177 if (!(chip->options & NAND_SCAN_SILENT_NODEV)) 3177 if (!(chip->options & NAND_SCAN_SILENT_NODEV))
3178 printk(KERN_WARNING "No NAND device found.\n"); 3178 pr_warn("No NAND device found.\n");
3179 chip->select_chip(mtd, -1); 3179 chip->select_chip(mtd, -1);
3180 return PTR_ERR(type); 3180 return PTR_ERR(type);
3181 } 3181 }
@@ -3193,7 +3193,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
3193 break; 3193 break;
3194 } 3194 }
3195 if (i > 1) 3195 if (i > 1)
3196 printk(KERN_INFO "%d NAND chips detected\n", i); 3196 pr_info("%d NAND chips detected\n", i);
3197 3197
3198 /* Store the number of chips and calc total size for mtd */ 3198 /* Store the number of chips and calc total size for mtd */
3199 chip->numchips = i; 3199 chip->numchips = i;
@@ -3243,7 +3243,7 @@ int nand_scan_tail(struct mtd_info *mtd)
3243 chip->ecc.layout = &nand_oob_128; 3243 chip->ecc.layout = &nand_oob_128;
3244 break; 3244 break;
3245 default: 3245 default:
3246 printk(KERN_WARNING "No oob scheme defined for " 3246 pr_warn("No oob scheme defined for "
3247 "oobsize %d\n", mtd->oobsize); 3247 "oobsize %d\n", mtd->oobsize);
3248 BUG(); 3248 BUG();
3249 } 3249 }
@@ -3262,7 +3262,7 @@ int nand_scan_tail(struct mtd_info *mtd)
3262 /* Similar to NAND_ECC_HW, but a separate read_page handle */ 3262 /* Similar to NAND_ECC_HW, but a separate read_page handle */
3263 if (!chip->ecc.calculate || !chip->ecc.correct || 3263 if (!chip->ecc.calculate || !chip->ecc.correct ||
3264 !chip->ecc.hwctl) { 3264 !chip->ecc.hwctl) {
3265 printk(KERN_WARNING "No ECC functions supplied; " 3265 pr_warn("No ECC functions supplied; "
3266 "Hardware ECC not possible\n"); 3266 "Hardware ECC not possible\n");
3267 BUG(); 3267 BUG();
3268 } 3268 }
@@ -3291,7 +3291,7 @@ int nand_scan_tail(struct mtd_info *mtd)
3291 chip->ecc.read_page == nand_read_page_hwecc || 3291 chip->ecc.read_page == nand_read_page_hwecc ||
3292 !chip->ecc.write_page || 3292 !chip->ecc.write_page ||
3293 chip->ecc.write_page == nand_write_page_hwecc)) { 3293 chip->ecc.write_page == nand_write_page_hwecc)) {
3294 printk(KERN_WARNING "No ECC functions supplied; " 3294 pr_warn("No ECC functions supplied; "
3295 "Hardware ECC not possible\n"); 3295 "Hardware ECC not possible\n");
3296 BUG(); 3296 BUG();
3297 } 3297 }
@@ -3311,7 +3311,7 @@ int nand_scan_tail(struct mtd_info *mtd)
3311 3311
3312 if (mtd->writesize >= chip->ecc.size) 3312 if (mtd->writesize >= chip->ecc.size)
3313 break; 3313 break;
3314 printk(KERN_WARNING "%d byte HW ECC not possible on " 3314 pr_warn("%d byte HW ECC not possible on "
3315 "%d byte page size, fallback to SW ECC\n", 3315 "%d byte page size, fallback to SW ECC\n",
3316 chip->ecc.size, mtd->writesize); 3316 chip->ecc.size, mtd->writesize);
3317 chip->ecc.mode = NAND_ECC_SOFT; 3317 chip->ecc.mode = NAND_ECC_SOFT;
@@ -3333,7 +3333,7 @@ int nand_scan_tail(struct mtd_info *mtd)
3333 3333
3334 case NAND_ECC_SOFT_BCH: 3334 case NAND_ECC_SOFT_BCH:
3335 if (!mtd_nand_has_bch()) { 3335 if (!mtd_nand_has_bch()) {
3336 printk(KERN_WARNING "CONFIG_MTD_ECC_BCH not enabled\n"); 3336 pr_warn("CONFIG_MTD_ECC_BCH not enabled\n");
3337 BUG(); 3337 BUG();
3338 } 3338 }
3339 chip->ecc.calculate = nand_bch_calculate_ecc; 3339 chip->ecc.calculate = nand_bch_calculate_ecc;
@@ -3360,13 +3360,13 @@ int nand_scan_tail(struct mtd_info *mtd)
3360 chip->ecc.bytes, 3360 chip->ecc.bytes,
3361 &chip->ecc.layout); 3361 &chip->ecc.layout);
3362 if (!chip->ecc.priv) { 3362 if (!chip->ecc.priv) {
3363 printk(KERN_WARNING "BCH ECC initialization failed!\n"); 3363 pr_warn("BCH ECC initialization failed!\n");
3364 BUG(); 3364 BUG();
3365 } 3365 }
3366 break; 3366 break;
3367 3367
3368 case NAND_ECC_NONE: 3368 case NAND_ECC_NONE:
3369 printk(KERN_WARNING "NAND_ECC_NONE selected by board driver. " 3369 pr_warn("NAND_ECC_NONE selected by board driver. "
3370 "This is not recommended !!\n"); 3370 "This is not recommended !!\n");
3371 chip->ecc.read_page = nand_read_page_raw; 3371 chip->ecc.read_page = nand_read_page_raw;
3372 chip->ecc.write_page = nand_write_page_raw; 3372 chip->ecc.write_page = nand_write_page_raw;
@@ -3379,7 +3379,7 @@ int nand_scan_tail(struct mtd_info *mtd)
3379 break; 3379 break;
3380 3380
3381 default: 3381 default:
3382 printk(KERN_WARNING "Invalid NAND_ECC_MODE %d\n", 3382 pr_warn("Invalid NAND_ECC_MODE %d\n",
3383 chip->ecc.mode); 3383 chip->ecc.mode);
3384 BUG(); 3384 BUG();
3385 } 3385 }
@@ -3401,7 +3401,7 @@ int nand_scan_tail(struct mtd_info *mtd)
3401 */ 3401 */
3402 chip->ecc.steps = mtd->writesize / chip->ecc.size; 3402 chip->ecc.steps = mtd->writesize / chip->ecc.size;
3403 if (chip->ecc.steps * chip->ecc.size != mtd->writesize) { 3403 if (chip->ecc.steps * chip->ecc.size != mtd->writesize) {
3404 printk(KERN_WARNING "Invalid ECC parameters\n"); 3404 pr_warn("Invalid ECC parameters\n");
3405 BUG(); 3405 BUG();
3406 } 3406 }
3407 chip->ecc.total = chip->ecc.steps * chip->ecc.bytes; 3407 chip->ecc.total = chip->ecc.steps * chip->ecc.bytes;
@@ -3492,7 +3492,7 @@ int nand_scan(struct mtd_info *mtd, int maxchips)
3492 3492
3493 /* Many callers got this wrong, so check for it for a while... */ 3493 /* Many callers got this wrong, so check for it for a while... */
3494 if (!mtd->owner && caller_is_module()) { 3494 if (!mtd->owner && caller_is_module()) {
3495 printk(KERN_CRIT "%s called with NULL mtd->owner!\n", 3495 pr_crit("%s called with NULL mtd->owner!\n",
3496 __func__); 3496 __func__);
3497 BUG(); 3497 BUG();
3498 } 3498 }