diff options
| author | James Bottomley <James.Bottomley@steeleye.com> | 2005-10-02 12:45:08 -0400 |
|---|---|---|
| committer | James Bottomley <jejb@mulgrave.(none)> | 2005-10-28 15:23:02 -0400 |
| commit | 9ccfc756a70d454dfa82f48897e2883560c01a0e (patch) | |
| tree | 9a6d3b10b1ec0e5fe7a63252a21598a03e93ad4e | |
| parent | 9a41a62b74388827998253d62c58707e63cc5874 (diff) | |
[SCSI] move the mid-layer printk's over to shost/starget/sdev_printk
This should eliminate (at least in the mid layer) to make numeric
assumptions about any of the enumeration variables. As a side effect,
it will also make all the messages consistent and line us up nicely for
the error logging strategy (if it ever shows itself again).
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
| -rw-r--r-- | drivers/scsi/constants.c | 5 | ||||
| -rw-r--r-- | drivers/scsi/hosts.c | 10 | ||||
| -rw-r--r-- | drivers/scsi/osst.c | 6 | ||||
| -rw-r--r-- | drivers/scsi/scsi.c | 21 | ||||
| -rw-r--r-- | drivers/scsi/scsi_error.c | 25 | ||||
| -rw-r--r-- | drivers/scsi/scsi_ioctl.c | 10 | ||||
| -rw-r--r-- | drivers/scsi/scsi_lib.c | 46 | ||||
| -rw-r--r-- | drivers/scsi/scsi_scan.c | 7 | ||||
| -rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 2 | ||||
| -rw-r--r-- | drivers/scsi/scsi_transport_spi.c | 24 | ||||
| -rw-r--r-- | drivers/scsi/sd.c | 10 | ||||
| -rw-r--r-- | drivers/scsi/sg.c | 14 | ||||
| -rw-r--r-- | drivers/scsi/sr.c | 15 | ||||
| -rw-r--r-- | drivers/scsi/st.c | 10 | ||||
| -rw-r--r-- | include/scsi/scsi_device.h | 6 | ||||
| -rw-r--r-- | include/scsi/scsi_host.h | 4 |
16 files changed, 96 insertions, 119 deletions
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index f6be2c1c3942..09bc81557b6e 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c | |||
| @@ -1389,10 +1389,7 @@ EXPORT_SYMBOL(scsi_print_msg); | |||
| 1389 | void scsi_print_command(struct scsi_cmnd *cmd) | 1389 | void scsi_print_command(struct scsi_cmnd *cmd) |
| 1390 | { | 1390 | { |
| 1391 | /* Assume appended output (i.e. not at start of line) */ | 1391 | /* Assume appended output (i.e. not at start of line) */ |
| 1392 | printk("scsi%d : destination target %d, lun %d\n", | 1392 | sdev_printk("", cmd->device, "\n"); |
| 1393 | cmd->device->host->host_no, | ||
| 1394 | cmd->device->id, | ||
| 1395 | cmd->device->lun); | ||
| 1396 | printk(KERN_INFO " command: "); | 1393 | printk(KERN_INFO " command: "); |
| 1397 | scsi_print_cdb(cmd->cmnd, cmd->cmd_len, 0); | 1394 | scsi_print_cdb(cmd->cmnd, cmd->cmd_len, 0); |
| 1398 | } | 1395 | } |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index f24d84538fd5..0d48c9ceebd3 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
| @@ -139,11 +139,11 @@ int scsi_host_set_state(struct Scsi_Host *shost, enum scsi_host_state state) | |||
| 139 | 139 | ||
| 140 | illegal: | 140 | illegal: |
| 141 | SCSI_LOG_ERROR_RECOVERY(1, | 141 | SCSI_LOG_ERROR_RECOVERY(1, |
| 142 | dev_printk(KERN_ERR, &shost->shost_gendev, | 142 | shost_printk(KERN_ERR, shost, |
| 143 | "Illegal host state transition" | 143 | "Illegal host state transition" |
| 144 | "%s->%s\n", | 144 | "%s->%s\n", |
| 145 | scsi_host_state_name(oldstate), | 145 | scsi_host_state_name(oldstate), |
| 146 | scsi_host_state_name(state))); | 146 | scsi_host_state_name(state))); |
| 147 | return -EINVAL; | 147 | return -EINVAL; |
| 148 | } | 148 | } |
| 149 | EXPORT_SYMBOL(scsi_host_set_state); | 149 | EXPORT_SYMBOL(scsi_host_set_state); |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index af1133104b3f..c1131c9cae64 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
| @@ -5819,9 +5819,9 @@ static int osst_probe(struct device *dev) | |||
| 5819 | } | 5819 | } |
| 5820 | drive->number = devfs_register_tape(SDp->devfs_name); | 5820 | drive->number = devfs_register_tape(SDp->devfs_name); |
| 5821 | 5821 | ||
| 5822 | printk(KERN_INFO | 5822 | dev_printk(KERN_INFO, &SDp->sdev_gendev, |
| 5823 | "osst :I: Attached OnStream %.5s tape at scsi%d, channel %d, id %d, lun %d as %s\n", | 5823 | "osst :I: Attached OnStream %.5s tape as %s\n", |
| 5824 | SDp->model, SDp->host->host_no, SDp->channel, SDp->id, SDp->lun, tape_name(tpnt)); | 5824 | SDp->model, tape_name(tpnt)); |
| 5825 | 5825 | ||
| 5826 | return 0; | 5826 | return 0; |
| 5827 | 5827 | ||
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index a5711d545d71..071d109b4b2a 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
| @@ -410,9 +410,7 @@ void scsi_log_send(struct scsi_cmnd *cmd) | |||
| 410 | SCSI_LOG_MLQUEUE_BITS); | 410 | SCSI_LOG_MLQUEUE_BITS); |
| 411 | if (level > 1) { | 411 | if (level > 1) { |
| 412 | sdev = cmd->device; | 412 | sdev = cmd->device; |
| 413 | printk(KERN_INFO "scsi <%d:%d:%d:%d> send ", | 413 | sdev_printk(KERN_INFO, sdev, "send "); |
| 414 | sdev->host->host_no, sdev->channel, sdev->id, | ||
| 415 | sdev->lun); | ||
| 416 | if (level > 2) | 414 | if (level > 2) |
| 417 | printk("0x%p ", cmd); | 415 | printk("0x%p ", cmd); |
| 418 | /* | 416 | /* |
| @@ -456,9 +454,7 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition) | |||
| 456 | if (((level > 0) && (cmd->result || disposition != SUCCESS)) || | 454 | if (((level > 0) && (cmd->result || disposition != SUCCESS)) || |
| 457 | (level > 1)) { | 455 | (level > 1)) { |
| 458 | sdev = cmd->device; | 456 | sdev = cmd->device; |
| 459 | printk(KERN_INFO "scsi <%d:%d:%d:%d> done ", | 457 | sdev_printk(KERN_INFO, sdev, "done "); |
| 460 | sdev->host->host_no, sdev->channel, sdev->id, | ||
| 461 | sdev->lun); | ||
| 462 | if (level > 2) | 458 | if (level > 2) |
| 463 | printk("0x%p ", cmd); | 459 | printk("0x%p ", cmd); |
| 464 | /* | 460 | /* |
| @@ -810,9 +806,9 @@ static void scsi_softirq(struct softirq_action *h) | |||
| 810 | disposition = scsi_decide_disposition(cmd); | 806 | disposition = scsi_decide_disposition(cmd); |
| 811 | if (disposition != SUCCESS && | 807 | if (disposition != SUCCESS && |
| 812 | time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) { | 808 | time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) { |
| 813 | dev_printk(KERN_ERR, &cmd->device->sdev_gendev, | 809 | sdev_printk(KERN_ERR, cmd->device, |
| 814 | "timing out command, waited %lus\n", | 810 | "timing out command, waited %lus\n", |
| 815 | wait_for/HZ); | 811 | wait_for/HZ); |
| 816 | disposition = SUCCESS; | 812 | disposition = SUCCESS; |
| 817 | } | 813 | } |
| 818 | 814 | ||
| @@ -970,10 +966,9 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags) | |||
| 970 | sdev->simple_tags = 1; | 966 | sdev->simple_tags = 1; |
| 971 | break; | 967 | break; |
| 972 | default: | 968 | default: |
| 973 | printk(KERN_WARNING "(scsi%d:%d:%d:%d) " | 969 | sdev_printk(KERN_WARNING, sdev, |
| 974 | "scsi_adjust_queue_depth, bad queue type, " | 970 | "scsi_adjust_queue_depth, bad queue type, " |
| 975 | "disabled\n", sdev->host->host_no, | 971 | "disabled\n"); |
| 976 | sdev->channel, sdev->id, sdev->lun); | ||
| 977 | case 0: | 972 | case 0: |
| 978 | sdev->ordered_tags = sdev->simple_tags = 0; | 973 | sdev->ordered_tags = sdev->simple_tags = 0; |
| 979 | sdev->queue_depth = tags; | 974 | sdev->queue_depth = tags; |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 52b348c36d56..dd6a9f61bdf1 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
| @@ -241,11 +241,10 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost, | |||
| 241 | 241 | ||
| 242 | if (cmd_cancel || cmd_failed) { | 242 | if (cmd_cancel || cmd_failed) { |
| 243 | SCSI_LOG_ERROR_RECOVERY(3, | 243 | SCSI_LOG_ERROR_RECOVERY(3, |
| 244 | printk("%s: %d:%d:%d:%d cmds failed: %d," | 244 | sdev_printk(KERN_INFO, sdev, |
| 245 | " cancel: %d\n", | 245 | "%s: cmds failed: %d, cancel: %d\n", |
| 246 | __FUNCTION__, shost->host_no, | 246 | __FUNCTION__, cmd_failed, |
| 247 | sdev->channel, sdev->id, sdev->lun, | 247 | cmd_cancel)); |
| 248 | cmd_failed, cmd_cancel)); | ||
| 249 | cmd_cancel = 0; | 248 | cmd_cancel = 0; |
| 250 | cmd_failed = 0; | 249 | cmd_failed = 0; |
| 251 | ++devices_failed; | 250 | ++devices_failed; |
| @@ -1174,13 +1173,9 @@ static void scsi_eh_offline_sdevs(struct list_head *work_q, | |||
| 1174 | struct scsi_cmnd *scmd, *next; | 1173 | struct scsi_cmnd *scmd, *next; |
| 1175 | 1174 | ||
| 1176 | list_for_each_entry_safe(scmd, next, work_q, eh_entry) { | 1175 | list_for_each_entry_safe(scmd, next, work_q, eh_entry) { |
| 1177 | printk(KERN_INFO "scsi: Device offlined - not" | 1176 | sdev_printk(KERN_INFO, scmd->device, |
| 1178 | " ready after error recovery: host" | 1177 | "scsi: Device offlined - not" |
| 1179 | " %d channel %d id %d lun %d\n", | 1178 | " ready after error recovery\n"); |
| 1180 | scmd->device->host->host_no, | ||
| 1181 | scmd->device->channel, | ||
| 1182 | scmd->device->id, | ||
| 1183 | scmd->device->lun); | ||
| 1184 | scsi_device_set_state(scmd->device, SDEV_OFFLINE); | 1179 | scsi_device_set_state(scmd->device, SDEV_OFFLINE); |
| 1185 | if (scmd->eh_eflags & SCSI_EH_CANCEL_CMD) { | 1180 | if (scmd->eh_eflags & SCSI_EH_CANCEL_CMD) { |
| 1186 | /* | 1181 | /* |
| @@ -1342,10 +1337,8 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) | |||
| 1342 | return SUCCESS; | 1337 | return SUCCESS; |
| 1343 | 1338 | ||
| 1344 | case RESERVATION_CONFLICT: | 1339 | case RESERVATION_CONFLICT: |
| 1345 | printk(KERN_INFO "scsi: reservation conflict: host" | 1340 | sdev_printk(KERN_INFO, scmd->device, |
| 1346 | " %d channel %d id %d lun %d\n", | 1341 | "reservation conflict\n"); |
| 1347 | scmd->device->host->host_no, scmd->device->channel, | ||
| 1348 | scmd->device->id, scmd->device->lun); | ||
| 1349 | return SUCCESS; /* causes immediate i/o error */ | 1342 | return SUCCESS; /* causes immediate i/o error */ |
| 1350 | default: | 1343 | default: |
| 1351 | return FAILED; | 1344 | return FAILED; |
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 6a3f6aae8a97..26f5bc6d9c82 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c | |||
| @@ -122,13 +122,9 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd, | |||
| 122 | break; | 122 | break; |
| 123 | } | 123 | } |
| 124 | default: /* Fall through for non-removable media */ | 124 | default: /* Fall through for non-removable media */ |
| 125 | printk(KERN_INFO "ioctl_internal_command: <%d %d %d " | 125 | sdev_printk(KERN_INFO, sdev, |
| 126 | "%d> return code = %x\n", | 126 | "ioctl_internal_command return code = %x\n", |
| 127 | sdev->host->host_no, | 127 | result); |
| 128 | sdev->channel, | ||
| 129 | sdev->id, | ||
| 130 | sdev->lun, | ||
| 131 | result); | ||
| 132 | scsi_print_sense_hdr(" ", &sshdr); | 128 | scsi_print_sense_hdr(" ", &sshdr); |
| 133 | break; | 129 | break; |
| 134 | } | 130 | } |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 3ff538809786..19ac888001e6 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -951,16 +951,16 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes, | |||
| 951 | return; | 951 | return; |
| 952 | } | 952 | } |
| 953 | if (!(req->flags & REQ_QUIET)) | 953 | if (!(req->flags & REQ_QUIET)) |
| 954 | dev_printk(KERN_INFO, | 954 | sdev_printk(KERN_INFO, |
| 955 | &cmd->device->sdev_gendev, | 955 | cmd->device, |
| 956 | "Device not ready.\n"); | 956 | "Device not ready.\n"); |
| 957 | scsi_end_request(cmd, 0, this_count, 1); | 957 | scsi_end_request(cmd, 0, this_count, 1); |
| 958 | return; | 958 | return; |
| 959 | case VOLUME_OVERFLOW: | 959 | case VOLUME_OVERFLOW: |
| 960 | if (!(req->flags & REQ_QUIET)) { | 960 | if (!(req->flags & REQ_QUIET)) { |
| 961 | dev_printk(KERN_INFO, | 961 | sdev_printk(KERN_INFO, |
| 962 | &cmd->device->sdev_gendev, | 962 | cmd->device, |
| 963 | "Volume overflow, CDB: "); | 963 | "Volume overflow, CDB: "); |
| 964 | __scsi_print_command(cmd->data_cmnd); | 964 | __scsi_print_command(cmd->data_cmnd); |
| 965 | scsi_print_sense("", cmd); | 965 | scsi_print_sense("", cmd); |
| 966 | } | 966 | } |
| @@ -981,8 +981,9 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes, | |||
| 981 | } | 981 | } |
| 982 | if (result) { | 982 | if (result) { |
| 983 | if (!(req->flags & REQ_QUIET)) { | 983 | if (!(req->flags & REQ_QUIET)) { |
| 984 | dev_printk(KERN_INFO, &cmd->device->sdev_gendev, | 984 | sdev_printk(KERN_INFO, cmd->device, |
| 985 | "SCSI error: return code = 0x%x\n", result); | 985 | "SCSI error: return code = 0x%x\n", |
| 986 | result); | ||
| 986 | 987 | ||
| 987 | if (driver_byte(result) & DRIVER_SENSE) | 988 | if (driver_byte(result) & DRIVER_SENSE) |
| 988 | scsi_print_sense("", cmd); | 989 | scsi_print_sense("", cmd); |
| @@ -1141,8 +1142,8 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) | |||
| 1141 | * online before trying any recovery commands | 1142 | * online before trying any recovery commands |
| 1142 | */ | 1143 | */ |
| 1143 | if (unlikely(!scsi_device_online(sdev))) { | 1144 | if (unlikely(!scsi_device_online(sdev))) { |
| 1144 | printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n", | 1145 | sdev_printk(KERN_ERR, sdev, |
| 1145 | sdev->host->host_no, sdev->id, sdev->lun); | 1146 | "rejecting I/O to offline device\n"); |
| 1146 | goto kill; | 1147 | goto kill; |
| 1147 | } | 1148 | } |
| 1148 | if (unlikely(sdev->sdev_state != SDEV_RUNNING)) { | 1149 | if (unlikely(sdev->sdev_state != SDEV_RUNNING)) { |
| @@ -1151,8 +1152,8 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) | |||
| 1151 | if (sdev->sdev_state == SDEV_DEL) { | 1152 | if (sdev->sdev_state == SDEV_DEL) { |
| 1152 | /* Device is fully deleted, no commands | 1153 | /* Device is fully deleted, no commands |
| 1153 | * at all allowed down */ | 1154 | * at all allowed down */ |
| 1154 | printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to dead device\n", | 1155 | sdev_printk(KERN_ERR, sdev, |
| 1155 | sdev->host->host_no, sdev->id, sdev->lun); | 1156 | "rejecting I/O to dead device\n"); |
| 1156 | goto kill; | 1157 | goto kill; |
| 1157 | } | 1158 | } |
| 1158 | /* OK, we only allow special commands (i.e. not | 1159 | /* OK, we only allow special commands (i.e. not |
| @@ -1187,8 +1188,8 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) | |||
| 1187 | specials_only == SDEV_BLOCK) | 1188 | specials_only == SDEV_BLOCK) |
| 1188 | goto defer; | 1189 | goto defer; |
| 1189 | 1190 | ||
| 1190 | printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to device being removed\n", | 1191 | sdev_printk(KERN_ERR, sdev, |
| 1191 | sdev->host->host_no, sdev->id, sdev->lun); | 1192 | "rejecting I/O to device being removed\n"); |
| 1192 | goto kill; | 1193 | goto kill; |
| 1193 | } | 1194 | } |
| 1194 | 1195 | ||
| @@ -1315,9 +1316,8 @@ static inline int scsi_dev_queue_ready(struct request_queue *q, | |||
| 1315 | */ | 1316 | */ |
| 1316 | if (--sdev->device_blocked == 0) { | 1317 | if (--sdev->device_blocked == 0) { |
| 1317 | SCSI_LOG_MLQUEUE(3, | 1318 | SCSI_LOG_MLQUEUE(3, |
| 1318 | printk("scsi%d (%d:%d) unblocking device at" | 1319 | sdev_printk(KERN_INFO, sdev, |
| 1319 | " zero depth\n", sdev->host->host_no, | 1320 | "unblocking device at zero depth\n")); |
| 1320 | sdev->id, sdev->lun)); | ||
| 1321 | } else { | 1321 | } else { |
| 1322 | blk_plug_device(q); | 1322 | blk_plug_device(q); |
| 1323 | return 0; | 1323 | return 0; |
| @@ -1436,8 +1436,8 @@ static void scsi_request_fn(struct request_queue *q) | |||
| 1436 | break; | 1436 | break; |
| 1437 | 1437 | ||
| 1438 | if (unlikely(!scsi_device_online(sdev))) { | 1438 | if (unlikely(!scsi_device_online(sdev))) { |
| 1439 | printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n", | 1439 | sdev_printk(KERN_ERR, sdev, |
| 1440 | sdev->host->host_no, sdev->id, sdev->lun); | 1440 | "rejecting I/O to offline device\n"); |
| 1441 | scsi_kill_request(req, q); | 1441 | scsi_kill_request(req, q); |
| 1442 | continue; | 1442 | continue; |
| 1443 | } | 1443 | } |
| @@ -1893,10 +1893,10 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state) | |||
| 1893 | 1893 | ||
| 1894 | illegal: | 1894 | illegal: |
| 1895 | SCSI_LOG_ERROR_RECOVERY(1, | 1895 | SCSI_LOG_ERROR_RECOVERY(1, |
| 1896 | dev_printk(KERN_ERR, &sdev->sdev_gendev, | 1896 | sdev_printk(KERN_ERR, sdev, |
| 1897 | "Illegal state transition %s->%s\n", | 1897 | "Illegal state transition %s->%s\n", |
| 1898 | scsi_device_state_name(oldstate), | 1898 | scsi_device_state_name(oldstate), |
| 1899 | scsi_device_state_name(state)) | 1899 | scsi_device_state_name(state)) |
| 1900 | ); | 1900 | ); |
| 1901 | return -EINVAL; | 1901 | return -EINVAL; |
| 1902 | } | 1902 | } |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 327c5d7e5bd2..ce8456c3b718 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
| @@ -462,10 +462,9 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result, | |||
| 462 | pass = 1; | 462 | pass = 1; |
| 463 | 463 | ||
| 464 | next_pass: | 464 | next_pass: |
| 465 | SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY pass %d " | 465 | SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev, |
| 466 | "to host %d channel %d id %d lun %d, length %d\n", | 466 | "scsi scan: INQUIRY pass %d length %d\n", |
| 467 | pass, sdev->host->host_no, sdev->channel, | 467 | pass, try_inquiry_len)); |
| 468 | sdev->id, sdev->lun, try_inquiry_len)); | ||
| 469 | 468 | ||
| 470 | /* Each pass gets up to three chances to ignore Unit Attention */ | 469 | /* Each pass gets up to three chances to ignore Unit Attention */ |
| 471 | for (count = 0; count < 3; ++count) { | 470 | for (count = 0; count < 3; ++count) { |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 771e97ef136e..473a82d5e3e2 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
| @@ -32,8 +32,6 @@ | |||
| 32 | #include <scsi/scsi_transport_fc.h> | 32 | #include <scsi/scsi_transport_fc.h> |
| 33 | #include "scsi_priv.h" | 33 | #include "scsi_priv.h" |
| 34 | 34 | ||
| 35 | #define FC_PRINTK(x, l, f, a...) printk(l "scsi(%d:%d:%d:%d): " f, (x)->host->host_no, (x)->channel, (x)->id, (x)->lun , ##a) | ||
| 36 | |||
| 37 | /* | 35 | /* |
| 38 | * Redefine so that we can have same named attributes in the | 36 | * Redefine so that we can have same named attributes in the |
| 39 | * sdev/starget/host objects. | 37 | * sdev/starget/host objects. |
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index ef577c8c2182..718a2bc4ed5e 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c | |||
| @@ -33,8 +33,6 @@ | |||
| 33 | #include <scsi/scsi_transport.h> | 33 | #include <scsi/scsi_transport.h> |
| 34 | #include <scsi/scsi_transport_spi.h> | 34 | #include <scsi/scsi_transport_spi.h> |
| 35 | 35 | ||
| 36 | #define SPI_PRINTK(x, l, f, a...) dev_printk(l, &(x)->dev, f , ##a) | ||
| 37 | |||
| 38 | #define SPI_NUM_ATTRS 14 /* increase this if you add attributes */ | 36 | #define SPI_NUM_ATTRS 14 /* increase this if you add attributes */ |
| 39 | #define SPI_OTHER_ATTRS 1 /* Increase this if you add "always | 37 | #define SPI_OTHER_ATTRS 1 /* Increase this if you add "always |
| 40 | * on" attributes */ | 38 | * on" attributes */ |
| @@ -618,7 +616,7 @@ spi_dv_device_echo_buffer(struct scsi_device *sdev, u8 *buffer, | |||
| 618 | return SPI_COMPARE_SKIP_TEST; | 616 | return SPI_COMPARE_SKIP_TEST; |
| 619 | 617 | ||
| 620 | 618 | ||
| 621 | SPI_PRINTK(sdev->sdev_target, KERN_ERR, "Write Buffer failure %x\n", result); | 619 | sdev_printk(KERN_ERR, sdev, "Write Buffer failure %x\n", result); |
| 622 | return SPI_COMPARE_FAILURE; | 620 | return SPI_COMPARE_FAILURE; |
| 623 | } | 621 | } |
| 624 | 622 | ||
| @@ -702,10 +700,10 @@ spi_dv_retrain(struct scsi_device *sdev, u8 *buffer, u8 *ptr, | |||
| 702 | * IU, then QAS (if we can control them), then finally | 700 | * IU, then QAS (if we can control them), then finally |
| 703 | * fall down the periods */ | 701 | * fall down the periods */ |
| 704 | if (i->f->set_iu && spi_iu(starget)) { | 702 | if (i->f->set_iu && spi_iu(starget)) { |
| 705 | SPI_PRINTK(starget, KERN_ERR, "Domain Validation Disabing Information Units\n"); | 703 | starget_printk(KERN_ERR, starget, "Domain Validation Disabing Information Units\n"); |
| 706 | DV_SET(iu, 0); | 704 | DV_SET(iu, 0); |
| 707 | } else if (i->f->set_qas && spi_qas(starget)) { | 705 | } else if (i->f->set_qas && spi_qas(starget)) { |
| 708 | SPI_PRINTK(starget, KERN_ERR, "Domain Validation Disabing Quick Arbitration and Selection\n"); | 706 | starget_printk(KERN_ERR, starget, "Domain Validation Disabing Quick Arbitration and Selection\n"); |
| 709 | DV_SET(qas, 0); | 707 | DV_SET(qas, 0); |
| 710 | } else { | 708 | } else { |
| 711 | newperiod = spi_period(starget); | 709 | newperiod = spi_period(starget); |
| @@ -717,11 +715,11 @@ spi_dv_retrain(struct scsi_device *sdev, u8 *buffer, u8 *ptr, | |||
| 717 | 715 | ||
| 718 | if (unlikely(period > 0xff || period == prevperiod)) { | 716 | if (unlikely(period > 0xff || period == prevperiod)) { |
| 719 | /* Total failure; set to async and return */ | 717 | /* Total failure; set to async and return */ |
| 720 | SPI_PRINTK(starget, KERN_ERR, "Domain Validation Failure, dropping back to Asynchronous\n"); | 718 | starget_printk(KERN_ERR, starget, "Domain Validation Failure, dropping back to Asynchronous\n"); |
| 721 | DV_SET(offset, 0); | 719 | DV_SET(offset, 0); |
| 722 | return SPI_COMPARE_FAILURE; | 720 | return SPI_COMPARE_FAILURE; |
| 723 | } | 721 | } |
| 724 | SPI_PRINTK(starget, KERN_ERR, "Domain Validation detected failure, dropping back\n"); | 722 | starget_printk(KERN_ERR, starget, "Domain Validation detected failure, dropping back\n"); |
| 725 | DV_SET(period, period); | 723 | DV_SET(period, period); |
| 726 | prevperiod = period; | 724 | prevperiod = period; |
| 727 | } | 725 | } |
| @@ -788,7 +786,7 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) | |||
| 788 | 786 | ||
| 789 | if (spi_dv_device_compare_inquiry(sdev, buffer, buffer, DV_LOOPS) | 787 | if (spi_dv_device_compare_inquiry(sdev, buffer, buffer, DV_LOOPS) |
| 790 | != SPI_COMPARE_SUCCESS) { | 788 | != SPI_COMPARE_SUCCESS) { |
| 791 | SPI_PRINTK(starget, KERN_ERR, "Domain Validation Initial Inquiry Failed\n"); | 789 | starget_printk(KERN_ERR, starget, "Domain Validation Initial Inquiry Failed\n"); |
| 792 | /* FIXME: should probably offline the device here? */ | 790 | /* FIXME: should probably offline the device here? */ |
| 793 | return; | 791 | return; |
| 794 | } | 792 | } |
| @@ -802,7 +800,7 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) | |||
| 802 | buffer + len, | 800 | buffer + len, |
| 803 | DV_LOOPS) | 801 | DV_LOOPS) |
| 804 | != SPI_COMPARE_SUCCESS) { | 802 | != SPI_COMPARE_SUCCESS) { |
| 805 | SPI_PRINTK(starget, KERN_ERR, "Wide Transfers Fail\n"); | 803 | starget_printk(KERN_ERR, starget, "Wide Transfers Fail\n"); |
| 806 | i->f->set_width(starget, 0); | 804 | i->f->set_width(starget, 0); |
| 807 | } | 805 | } |
| 808 | } | 806 | } |
| @@ -844,14 +842,14 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer) | |||
| 844 | } | 842 | } |
| 845 | 843 | ||
| 846 | if (len == 0) { | 844 | if (len == 0) { |
| 847 | SPI_PRINTK(starget, KERN_INFO, "Domain Validation skipping write tests\n"); | 845 | starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n"); |
| 848 | spi_dv_retrain(sdev, buffer, buffer + len, | 846 | spi_dv_retrain(sdev, buffer, buffer + len, |
| 849 | spi_dv_device_compare_inquiry); | 847 | spi_dv_device_compare_inquiry); |
| 850 | return; | 848 | return; |
| 851 | } | 849 | } |
| 852 | 850 | ||
| 853 | if (len > SPI_MAX_ECHO_BUFFER_SIZE) { | 851 | if (len > SPI_MAX_ECHO_BUFFER_SIZE) { |
| 854 | SPI_PRINTK(starget, KERN_WARNING, "Echo buffer size %d is too big, trimming to %d\n", len, SPI_MAX_ECHO_BUFFER_SIZE); | 852 | starget_printk(KERN_WARNING, starget, "Echo buffer size %d is too big, trimming to %d\n", len, SPI_MAX_ECHO_BUFFER_SIZE); |
| 855 | len = SPI_MAX_ECHO_BUFFER_SIZE; | 853 | len = SPI_MAX_ECHO_BUFFER_SIZE; |
| 856 | } | 854 | } |
| 857 | 855 | ||
| @@ -902,11 +900,11 @@ spi_dv_device(struct scsi_device *sdev) | |||
| 902 | spi_dv_pending(starget) = 1; | 900 | spi_dv_pending(starget) = 1; |
| 903 | down(&spi_dv_sem(starget)); | 901 | down(&spi_dv_sem(starget)); |
| 904 | 902 | ||
| 905 | SPI_PRINTK(starget, KERN_INFO, "Beginning Domain Validation\n"); | 903 | starget_printk(KERN_INFO, starget, "Beginning Domain Validation\n"); |
| 906 | 904 | ||
| 907 | spi_dv_device_internal(sdev, buffer); | 905 | spi_dv_device_internal(sdev, buffer); |
| 908 | 906 | ||
| 909 | SPI_PRINTK(starget, KERN_INFO, "Ending Domain Validation\n"); | 907 | starget_printk(KERN_INFO, starget, "Ending Domain Validation\n"); |
| 910 | 908 | ||
| 911 | up(&spi_dv_sem(starget)); | 909 | up(&spi_dv_sem(starget)); |
| 912 | spi_dv_pending(starget) = 0; | 910 | spi_dv_pending(starget) = 0; |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 98da5c8057bf..9de8e186cb69 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
| @@ -1534,8 +1534,8 @@ static int sd_probe(struct device *dev) | |||
| 1534 | if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD && sdp->type != TYPE_RBC) | 1534 | if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD && sdp->type != TYPE_RBC) |
| 1535 | goto out; | 1535 | goto out; |
| 1536 | 1536 | ||
| 1537 | SCSI_LOG_HLQUEUE(3, printk("sd_attach: scsi device: <%d,%d,%d,%d>\n", | 1537 | SCSI_LOG_HLQUEUE(3, sdev_printk(KERN_INFO, sdp, |
| 1538 | sdp->host->host_no, sdp->channel, sdp->id, sdp->lun)); | 1538 | "sd_attach\n")); |
| 1539 | 1539 | ||
| 1540 | error = -ENOMEM; | 1540 | error = -ENOMEM; |
| 1541 | sdkp = kmalloc(sizeof(*sdkp), GFP_KERNEL); | 1541 | sdkp = kmalloc(sizeof(*sdkp), GFP_KERNEL); |
| @@ -1607,10 +1607,8 @@ static int sd_probe(struct device *dev) | |||
| 1607 | dev_set_drvdata(dev, sdkp); | 1607 | dev_set_drvdata(dev, sdkp); |
| 1608 | add_disk(gd); | 1608 | add_disk(gd); |
| 1609 | 1609 | ||
| 1610 | printk(KERN_NOTICE "Attached scsi %sdisk %s at scsi%d, channel %d, " | 1610 | sdev_printk(KERN_NOTICE, sdp, "Attached scsi %sdisk %s\n", |
| 1611 | "id %d, lun %d\n", sdp->removable ? "removable " : "", | 1611 | sdp->removable ? "removable " : "", gd->disk_name); |
| 1612 | gd->disk_name, sdp->host->host_no, sdp->channel, | ||
| 1613 | sdp->id, sdp->lun); | ||
| 1614 | 1612 | ||
| 1615 | return 0; | 1613 | return 0; |
| 1616 | 1614 | ||
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index fd56b7ec88b6..49b9269d487a 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
| @@ -1497,10 +1497,9 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) | |||
| 1497 | 1497 | ||
| 1498 | overflow: | 1498 | overflow: |
| 1499 | write_unlock_irqrestore(&sg_dev_arr_lock, iflags); | 1499 | write_unlock_irqrestore(&sg_dev_arr_lock, iflags); |
| 1500 | printk(KERN_WARNING | 1500 | sdev_printk(KERN_WARNING, scsidp, |
| 1501 | "Unable to attach sg device <%d, %d, %d, %d> type=%d, minor " | 1501 | "Unable to attach sg device type=%d, minor " |
| 1502 | "number exceeds %d\n", scsidp->host->host_no, scsidp->channel, | 1502 | "number exceeds %d\n", scsidp->type, SG_MAX_DEVS - 1); |
| 1503 | scsidp->id, scsidp->lun, scsidp->type, SG_MAX_DEVS - 1); | ||
| 1504 | error = -ENODEV; | 1503 | error = -ENODEV; |
| 1505 | goto out; | 1504 | goto out; |
| 1506 | } | 1505 | } |
| @@ -1566,11 +1565,8 @@ sg_add(struct class_device *cl_dev) | |||
| 1566 | } else | 1565 | } else |
| 1567 | printk(KERN_WARNING "sg_add: sg_sys INvalid\n"); | 1566 | printk(KERN_WARNING "sg_add: sg_sys INvalid\n"); |
| 1568 | 1567 | ||
| 1569 | printk(KERN_NOTICE | 1568 | sdev_printk(KERN_NOTICE, scsidp, |
| 1570 | "Attached scsi generic sg%d at scsi%d, channel" | 1569 | "Attached scsi generic sg%d type %d\n", k,scsidp->type); |
| 1571 | " %d, id %d, lun %d, type %d\n", k, | ||
| 1572 | scsidp->host->host_no, scsidp->channel, scsidp->id, | ||
| 1573 | scsidp->lun, scsidp->type); | ||
| 1574 | 1570 | ||
| 1575 | return 0; | 1571 | return 0; |
| 1576 | 1572 | ||
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 561901b1cf11..9e267c6d3a43 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
| @@ -360,7 +360,7 @@ static int sr_init_command(struct scsi_cmnd * SCpnt) | |||
| 360 | } | 360 | } |
| 361 | 361 | ||
| 362 | if (s_size != 512 && s_size != 1024 && s_size != 2048) { | 362 | if (s_size != 512 && s_size != 1024 && s_size != 2048) { |
| 363 | printk("sr: bad sector size %d\n", s_size); | 363 | sdev_printk(KERN_ERR, SCpnt->device, "bad sector size %d\n", s_size); |
| 364 | return 0; | 364 | return 0; |
| 365 | } | 365 | } |
| 366 | 366 | ||
| @@ -385,8 +385,9 @@ static int sr_init_command(struct scsi_cmnd * SCpnt) | |||
| 385 | size += sg[i].length; | 385 | size += sg[i].length; |
| 386 | 386 | ||
| 387 | if (size != SCpnt->request_bufflen && SCpnt->use_sg) { | 387 | if (size != SCpnt->request_bufflen && SCpnt->use_sg) { |
| 388 | printk(KERN_ERR "sr: mismatch count %d, bytes %d\n", | 388 | sdev_printk(KERN_ERR, SCpnt->device, |
| 389 | size, SCpnt->request_bufflen); | 389 | "mismatch count %d, bytes %d\n", |
| 390 | size, SCpnt->request_bufflen); | ||
| 390 | if (SCpnt->request_bufflen > size) | 391 | if (SCpnt->request_bufflen > size) |
| 391 | SCpnt->request_bufflen = SCpnt->bufflen = size; | 392 | SCpnt->request_bufflen = SCpnt->bufflen = size; |
| 392 | } | 393 | } |
| @@ -397,7 +398,7 @@ static int sr_init_command(struct scsi_cmnd * SCpnt) | |||
| 397 | */ | 398 | */ |
| 398 | if (((unsigned int)SCpnt->request->sector % (s_size >> 9)) || | 399 | if (((unsigned int)SCpnt->request->sector % (s_size >> 9)) || |
| 399 | (SCpnt->request_bufflen % s_size)) { | 400 | (SCpnt->request_bufflen % s_size)) { |
| 400 | printk("sr: unaligned transfer\n"); | 401 | sdev_printk(KERN_NOTICE, SCpnt->device, "unaligned transfer\n"); |
| 401 | return 0; | 402 | return 0; |
| 402 | } | 403 | } |
| 403 | 404 | ||
| @@ -622,10 +623,8 @@ static int sr_probe(struct device *dev) | |||
| 622 | disk->flags |= GENHD_FL_REMOVABLE; | 623 | disk->flags |= GENHD_FL_REMOVABLE; |
| 623 | add_disk(disk); | 624 | add_disk(disk); |
| 624 | 625 | ||
| 625 | printk(KERN_DEBUG | 626 | sdev_printk(KERN_DEBUG, sdev, |
| 626 | "Attached scsi CD-ROM %s at scsi%d, channel %d, id %d, lun %d\n", | 627 | "Attached scsi CD-ROM %s\n", cd->cdi.name); |
| 627 | cd->cdi.name, sdev->host->host_no, sdev->channel, | ||
| 628 | sdev->id, sdev->lun); | ||
| 629 | return 0; | 628 | return 0; |
| 630 | 629 | ||
| 631 | fail_put: | 630 | fail_put: |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 927d700f0073..dc5ffc16a252 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
| @@ -3887,9 +3887,8 @@ static int st_probe(struct device *dev) | |||
| 3887 | if (SDp->type != TYPE_TAPE) | 3887 | if (SDp->type != TYPE_TAPE) |
| 3888 | return -ENODEV; | 3888 | return -ENODEV; |
| 3889 | if ((stp = st_incompatible(SDp))) { | 3889 | if ((stp = st_incompatible(SDp))) { |
| 3890 | printk(KERN_INFO | 3890 | sdev_printk(KERN_INFO, SDp, |
| 3891 | "st: Found incompatible tape at scsi%d, channel %d, id %d, lun %d\n", | 3891 | "Found incompatible tape\n"); |
| 3892 | SDp->host->host_no, SDp->channel, SDp->id, SDp->lun); | ||
| 3893 | printk(KERN_INFO "st: The suggested driver is %s.\n", stp); | 3892 | printk(KERN_INFO "st: The suggested driver is %s.\n", stp); |
| 3894 | return -ENODEV; | 3893 | return -ENODEV; |
| 3895 | } | 3894 | } |
| @@ -4077,9 +4076,8 @@ static int st_probe(struct device *dev) | |||
| 4077 | } | 4076 | } |
| 4078 | disk->number = devfs_register_tape(SDp->devfs_name); | 4077 | disk->number = devfs_register_tape(SDp->devfs_name); |
| 4079 | 4078 | ||
| 4080 | printk(KERN_WARNING | 4079 | sdev_printk(KERN_WARNING, SDp, |
| 4081 | "Attached scsi tape %s at scsi%d, channel %d, id %d, lun %d\n", | 4080 | "Attached scsi tape %s", tape_name(tpnt)); |
| 4082 | tape_name(tpnt), SDp->host->host_no, SDp->channel, SDp->id, SDp->lun); | ||
| 4083 | printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B), max page reachable by HBA %lu\n", | 4081 | printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B), max page reachable by HBA %lu\n", |
| 4084 | tape_name(tpnt), tpnt->try_dio ? "yes" : "no", | 4082 | tape_name(tpnt), tpnt->try_dio ? "yes" : "no", |
| 4085 | queue_dma_alignment(SDp->request_queue) + 1, tpnt->max_pfn); | 4083 | queue_dma_alignment(SDp->request_queue) + 1, tpnt->max_pfn); |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 7ece05666feb..7f621ab2865d 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
| @@ -148,6 +148,9 @@ struct scsi_device { | |||
| 148 | #define transport_class_to_sdev(class_dev) \ | 148 | #define transport_class_to_sdev(class_dev) \ |
| 149 | to_scsi_device(class_dev->dev) | 149 | to_scsi_device(class_dev->dev) |
| 150 | 150 | ||
| 151 | #define sdev_printk(prefix, sdev, fmt, a...) \ | ||
| 152 | dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a) | ||
| 153 | |||
| 151 | /* | 154 | /* |
| 152 | * scsi_target: representation of a scsi target, for now, this is only | 155 | * scsi_target: representation of a scsi target, for now, this is only |
| 153 | * used for single_lun devices. If no one has active IO to the target, | 156 | * used for single_lun devices. If no one has active IO to the target, |
| @@ -177,6 +180,9 @@ static inline struct scsi_target *scsi_target(struct scsi_device *sdev) | |||
| 177 | #define transport_class_to_starget(class_dev) \ | 180 | #define transport_class_to_starget(class_dev) \ |
| 178 | to_scsi_target(class_dev->dev) | 181 | to_scsi_target(class_dev->dev) |
| 179 | 182 | ||
| 183 | #define starget_printk(prefix, starget, fmt, a...) \ | ||
| 184 | dev_printk(prefix, &(starget)->dev, fmt, ##a) | ||
| 185 | |||
| 180 | extern struct scsi_device *__scsi_add_device(struct Scsi_Host *, | 186 | extern struct scsi_device *__scsi_add_device(struct Scsi_Host *, |
| 181 | uint, uint, uint, void *hostdata); | 187 | uint, uint, uint, void *hostdata); |
| 182 | extern int scsi_add_device(struct Scsi_Host *host, uint channel, | 188 | extern int scsi_add_device(struct Scsi_Host *host, uint channel, |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 69313ba7505b..ea7ad7235397 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
| @@ -609,6 +609,10 @@ struct Scsi_Host { | |||
| 609 | #define class_to_shost(d) \ | 609 | #define class_to_shost(d) \ |
| 610 | container_of(d, struct Scsi_Host, shost_classdev) | 610 | container_of(d, struct Scsi_Host, shost_classdev) |
| 611 | 611 | ||
| 612 | #define shost_printk(prefix, shost, fmt, a...) \ | ||
| 613 | dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a) | ||
| 614 | |||
| 615 | |||
| 612 | int scsi_is_host_device(const struct device *); | 616 | int scsi_is_host_device(const struct device *); |
| 613 | 617 | ||
| 614 | static inline struct Scsi_Host *dev_to_shost(struct device *dev) | 618 | static inline struct Scsi_Host *dev_to_shost(struct device *dev) |
