diff options
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r-- | drivers/scsi/sr.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 93cbd36c990..7eeb93627be 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -292,8 +292,8 @@ do_tur: if (!cd->tur_changed) { if (cd->get_event_changed) { if (cd->tur_mismatch++ > 8) { - sdev_printk(KERN_WARNING, cd->device, - "GET_EVENT and TUR disagree continuously, suppress GET_EVENT events\n"); + sr_printk(KERN_WARNING, cd, + "GET_EVENT and TUR disagree continuously, suppress GET_EVENT events\n"); cd->ignore_get_event = true; } } else { @@ -322,7 +322,7 @@ static int sr_done(struct scsi_cmnd *SCpnt) struct scsi_cd *cd = scsi_cd(SCpnt->request->rq_disk); #ifdef DEBUG - printk("sr.c done: %x\n", result); + scmd_printk(KERN_INFO, SCpnt, "done: %x\n", result); #endif /* @@ -385,10 +385,9 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) int block = 0, this_count, s_size; struct scsi_cd *cd; struct request *rq = SCpnt->request; - struct scsi_device *sdp = SCpnt->device; int ret; - ret = scsi_setup_fs_cmnd(sdp, rq); + ret = scsi_init_io(SCpnt, GFP_ATOMIC); if (ret != BLKPREP_OK) goto out; SCpnt = rq->special; @@ -398,13 +397,14 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) * is used for a killable error condition */ ret = BLKPREP_KILL; - SCSI_LOG_HLQUEUE(1, printk("Doing sr request, dev = %s, block = %d\n", - cd->disk->disk_name, block)); + SCSI_LOG_HLQUEUE(1, scmd_printk(KERN_INFO, SCpnt, + "Doing sr request, block = %d\n", block)); if (!cd->device || !scsi_device_online(cd->device)) { - SCSI_LOG_HLQUEUE(2, printk("Finishing %u sectors\n", - blk_rq_sectors(rq))); - SCSI_LOG_HLQUEUE(2, printk("Retry with 0x%p\n", SCpnt)); + SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, + "Finishing %u sectors\n", blk_rq_sectors(rq))); + SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, + "Retry with 0x%p\n", SCpnt)); goto out; } @@ -425,7 +425,8 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) if (!in_interrupt()) sr_set_blocklength(cd, 2048); else - printk("sr: can't switch blocksize: in interrupt\n"); + scmd_printk(KERN_INFO, SCpnt, + "can't switch blocksize: in interrupt\n"); } if (s_size != 512 && s_size != 1024 && s_size != 2048) { @@ -434,14 +435,12 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) } if (rq_data_dir(rq) == WRITE) { - if (!cd->device->writeable) + if (!cd->writeable) goto out; SCpnt->cmnd[0] = WRITE_10; - SCpnt->sc_data_direction = DMA_TO_DEVICE; - cd->cdi.media_written = 1; + cd->cdi.media_written = 1; } else if (rq_data_dir(rq) == READ) { SCpnt->cmnd[0] = READ_10; - SCpnt->sc_data_direction = DMA_FROM_DEVICE; } else { blk_dump_rq_flags(rq, "Unknown sr command"); goto out; @@ -475,11 +474,11 @@ static int sr_init_command(struct scsi_cmnd *SCpnt) this_count = (scsi_bufflen(SCpnt) >> 9) / (s_size >> 9); - SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%u 512 byte blocks.\n", - cd->cdi.name, - (rq_data_dir(rq) == WRITE) ? + SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, + "%s %d/%u 512 byte blocks.\n", + (rq_data_dir(rq) == WRITE) ? "writing" : "reading", - this_count, blk_rq_sectors(rq))); + this_count, blk_rq_sectors(rq))); SCpnt->cmnd[1] = 0; block = (unsigned int)blk_rq_pos(rq) / (s_size >> 9); @@ -810,8 +809,8 @@ static void get_sectorsize(struct scsi_cd *cd) case 512: break; default: - printk("%s: unsupported sector size %d.\n", - cd->cdi.name, sector_size); + sr_printk(KERN_INFO, cd, + "unsupported sector size %d.", sector_size); cd->capacity = 0; } @@ -853,7 +852,7 @@ static void get_capabilities(struct scsi_cd *cd) /* allocate transfer buffer */ buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); if (!buffer) { - printk(KERN_ERR "sr: out of memory.\n"); + sr_printk(KERN_ERR, cd, "out of memory.\n"); return; } @@ -872,7 +871,7 @@ static void get_capabilities(struct scsi_cd *cd) CDC_SELECT_DISC | CDC_SELECT_SPEED | CDC_MRW | CDC_MRW_W | CDC_RAM); kfree(buffer); - printk("%s: scsi-1 drive\n", cd->cdi.name); + sr_printk(KERN_INFO, cd, "scsi-1 drive"); return; } @@ -881,22 +880,23 @@ static void get_capabilities(struct scsi_cd *cd) cd->readcd_known = 1; cd->readcd_cdda = buffer[n + 5] & 0x01; /* print some capability bits */ - printk("%s: scsi3-mmc drive: %dx/%dx %s%s%s%s%s%s\n", cd->cdi.name, - ((buffer[n + 14] << 8) + buffer[n + 15]) / 176, - cd->cdi.speed, - buffer[n + 3] & 0x01 ? "writer " : "", /* CD Writer */ - buffer[n + 3] & 0x20 ? "dvd-ram " : "", - buffer[n + 2] & 0x02 ? "cd/rw " : "", /* can read rewriteable */ - buffer[n + 4] & 0x20 ? "xa/form2 " : "", /* can read xa/from2 */ - buffer[n + 5] & 0x01 ? "cdda " : "", /* can read audio data */ - loadmech[buffer[n + 6] >> 5]); + sr_printk(KERN_INFO, cd, + "scsi3-mmc drive: %dx/%dx %s%s%s%s%s%s\n", + ((buffer[n + 14] << 8) + buffer[n + 15]) / 176, + cd->cdi.speed, + buffer[n + 3] & 0x01 ? "writer " : "", /* CD Writer */ + buffer[n + 3] & 0x20 ? "dvd-ram " : "", + buffer[n + 2] & 0x02 ? "cd/rw " : "", /* can read rewriteable */ + buffer[n + 4] & 0x20 ? "xa/form2 " : "", /* can read xa/from2 */ + buffer[n + 5] & 0x01 ? "cdda " : "", /* can read audio data */ + loadmech[buffer[n + 6] >> 5]); if ((buffer[n + 6] >> 5) == 0) /* caddy drives can't close tray... */ cd->cdi.mask |= CDC_CLOSE_TRAY; if ((buffer[n + 2] & 0x8) == 0) /* not a DVD drive */ cd->cdi.mask |= CDC_DVD; - if ((buffer[n + 3] & 0x20) == 0) + if ((buffer[n + 3] & 0x20) == 0) /* can't write DVD-RAM media */ cd->cdi.mask |= CDC_DVD_RAM; if ((buffer[n + 3] & 0x10) == 0) @@ -927,7 +927,7 @@ static void get_capabilities(struct scsi_cd *cd) */ if ((cd->cdi.mask & (CDC_DVD_RAM | CDC_MRW_W | CDC_RAM | CDC_CD_RW)) != (CDC_DVD_RAM | CDC_MRW_W | CDC_RAM | CDC_CD_RW)) { - cd->device->writeable = 1; + cd->writeable = 1; } kfree(buffer); @@ -935,7 +935,7 @@ static void get_capabilities(struct scsi_cd *cd) /* * sr_packet() is the entry point for the generic commands generated - * by the Uniform CD-ROM layer. + * by the Uniform CD-ROM layer. */ static int sr_packet(struct cdrom_device_info *cdi, struct packet_command *cgc) |