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[] = {
314316static 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 );
34933499done :
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
36663672static 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
0 commit comments