aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sr.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2014-06-25 10:39:54 -0400
committerChristoph Hellwig <hch@lst.de>2014-07-17 16:07:39 -0400
commit96eefad2d9e5a0d988cdfee85193b6154c0ae1d2 (patch)
treee222b5850aef9e3dd77c69aabca0e36db752478e /drivers/scsi/sr.c
parentd9e5d6183715e691b37afd3785c311d05cd1338d (diff)
scsi: Implement sr_printk()
Update the sr driver to use dev_printk() variants instead of plain printk(); this will prefix logging messages with the appropriate device. Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r--drivers/scsi/sr.c61
1 files changed, 32 insertions, 29 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 93cbd36c990b..a7ea27c01286 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -292,8 +292,8 @@ do_tur:
292 if (!cd->tur_changed) { 292 if (!cd->tur_changed) {
293 if (cd->get_event_changed) { 293 if (cd->get_event_changed) {
294 if (cd->tur_mismatch++ > 8) { 294 if (cd->tur_mismatch++ > 8) {
295 sdev_printk(KERN_WARNING, cd->device, 295 sr_printk(KERN_WARNING, cd,
296 "GET_EVENT and TUR disagree continuously, suppress GET_EVENT events\n"); 296 "GET_EVENT and TUR disagree continuously, suppress GET_EVENT events\n");
297 cd->ignore_get_event = true; 297 cd->ignore_get_event = true;
298 } 298 }
299 } else { 299 } else {
@@ -322,7 +322,7 @@ static int sr_done(struct scsi_cmnd *SCpnt)
322 struct scsi_cd *cd = scsi_cd(SCpnt->request->rq_disk); 322 struct scsi_cd *cd = scsi_cd(SCpnt->request->rq_disk);
323 323
324#ifdef DEBUG 324#ifdef DEBUG
325 printk("sr.c done: %x\n", result); 325 scmd_printk(KERN_INFO, SCpnt, "done: %x\n", result);
326#endif 326#endif
327 327
328 /* 328 /*
@@ -398,13 +398,14 @@ static int sr_init_command(struct scsi_cmnd *SCpnt)
398 * is used for a killable error condition */ 398 * is used for a killable error condition */
399 ret = BLKPREP_KILL; 399 ret = BLKPREP_KILL;
400 400
401 SCSI_LOG_HLQUEUE(1, printk("Doing sr request, dev = %s, block = %d\n", 401 SCSI_LOG_HLQUEUE(1, scmd_printk(KERN_INFO, SCpnt,
402 cd->disk->disk_name, block)); 402 "Doing sr request, block = %d\n", block));
403 403
404 if (!cd->device || !scsi_device_online(cd->device)) { 404 if (!cd->device || !scsi_device_online(cd->device)) {
405 SCSI_LOG_HLQUEUE(2, printk("Finishing %u sectors\n", 405 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
406 blk_rq_sectors(rq))); 406 "Finishing %u sectors\n", blk_rq_sectors(rq)));
407 SCSI_LOG_HLQUEUE(2, printk("Retry with 0x%p\n", SCpnt)); 407 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
408 "Retry with 0x%p\n", SCpnt));
408 goto out; 409 goto out;
409 } 410 }
410 411
@@ -425,7 +426,8 @@ static int sr_init_command(struct scsi_cmnd *SCpnt)
425 if (!in_interrupt()) 426 if (!in_interrupt())
426 sr_set_blocklength(cd, 2048); 427 sr_set_blocklength(cd, 2048);
427 else 428 else
428 printk("sr: can't switch blocksize: in interrupt\n"); 429 scmd_printk(KERN_INFO, SCpnt,
430 "can't switch blocksize: in interrupt\n");
429 } 431 }
430 432
431 if (s_size != 512 && s_size != 1024 && s_size != 2048) { 433 if (s_size != 512 && s_size != 1024 && s_size != 2048) {
@@ -438,7 +440,7 @@ static int sr_init_command(struct scsi_cmnd *SCpnt)
438 goto out; 440 goto out;
439 SCpnt->cmnd[0] = WRITE_10; 441 SCpnt->cmnd[0] = WRITE_10;
440 SCpnt->sc_data_direction = DMA_TO_DEVICE; 442 SCpnt->sc_data_direction = DMA_TO_DEVICE;
441 cd->cdi.media_written = 1; 443 cd->cdi.media_written = 1;
442 } else if (rq_data_dir(rq) == READ) { 444 } else if (rq_data_dir(rq) == READ) {
443 SCpnt->cmnd[0] = READ_10; 445 SCpnt->cmnd[0] = READ_10;
444 SCpnt->sc_data_direction = DMA_FROM_DEVICE; 446 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
@@ -475,11 +477,11 @@ static int sr_init_command(struct scsi_cmnd *SCpnt)
475 this_count = (scsi_bufflen(SCpnt) >> 9) / (s_size >> 9); 477 this_count = (scsi_bufflen(SCpnt) >> 9) / (s_size >> 9);
476 478
477 479
478 SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%u 512 byte blocks.\n", 480 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
479 cd->cdi.name, 481 "%s %d/%u 512 byte blocks.\n",
480 (rq_data_dir(rq) == WRITE) ? 482 (rq_data_dir(rq) == WRITE) ?
481 "writing" : "reading", 483 "writing" : "reading",
482 this_count, blk_rq_sectors(rq))); 484 this_count, blk_rq_sectors(rq)));
483 485
484 SCpnt->cmnd[1] = 0; 486 SCpnt->cmnd[1] = 0;
485 block = (unsigned int)blk_rq_pos(rq) / (s_size >> 9); 487 block = (unsigned int)blk_rq_pos(rq) / (s_size >> 9);
@@ -810,8 +812,8 @@ static void get_sectorsize(struct scsi_cd *cd)
810 case 512: 812 case 512:
811 break; 813 break;
812 default: 814 default:
813 printk("%s: unsupported sector size %d.\n", 815 sr_printk(KERN_INFO, cd,
814 cd->cdi.name, sector_size); 816 "unsupported sector size %d.", sector_size);
815 cd->capacity = 0; 817 cd->capacity = 0;
816 } 818 }
817 819
@@ -853,7 +855,7 @@ static void get_capabilities(struct scsi_cd *cd)
853 /* allocate transfer buffer */ 855 /* allocate transfer buffer */
854 buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); 856 buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
855 if (!buffer) { 857 if (!buffer) {
856 printk(KERN_ERR "sr: out of memory.\n"); 858 sr_printk(KERN_ERR, cd, "out of memory.\n");
857 return; 859 return;
858 } 860 }
859 861
@@ -872,7 +874,7 @@ static void get_capabilities(struct scsi_cd *cd)
872 CDC_SELECT_DISC | CDC_SELECT_SPEED | 874 CDC_SELECT_DISC | CDC_SELECT_SPEED |
873 CDC_MRW | CDC_MRW_W | CDC_RAM); 875 CDC_MRW | CDC_MRW_W | CDC_RAM);
874 kfree(buffer); 876 kfree(buffer);
875 printk("%s: scsi-1 drive\n", cd->cdi.name); 877 sr_printk(KERN_INFO, cd, "scsi-1 drive");
876 return; 878 return;
877 } 879 }
878 880
@@ -881,22 +883,23 @@ static void get_capabilities(struct scsi_cd *cd)
881 cd->readcd_known = 1; 883 cd->readcd_known = 1;
882 cd->readcd_cdda = buffer[n + 5] & 0x01; 884 cd->readcd_cdda = buffer[n + 5] & 0x01;
883 /* print some capability bits */ 885 /* print some capability bits */
884 printk("%s: scsi3-mmc drive: %dx/%dx %s%s%s%s%s%s\n", cd->cdi.name, 886 sr_printk(KERN_INFO, cd,
885 ((buffer[n + 14] << 8) + buffer[n + 15]) / 176, 887 "scsi3-mmc drive: %dx/%dx %s%s%s%s%s%s\n",
886 cd->cdi.speed, 888 ((buffer[n + 14] << 8) + buffer[n + 15]) / 176,
887 buffer[n + 3] & 0x01 ? "writer " : "", /* CD Writer */ 889 cd->cdi.speed,
888 buffer[n + 3] & 0x20 ? "dvd-ram " : "", 890 buffer[n + 3] & 0x01 ? "writer " : "", /* CD Writer */
889 buffer[n + 2] & 0x02 ? "cd/rw " : "", /* can read rewriteable */ 891 buffer[n + 3] & 0x20 ? "dvd-ram " : "",
890 buffer[n + 4] & 0x20 ? "xa/form2 " : "", /* can read xa/from2 */ 892 buffer[n + 2] & 0x02 ? "cd/rw " : "", /* can read rewriteable */
891 buffer[n + 5] & 0x01 ? "cdda " : "", /* can read audio data */ 893 buffer[n + 4] & 0x20 ? "xa/form2 " : "", /* can read xa/from2 */
892 loadmech[buffer[n + 6] >> 5]); 894 buffer[n + 5] & 0x01 ? "cdda " : "", /* can read audio data */
895 loadmech[buffer[n + 6] >> 5]);
893 if ((buffer[n + 6] >> 5) == 0) 896 if ((buffer[n + 6] >> 5) == 0)
894 /* caddy drives can't close tray... */ 897 /* caddy drives can't close tray... */
895 cd->cdi.mask |= CDC_CLOSE_TRAY; 898 cd->cdi.mask |= CDC_CLOSE_TRAY;
896 if ((buffer[n + 2] & 0x8) == 0) 899 if ((buffer[n + 2] & 0x8) == 0)
897 /* not a DVD drive */ 900 /* not a DVD drive */
898 cd->cdi.mask |= CDC_DVD; 901 cd->cdi.mask |= CDC_DVD;
899 if ((buffer[n + 3] & 0x20) == 0) 902 if ((buffer[n + 3] & 0x20) == 0)
900 /* can't write DVD-RAM media */ 903 /* can't write DVD-RAM media */
901 cd->cdi.mask |= CDC_DVD_RAM; 904 cd->cdi.mask |= CDC_DVD_RAM;
902 if ((buffer[n + 3] & 0x10) == 0) 905 if ((buffer[n + 3] & 0x10) == 0)
@@ -935,7 +938,7 @@ static void get_capabilities(struct scsi_cd *cd)
935 938
936/* 939/*
937 * sr_packet() is the entry point for the generic commands generated 940 * sr_packet() is the entry point for the generic commands generated
938 * by the Uniform CD-ROM layer. 941 * by the Uniform CD-ROM layer.
939 */ 942 */
940static int sr_packet(struct cdrom_device_info *cdi, 943static int sr_packet(struct cdrom_device_info *cdi,
941 struct packet_command *cgc) 944 struct packet_command *cgc)