--- 2.4.x/drivers/scsi/sd.c Sun Mar 25 20:31:18 2001 +++ linux/drivers/scsi/sd.c Tue May 15 12:41:02 2001 @@ -77,6 +77,7 @@ #define SD_TIMEOUT (30 * HZ) #define SD_MOD_TIMEOUT (75 * HZ) +#define sd_printk(a,b...) printk(KERN_INFO a,## b) struct hd_struct *sd; @@ -289,15 +290,15 @@ block = SCpnt->request.sector; this_count = SCpnt->request_bufflen >> 9; - SCSI_LOG_HLQUEUE(1, printk("Doing sd request, dev = %d, block = %d\n", devm, block)); + SCSI_LOG_HLQUEUE(1, sd_printk("Doing sd request, dev = %d, block = %d\n", devm, block)); dpnt = &rscsi_disks[dev]; if (devm >= (sd_template.dev_max << 4) || !dpnt || !dpnt->device->online || block + SCpnt->request.nr_sectors > sd[devm].nr_sects) { - SCSI_LOG_HLQUEUE(2, printk("Finishing %ld sectors\n", SCpnt->request.nr_sectors)); - SCSI_LOG_HLQUEUE(2, printk("Retry with 0x%p\n", SCpnt)); + SCSI_LOG_HLQUEUE(2, sd_printk("Finishing %ld sectors\n", SCpnt->request.nr_sectors)); + SCSI_LOG_HLQUEUE(2, sd_printk("Retry with 0x%p\n", SCpnt)); return 0; } block += sd[devm].start_sect; @@ -306,11 +307,11 @@ * quietly refuse to do anything to a changed disc until the changed * bit has been reset */ - /* printk("SCSI disk has been changed. Prohibiting further I/O.\n"); */ + /* sd_printk("SCSI disk has been changed. Prohibiting further I/O.\n"); */ return 0; } SCSI_LOG_HLQUEUE(2, sd_devname(devm, nbuff)); - SCSI_LOG_HLQUEUE(2, printk("%s : real dev = /dev/%d, block = %d\n", + SCSI_LOG_HLQUEUE(2, sd_printk("%s : real dev = /dev/%d, block = %d\n", nbuff, dev, block)); /* @@ -326,7 +327,7 @@ */ if (dpnt->device->sector_size == 1024) { if ((block & 1) || (SCpnt->request.nr_sectors & 1)) { - printk("sd.c:Bad block number requested"); + sd_printk("sd.c:Bad block number requested"); return 0; } else { block = block >> 1; @@ -335,7 +336,7 @@ } if (dpnt->device->sector_size == 2048) { if ((block & 3) || (SCpnt->request.nr_sectors & 3)) { - printk("sd.c:Bad block number requested"); + sd_printk("sd.c:Bad block number requested"); return 0; } else { block = block >> 2; @@ -344,7 +345,7 @@ } if (dpnt->device->sector_size == 4096) { if ((block & 7) || (SCpnt->request.nr_sectors & 7)) { - printk("sd.c:Bad block number requested"); + sd_printk("sd.c:Bad block number requested"); return 0; } else { block = block >> 3; @@ -367,7 +368,7 @@ panic("Unknown sd command %d\n", SCpnt->request.cmd); } - SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%ld 512 byte blocks.\n", + SCSI_LOG_HLQUEUE(2, sd_printk("%s : %s %d/%ld 512 byte blocks.\n", nbuff, (SCpnt->request.cmd == WRITE) ? "writing" : "reading", this_count, SCpnt->request.nr_sectors)); @@ -428,7 +429,7 @@ Scsi_Device * SDev; target = DEVICE_NR(inode->i_rdev); - SCSI_LOG_HLQUEUE(1, printk("target=%d, max=%d\n", target, sd_template.dev_max)); + SCSI_LOG_HLQUEUE(1, sd_printk("target=%d, max=%d\n", target, sd_template.dev_max)); if (target >= sd_template.dev_max || !rscsi_disks[target].device) return -ENXIO; /* No such device */ @@ -568,7 +569,7 @@ SCSI_LOG_HLCOMPLETE(1, sd_devname(DEVICE_NR(SCpnt->request.rq_dev), nbuff)); - SCSI_LOG_HLCOMPLETE(1, printk("%s : rw_intr(%d, %x [%x %x])\n", nbuff, + SCSI_LOG_HLCOMPLETE(1, sd_printk("%s : rw_intr(%d, %x [%x %x])\n", nbuff, SCpnt->host->host_no, result, SCpnt->sense_buffer[0], @@ -651,7 +652,7 @@ SDev = rscsi_disks[target].device; if (target >= sd_template.dev_max || !SDev) { - printk("SCSI disk request error: invalid device.\n"); + sd_printk("SCSI disk request error: invalid device.\n"); return 0; } if (!SDev->removable) @@ -785,7 +786,7 @@ SRpnt->sr_sense_buffer[2] == NOT_READY) { unsigned long time1; if (!spintime) { - printk("%s: Spinning up disk...", nbuff); + sd_printk("%s: Spinning up disk...", nbuff); cmd[0] = START_STOP; cmd[1] = (rscsi_disks[i].device->lun << 5) & 0xe0; cmd[1] |= 1; /* Return immediately */ @@ -807,15 +808,15 @@ current->state = TASK_UNINTERRUPTIBLE; time1 = schedule_timeout(time1); } while(time1); - printk("."); + sd_printk("."); } } while (the_result && spintime && time_after(spintime_value + 100 * HZ, jiffies)); if (spintime) { if (the_result) - printk("not responding...\n"); + sd_printk("not responding...\n"); else - printk("ready\n"); + sd_printk("ready\n"); } retries = 3; do { @@ -852,7 +853,7 @@ */ if (the_result) { - printk("%s : READ CAPACITY failed.\n" + sd_printk("%s : READ CAPACITY failed.\n" "%s : status = %x, message = %02x, host = %d, driver = %02x \n", nbuff, nbuff, status_byte(the_result), @@ -861,12 +862,12 @@ driver_byte(the_result) ); if (driver_byte(the_result) & DRIVER_SENSE) - printk("%s : extended sense code = %1x \n", + sd_printk("%s : extended sense code = %1x \n", nbuff, SRpnt->sr_sense_buffer[2] & 0xf); else - printk("%s : sense not available. \n", nbuff); + sd_printk("%s : sense not available. \n", nbuff); - printk("%s : block size assumed to be 512 bytes, disk size 1GB. \n", + sd_printk("%s : block size assumed to be 512 bytes, disk size 1GB. \n", nbuff); rscsi_disks[i].capacity = 0x1fffff; sector_size = 512; @@ -893,7 +894,7 @@ if (sector_size == 0) { sector_size = 512; - printk("%s : sector size 0 reported, assuming 512.\n", + sd_printk("%s : sector size 0 reported, assuming 512.\n", nbuff); } if (sector_size != 512 && @@ -901,7 +902,7 @@ sector_size != 2048 && sector_size != 4096 && sector_size != 256) { - printk("%s : unsupported sector size %d.\n", + sd_printk("%s : unsupported sector size %d.\n", nbuff, sector_size); /* * The user might want to re-format the drive with @@ -938,7 +939,7 @@ sd_hardsizes[m] = hard_sector; } - printk("SCSI device %s: " + sd_printk("SCSI device %s: " "%d %d-byte hdwr sectors (%d MB)\n", nbuff, rscsi_disks[i].capacity, hard_sector, (sz/2 - sz/1250 + 974)/1950); @@ -993,11 +994,11 @@ the_result = SRpnt->sr_result; if (the_result) { - printk("%s: test WP failed, assume Write Protected\n", nbuff); + sd_printk("%s: test WP failed, assume Write Protected\n", nbuff); rscsi_disks[i].write_prot = 1; } else { rscsi_disks[i].write_prot = ((buffer[2] & 0x80) != 0); - printk("%s: Write Protect is %s\n", nbuff, + sd_printk("%s: Write Protect is %s\n", nbuff, rscsi_disks[i].write_prot ? "on" : "off"); } @@ -1036,7 +1037,7 @@ if (!sd_registered) { for (i = 0; i < N_USED_SD_MAJORS; i++) { if (devfs_register_blkdev(SD_MAJOR(i), "sd", &sd_fops)) { - printk("Unable to get major %d for SCSI disk\n", SD_MAJOR(i)); + sd_printk("Unable to get major %d for SCSI disk\n", SD_MAJOR(i)); return 1; } } @@ -1190,7 +1191,7 @@ return 0; sd_devname(sd_template.dev_noticed++, nbuff); - printk("Detected scsi %sdisk %s at scsi%d, channel %d, id %d, lun %d\n", + sd_printk("Detected scsi %sdisk %s at scsi%d, channel %d, id %d, lun %d\n", SDp->removable ? "removable " : "", nbuff, SDp->host->host_no, SDp->channel, SDp->id, SDp->lun); @@ -1251,7 +1252,7 @@ target = DEVICE_NR(dev); if (DEVICE_BUSY || USAGE > maxusage) { - printk("Device busy for revalidation (usage=%d)\n", USAGE); + sd_printk("Device busy for revalidation (usage=%d)\n", USAGE); return -EBUSY; } DEVICE_BUSY = 1; @@ -1379,7 +1380,7 @@ } if (removed != N_USED_SD_MAJORS) - printk("%s %d sd_gendisks in disk chain", + sd_printk("%s %d sd_gendisks in disk chain", removed > N_USED_SD_MAJORS ? "total" : "just", removed); }