Skip to content

Commit e597cd0

Browse files
JoePerchesJens Axboe
authored andcommitted
drivers/cdrom: use pr_<level>
- add pr_fmt. - convert printks to pr_<level> - add if (0) and printf argument checking to cdinfo - coalesce consecutive printks to single pr_ - fix a typo "back ground" to "background" - convert printks without level to pr_info - remove VIOCD_ prefixes and use pr_fmt/pr_<level> - add a missing newline to an OS/400 message Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Folded in tab indentation fix from Andrew. Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 parent 3ffb52e commit e597cd0

3 files changed

Lines changed: 73 additions & 83 deletions

File tree

‎drivers/cdrom/cdrom.c‎

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@
242242
243243
-------------------------------------------------------------------------*/
244244

245+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
246+
245247
#define REVISION "Revision: 3.20"
246248
#define VERSION "Id: cdrom.c 3.20 2003/12/17"
247249

@@ -314,11 +316,17 @@ static const char *mrw_format_status[] = {
314316
static const char *mrw_address_space[] = { "DMA", "GAA" };
315317

316318
#if (ERRLOGMASK!=CD_NOTHING)
317-
#define cdinfo(type, fmt, args...) \
318-
if ((ERRLOGMASK & type) || debug==1 ) \
319-
printk(KERN_INFO "cdrom: " fmt, ## args)
319+
#define cdinfo(type, fmt, args...) \
320+
do { \
321+
if ((ERRLOGMASK & type) || debug == 1) \
322+
pr_info(fmt, ##args); \
323+
} while (0)
320324
#else
321-
#define cdinfo(type, fmt, args...)
325+
#define cdinfo(type, fmt, args...) \
326+
do { \
327+
if (0 && (ERRLOGMASK & type) || debug == 1) \
328+
pr_info(fmt, ##args); \
329+
} while (0)
322330
#endif
323331

324332
/* These are used to simplify getting data in from and back to user land */
@@ -395,7 +403,7 @@ int register_cdrom(struct cdrom_device_info *cdi)
395403
if (cdo->open == NULL || cdo->release == NULL)
396404
return -EINVAL;
397405
if (!banner_printed) {
398-
printk(KERN_INFO "Uniform CD-ROM driver " REVISION "\n");
406+
pr_info("Uniform CD-ROM driver " REVISION "\n");
399407
banner_printed = 1;
400408
cdrom_sysctl_register();
401409
}
@@ -546,7 +554,7 @@ static int cdrom_mrw_bgformat(struct cdrom_device_info *cdi, int cont)
546554
unsigned char buffer[12];
547555
int ret;
548556

549-
printk(KERN_INFO "cdrom: %sstarting format\n", cont ? "Re" : "");
557+
pr_info("%sstarting format\n", cont ? "Re" : "");
550558

551559
/*
552560
* FmtData bit set (bit 4), format type is 1
@@ -576,7 +584,7 @@ static int cdrom_mrw_bgformat(struct cdrom_device_info *cdi, int cont)
576584

577585
ret = cdi->ops->generic_packet(cdi, &cgc);
578586
if (ret)
579-
printk(KERN_INFO "cdrom: bgformat failed\n");
587+
pr_info("bgformat failed\n");
580588

581589
return ret;
582590
}
@@ -622,8 +630,7 @@ static int cdrom_mrw_exit(struct cdrom_device_info *cdi)
622630

623631
ret = 0;
624632
if (di.mrw_status == CDM_MRW_BGFORMAT_ACTIVE) {
625-
printk(KERN_INFO "cdrom: issuing MRW back ground "
626-
"format suspend\n");
633+
pr_info("issuing MRW background format suspend\n");
627634
ret = cdrom_mrw_bgformat_susp(cdi, 0);
628635
}
629636

@@ -658,7 +665,8 @@ static int cdrom_mrw_set_lba_space(struct cdrom_device_info *cdi, int space)
658665
if ((ret = cdrom_mode_select(cdi, &cgc)))
659666
return ret;
660667

661-
printk(KERN_INFO "cdrom: %s: mrw address space %s selected\n", cdi->name, mrw_address_space[space]);
668+
pr_info("%s: mrw address space %s selected\n",
669+
cdi->name, mrw_address_space[space]);
662670
return 0;
663671
}
664672

@@ -762,7 +770,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)
762770
* always reset to DMA lba space on open
763771
*/
764772
if (cdrom_mrw_set_lba_space(cdi, MRW_LBA_DMA)) {
765-
printk(KERN_ERR "cdrom: failed setting lba address space\n");
773+
pr_err("failed setting lba address space\n");
766774
return 1;
767775
}
768776

@@ -781,8 +789,7 @@ static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)
781789
* 3 - MRW formatting complete
782790
*/
783791
ret = 0;
784-
printk(KERN_INFO "cdrom open: mrw_status '%s'\n",
785-
mrw_format_status[di.mrw_status]);
792+
pr_info("open: mrw_status '%s'\n", mrw_format_status[di.mrw_status]);
786793
if (!di.mrw_status)
787794
ret = 1;
788795
else if (di.mrw_status == CDM_MRW_BGFORMAT_INACTIVE &&
@@ -932,8 +939,7 @@ static void cdrom_dvd_rw_close_write(struct cdrom_device_info *cdi)
932939
return;
933940
}
934941

935-
printk(KERN_INFO "cdrom: %s: dirty DVD+RW media, \"finalizing\"\n",
936-
cdi->name);
942+
pr_info("%s: dirty DVD+RW media, \"finalizing\"\n", cdi->name);
937943

938944
init_cdrom_command(&cgc, NULL, 0, CGC_DATA_NONE);
939945
cgc.cmd[0] = GPCMD_FLUSH_CACHE;
@@ -2176,7 +2182,7 @@ static int cdrom_read_cdda(struct cdrom_device_info *cdi, __u8 __user *ubuf,
21762182
* frame dma, so drop to single frame dma if we need to
21772183
*/
21782184
if (cdi->cdda_method == CDDA_BPC_FULL && nframes > 1) {
2179-
printk("cdrom: dropping to single frame dma\n");
2185+
pr_info("dropping to single frame dma\n");
21802186
cdi->cdda_method = CDDA_BPC_SINGLE;
21812187
goto retry;
21822188
}
@@ -2189,7 +2195,7 @@ static int cdrom_read_cdda(struct cdrom_device_info *cdi, __u8 __user *ubuf,
21892195
if (cdi->last_sense != 0x04 && cdi->last_sense != 0x0b)
21902196
return ret;
21912197

2192-
printk("cdrom: dropping to old style cdda (sense=%x)\n", cdi->last_sense);
2198+
pr_info("dropping to old style cdda (sense=%x)\n", cdi->last_sense);
21932199
cdi->cdda_method = CDDA_OLD;
21942200
return cdrom_read_cdda_old(cdi, ubuf, lba, nframes);
21952201
}
@@ -3401,7 +3407,7 @@ static int cdrom_print_info(const char *header, int val, char *info,
34013407
"\t%d", CDROM_CAN(val) != 0);
34023408
break;
34033409
default:
3404-
printk(KERN_INFO "cdrom: invalid option%d\n", option);
3410+
pr_info("invalid option%d\n", option);
34053411
return 1;
34063412
}
34073413
if (!ret)
@@ -3491,7 +3497,7 @@ static int cdrom_sysctl_info(ctl_table *ctl, int write,
34913497
mutex_unlock(&cdrom_mutex);
34923498
return proc_dostring(ctl, write, buffer, lenp, ppos);
34933499
done:
3494-
printk(KERN_INFO "cdrom: info buffer too small\n");
3500+
pr_info("info buffer too small\n");
34953501
goto doit;
34963502
}
34973503

@@ -3665,7 +3671,7 @@ static int __init cdrom_init(void)
36653671

36663672
static void __exit cdrom_exit(void)
36673673
{
3668-
printk(KERN_INFO "Uniform CD-ROM driver unloaded\n");
3674+
pr_info("Uniform CD-ROM driver unloaded\n");
36693675
cdrom_sysctl_unregister();
36703676
}
36713677

‎drivers/cdrom/gdrom.c‎

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
*
2020
*/
2121

22+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23+
2224
#include <linux/init.h>
2325
#include <linux/module.h>
2426
#include <linux/fs.h>
@@ -339,8 +341,7 @@ static int gdrom_get_last_session(struct cdrom_device_info *cd_info,
339341
tocuse = 0;
340342
err = gdrom_readtoc_cmd(gd.toc, 0);
341343
if (err) {
342-
printk(KERN_INFO "GDROM: Could not get CD "
343-
"table of contents\n");
344+
pr_info("Could not get CD table of contents\n");
344345
return -ENXIO;
345346
}
346347
}
@@ -357,8 +358,7 @@ static int gdrom_get_last_session(struct cdrom_device_info *cd_info,
357358
} while (track >= fentry);
358359

359360
if ((track > 100) || (track < get_entry_track(gd.toc->first))) {
360-
printk(KERN_INFO "GDROM: No data on the last "
361-
"session of the CD\n");
361+
pr_info("No data on the last session of the CD\n");
362362
gdrom_getsense(NULL);
363363
return -ENXIO;
364364
}
@@ -451,14 +451,14 @@ static int gdrom_getsense(short *bufstring)
451451
goto cleanup_sense;
452452
insw(GDROM_DATA_REG, &sense, sense_command->buflen/2);
453453
if (sense[1] & 40) {
454-
printk(KERN_INFO "GDROM: Drive not ready - command aborted\n");
454+
pr_info("Drive not ready - command aborted\n");
455455
goto cleanup_sense;
456456
}
457457
sense_key = sense[1] & 0x0F;
458458
if (sense_key < ARRAY_SIZE(sense_texts))
459-
printk(KERN_INFO "GDROM: %s\n", sense_texts[sense_key].text);
459+
pr_info("%s\n", sense_texts[sense_key].text);
460460
else
461-
printk(KERN_ERR "GDROM: Unknown sense key: %d\n", sense_key);
461+
pr_err("Unknown sense key: %d\n", sense_key);
462462
if (bufstring) /* return addional sense data */
463463
memcpy(bufstring, &sense[4], 2);
464464
if (sense_key < 2)
@@ -644,13 +644,12 @@ static void gdrom_request(struct request_queue *rq)
644644

645645
while ((req = blk_fetch_request(rq)) != NULL) {
646646
if (req->cmd_type != REQ_TYPE_FS) {
647-
printk(KERN_DEBUG "GDROM: Non-fs request ignored\n");
647+
printk(KERN_DEBUG "gdrom: Non-fs request ignored\n");
648648
__blk_end_request_all(req, -EIO);
649649
continue;
650650
}
651651
if (rq_data_dir(req) != READ) {
652-
printk(KERN_NOTICE "GDROM: Read only device -");
653-
printk(" write request ignored\n");
652+
pr_notice("Read only device - write request ignored\n");
654653
__blk_end_request_all(req, -EIO);
655654
continue;
656655
}
@@ -685,7 +684,7 @@ static int __devinit gdrom_outputversion(void)
685684
firmw_ver = kstrndup(id->firmver, 16, GFP_KERNEL);
686685
if (!firmw_ver)
687686
goto free_manuf_name;
688-
printk(KERN_INFO "GDROM: %s from %s with firmware %s\n",
687+
pr_info("%s from %s with firmware %s\n",
689688
model_name, manuf_name, firmw_ver);
690689
err = 0;
691690
kfree(firmw_ver);
@@ -757,7 +756,7 @@ static int __devinit probe_gdrom(struct platform_device *devptr)
757756
int err;
758757
/* Start the device */
759758
if (gdrom_execute_diagnostic() != 1) {
760-
printk(KERN_WARNING "GDROM: ATA Probe for GDROM failed.\n");
759+
pr_warning("ATA Probe for GDROM failed\n");
761760
return -ENODEV;
762761
}
763762
/* Print out firmware ID */
@@ -767,7 +766,7 @@ static int __devinit probe_gdrom(struct platform_device *devptr)
767766
gdrom_major = register_blkdev(0, GDROM_DEV_NAME);
768767
if (gdrom_major <= 0)
769768
return gdrom_major;
770-
printk(KERN_INFO "GDROM: Registered with major number %d\n",
769+
pr_info("Registered with major number %d\n",
771770
gdrom_major);
772771
/* Specify basic properties of drive */
773772
gd.cd_info = kzalloc(sizeof(struct cdrom_device_info), GFP_KERNEL);
@@ -818,7 +817,7 @@ static int __devinit probe_gdrom(struct platform_device *devptr)
818817
unregister_blkdev(gdrom_major, GDROM_DEV_NAME);
819818
gdrom_major = 0;
820819
probe_fail_no_mem:
821-
printk(KERN_WARNING "GDROM: Probe failed - error is 0x%X\n", err);
820+
pr_warning("Probe failed - error is 0x%X\n", err);
822821
return err;
823822
}
824823

0 commit comments

Comments
 (0)