]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
[SCSI] move the mid-layer printk's over to shost/starget/sdev_printk
authorJames Bottomley <James.Bottomley@steeleye.com>
Sun, 2 Oct 2005 16:45:08 +0000 (11:45 -0500)
committerJames Bottomley <jejb@mulgrave.(none)>
Fri, 28 Oct 2005 19:23:02 +0000 (14:23 -0500)
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>
16 files changed:
drivers/scsi/constants.c
drivers/scsi/hosts.c
drivers/scsi/osst.c
drivers/scsi/scsi.c
drivers/scsi/scsi_error.c
drivers/scsi/scsi_ioctl.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_scan.c
drivers/scsi/scsi_transport_fc.c
drivers/scsi/scsi_transport_spi.c
drivers/scsi/sd.c
drivers/scsi/sg.c
drivers/scsi/sr.c
drivers/scsi/st.c
include/scsi/scsi_device.h
include/scsi/scsi_host.h

index f6be2c1c3942f24702795edc4bd75a084a409210..09bc81557b6ede1cfa24f5ddae2f20e8365acfaf 100644 (file)
@@ -1389,10 +1389,7 @@ EXPORT_SYMBOL(scsi_print_msg);
 void scsi_print_command(struct scsi_cmnd *cmd)
 {
        /* Assume appended output (i.e. not at start of line) */
-       printk("scsi%d : destination target %d, lun %d\n", 
-               cmd->device->host->host_no, 
-               cmd->device->id, 
-               cmd->device->lun);
+       sdev_printk("", cmd->device, "\n");
        printk(KERN_INFO "        command: ");
        scsi_print_cdb(cmd->cmnd, cmd->cmd_len, 0);
 }
index f24d84538fd56ab5c1d2cdd8df3c509fac8e5092..0d48c9ceebd33cc91e97435b318aa6dfbe235155 100644 (file)
@@ -139,11 +139,11 @@ int scsi_host_set_state(struct Scsi_Host *shost, enum scsi_host_state state)
 
  illegal:
        SCSI_LOG_ERROR_RECOVERY(1,
-                               dev_printk(KERN_ERR, &shost->shost_gendev,
-                                          "Illegal host state transition"
-                                          "%s->%s\n",
-                                          scsi_host_state_name(oldstate),
-                                          scsi_host_state_name(state)));
+                               shost_printk(KERN_ERR, shost,
+                                            "Illegal host state transition"
+                                            "%s->%s\n",
+                                            scsi_host_state_name(oldstate),
+                                            scsi_host_state_name(state)));
        return -EINVAL;
 }
 EXPORT_SYMBOL(scsi_host_set_state);
index af1133104b3f95ef17986e41fde352761b6fcb9a..c1131c9cae647b40bbb7d2bc65a3c2484890e795 100644 (file)
@@ -5819,9 +5819,9 @@ static int osst_probe(struct device *dev)
        }
        drive->number = devfs_register_tape(SDp->devfs_name);
 
-       printk(KERN_INFO
-               "osst :I: Attached OnStream %.5s tape at scsi%d, channel %d, id %d, lun %d as %s\n",
-               SDp->model, SDp->host->host_no, SDp->channel, SDp->id, SDp->lun, tape_name(tpnt));
+       dev_printk(KERN_INFO, &SDp->sdev_gendev,
+               "osst :I: Attached OnStream %.5s tape as %s\n",
+               SDp->model, tape_name(tpnt));
 
        return 0;
 
index a5711d545d713501a60d57bfa7296007cf3dda3e..071d109b4b2a5e8191950afb010aee075a3dedfd 100644 (file)
@@ -410,9 +410,7 @@ void scsi_log_send(struct scsi_cmnd *cmd)
                                       SCSI_LOG_MLQUEUE_BITS);
                if (level > 1) {
                        sdev = cmd->device;
-                       printk(KERN_INFO "scsi <%d:%d:%d:%d> send ",
-                              sdev->host->host_no, sdev->channel, sdev->id,
-                              sdev->lun);
+                       sdev_printk(KERN_INFO, sdev, "send ");
                        if (level > 2)
                                printk("0x%p ", cmd);
                        /*
@@ -456,9 +454,7 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
                if (((level > 0) && (cmd->result || disposition != SUCCESS)) ||
                    (level > 1)) {
                        sdev = cmd->device;
-                       printk(KERN_INFO "scsi <%d:%d:%d:%d> done ",
-                              sdev->host->host_no, sdev->channel, sdev->id,
-                              sdev->lun);
+                       sdev_printk(KERN_INFO, sdev, "done ");
                        if (level > 2)
                                printk("0x%p ", cmd);
                        /*
@@ -810,9 +806,9 @@ static void scsi_softirq(struct softirq_action *h)
                disposition = scsi_decide_disposition(cmd);
                if (disposition != SUCCESS &&
                    time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) {
-                       dev_printk(KERN_ERR, &cmd->device->sdev_gendev, 
-                                  "timing out command, waited %lus\n",
-                                  wait_for/HZ);
+                       sdev_printk(KERN_ERR, cmd->device,
+                                   "timing out command, waited %lus\n",
+                                   wait_for/HZ);
                        disposition = SUCCESS;
                }
                        
@@ -970,10 +966,9 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags)
                        sdev->simple_tags = 1;
                        break;
                default:
-                       printk(KERN_WARNING "(scsi%d:%d:%d:%d) "
-                               "scsi_adjust_queue_depth, bad queue type, "
-                               "disabled\n", sdev->host->host_no,
-                               sdev->channel, sdev->id, sdev->lun); 
+                       sdev_printk(KERN_WARNING, sdev,
+                                   "scsi_adjust_queue_depth, bad queue type, "
+                                   "disabled\n");
                case 0:
                        sdev->ordered_tags = sdev->simple_tags = 0;
                        sdev->queue_depth = tags;
index 52b348c36d56b7cc4be4a03e444e8ad182679620..dd6a9f61bdf1bc42a829587d57508ef0afe7b9c3 100644 (file)
@@ -241,11 +241,10 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost,
 
                if (cmd_cancel || cmd_failed) {
                        SCSI_LOG_ERROR_RECOVERY(3,
-                               printk("%s: %d:%d:%d:%d cmds failed: %d,"
-                                      " cancel: %d\n",
-                                      __FUNCTION__, shost->host_no,
-                                      sdev->channel, sdev->id, sdev->lun,
-                                      cmd_failed, cmd_cancel));
+                               sdev_printk(KERN_INFO, sdev,
+                                           "%s: cmds failed: %d, cancel: %d\n",
+                                           __FUNCTION__, cmd_failed,
+                                           cmd_cancel));
                        cmd_cancel = 0;
                        cmd_failed = 0;
                        ++devices_failed;
@@ -1174,13 +1173,9 @@ static void scsi_eh_offline_sdevs(struct list_head *work_q,
        struct scsi_cmnd *scmd, *next;
 
        list_for_each_entry_safe(scmd, next, work_q, eh_entry) {
-               printk(KERN_INFO "scsi: Device offlined - not"
-                               " ready after error recovery: host"
-                               " %d channel %d id %d lun %d\n",
-                               scmd->device->host->host_no,
-                               scmd->device->channel,
-                               scmd->device->id,
-                               scmd->device->lun);
+               sdev_printk(KERN_INFO, scmd->device,
+                           "scsi: Device offlined - not"
+                           " ready after error recovery\n");
                scsi_device_set_state(scmd->device, SDEV_OFFLINE);
                if (scmd->eh_eflags & SCSI_EH_CANCEL_CMD) {
                        /*
@@ -1342,10 +1337,8 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                return SUCCESS;
 
        case RESERVATION_CONFLICT:
-               printk(KERN_INFO "scsi: reservation conflict: host"
-                                " %d channel %d id %d lun %d\n",
-                      scmd->device->host->host_no, scmd->device->channel,
-                      scmd->device->id, scmd->device->lun);
+               sdev_printk(KERN_INFO, scmd->device,
+                           "reservation conflict\n");
                return SUCCESS; /* causes immediate i/o error */
        default:
                return FAILED;
index 6a3f6aae8a976c8ef1011dafc6bd5c8806952109..26f5bc6d9c82a497b43b1bf8393131d7529ad4a8 100644 (file)
@@ -122,13 +122,9 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
                                break;
                        }
                default:        /* Fall through for non-removable media */
-                       printk(KERN_INFO "ioctl_internal_command: <%d %d %d "
-                              "%d> return code = %x\n",
-                              sdev->host->host_no,
-                              sdev->channel,
-                              sdev->id,
-                              sdev->lun,
-                              result);
+                       sdev_printk(KERN_INFO, sdev,
+                                   "ioctl_internal_command return code = %x\n",
+                                   result);
                        scsi_print_sense_hdr("   ", &sshdr);
                        break;
                }
index 3ff538809786fb5647c0e8f2f6e74339aca0106d..19ac888001e6d14c5246878b386f6d0479be591c 100644 (file)
@@ -951,16 +951,16 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes,
                                return;
                        }
                        if (!(req->flags & REQ_QUIET))
-                               dev_printk(KERN_INFO,
-                                          &cmd->device->sdev_gendev,
-                                          "Device not ready.\n");
+                               sdev_printk(KERN_INFO,
+                                           cmd->device,
+                                           "Device not ready.\n");
                        scsi_end_request(cmd, 0, this_count, 1);
                        return;
                case VOLUME_OVERFLOW:
                        if (!(req->flags & REQ_QUIET)) {
-                               dev_printk(KERN_INFO,
-                                          &cmd->device->sdev_gendev,
-                                          "Volume overflow, CDB: ");
+                               sdev_printk(KERN_INFO,
+                                           cmd->device,
+                                           "Volume overflow, CDB: ");
                                __scsi_print_command(cmd->data_cmnd);
                                scsi_print_sense("", cmd);
                        }
@@ -981,8 +981,9 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes,
        }
        if (result) {
                if (!(req->flags & REQ_QUIET)) {
-                       dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
-                                  "SCSI error: return code = 0x%x\n", result);
+                       sdev_printk(KERN_INFO, cmd->device,
+                                   "SCSI error: return code = 0x%x\n",
+                                   result);
 
                        if (driver_byte(result) & DRIVER_SENSE)
                                scsi_print_sense("", cmd);
@@ -1141,8 +1142,8 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
         * online before trying any recovery commands
         */
        if (unlikely(!scsi_device_online(sdev))) {
-               printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n",
-                      sdev->host->host_no, sdev->id, sdev->lun);
+               sdev_printk(KERN_ERR, sdev,
+                           "rejecting I/O to offline device\n");
                goto kill;
        }
        if (unlikely(sdev->sdev_state != SDEV_RUNNING)) {
@@ -1151,8 +1152,8 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
                if (sdev->sdev_state == SDEV_DEL) {
                        /* Device is fully deleted, no commands
                         * at all allowed down */
-                       printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to dead device\n",
-                              sdev->host->host_no, sdev->id, sdev->lun);
+                       sdev_printk(KERN_ERR, sdev,
+                                   "rejecting I/O to dead device\n");
                        goto kill;
                }
                /* 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)
                                        specials_only == SDEV_BLOCK)
                                goto defer;
                        
-                       printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to device being removed\n",
-                              sdev->host->host_no, sdev->id, sdev->lun);
+                       sdev_printk(KERN_ERR, sdev,
+                                   "rejecting I/O to device being removed\n");
                        goto kill;
                }
                        
@@ -1315,9 +1316,8 @@ static inline int scsi_dev_queue_ready(struct request_queue *q,
                 */
                if (--sdev->device_blocked == 0) {
                        SCSI_LOG_MLQUEUE(3,
-                               printk("scsi%d (%d:%d) unblocking device at"
-                                      " zero depth\n", sdev->host->host_no,
-                                      sdev->id, sdev->lun));
+                                  sdev_printk(KERN_INFO, sdev,
+                                  "unblocking device at zero depth\n"));
                } else {
                        blk_plug_device(q);
                        return 0;
@@ -1436,8 +1436,8 @@ static void scsi_request_fn(struct request_queue *q)
                        break;
 
                if (unlikely(!scsi_device_online(sdev))) {
-                       printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n",
-                              sdev->host->host_no, sdev->id, sdev->lun);
+                       sdev_printk(KERN_ERR, sdev,
+                                   "rejecting I/O to offline device\n");
                        scsi_kill_request(req, q);
                        continue;
                }
@@ -1893,10 +1893,10 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
 
  illegal:
        SCSI_LOG_ERROR_RECOVERY(1, 
-                               dev_printk(KERN_ERR, &sdev->sdev_gendev,
-                                          "Illegal state transition %s->%s\n",
-                                          scsi_device_state_name(oldstate),
-                                          scsi_device_state_name(state))
+                               sdev_printk(KERN_ERR, sdev,
+                                           "Illegal state transition %s->%s\n",
+                                           scsi_device_state_name(oldstate),
+                                           scsi_device_state_name(state))
                                );
        return -EINVAL;
 }
index 327c5d7e5bd2896af1fd6b5f37a0d3376a5d685a..ce8456c3b718ff19f2074e69cecdcdb379d75b06 100644 (file)
@@ -462,10 +462,9 @@ static int scsi_probe_lun(struct scsi_device *sdev, char *inq_result,
        pass = 1;
 
  next_pass:
-       SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY pass %d "
-                       "to host %d channel %d id %d lun %d, length %d\n",
-                       pass, sdev->host->host_no, sdev->channel,
-                       sdev->id, sdev->lun, try_inquiry_len));
+       SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
+                               "scsi scan: INQUIRY pass %d length %d\n",
+                               pass, try_inquiry_len));
 
        /* Each pass gets up to three chances to ignore Unit Attention */
        for (count = 0; count < 3; ++count) {
index 771e97ef136e8ad3c27f08eab77c76de77b8a2ac..473a82d5e3e2a929ce8379a1a8c375df31f1c72e 100644 (file)
@@ -32,8 +32,6 @@
 #include <scsi/scsi_transport_fc.h>
 #include "scsi_priv.h"
 
-#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)
-
 /*
  * Redefine so that we can have same named attributes in the
  * sdev/starget/host objects.
index ef577c8c21826b082c0bac3f81b8ea97d96f650c..718a2bc4ed5e6fcbe777637661bdc08769691c5e 100644 (file)
@@ -33,8 +33,6 @@
 #include <scsi/scsi_transport.h>
 #include <scsi/scsi_transport_spi.h>
 
-#define SPI_PRINTK(x, l, f, a...)      dev_printk(l, &(x)->dev, f , ##a)
-
 #define SPI_NUM_ATTRS 14       /* increase this if you add attributes */
 #define SPI_OTHER_ATTRS 1      /* Increase this if you add "always
                                 * on" attributes */
@@ -618,7 +616,7 @@ spi_dv_device_echo_buffer(struct scsi_device *sdev, u8 *buffer,
                                return SPI_COMPARE_SKIP_TEST;
 
 
-                       SPI_PRINTK(sdev->sdev_target, KERN_ERR, "Write Buffer failure %x\n", result);
+                       sdev_printk(KERN_ERR, sdev, "Write Buffer failure %x\n", result);
                        return SPI_COMPARE_FAILURE;
                }
 
@@ -702,10 +700,10 @@ spi_dv_retrain(struct scsi_device *sdev, u8 *buffer, u8 *ptr,
                 * IU, then QAS (if we can control them), then finally
                 * fall down the periods */
                if (i->f->set_iu && spi_iu(starget)) {
-                       SPI_PRINTK(starget, KERN_ERR, "Domain Validation Disabing Information Units\n");
+                       starget_printk(KERN_ERR, starget, "Domain Validation Disabing Information Units\n");
                        DV_SET(iu, 0);
                } else if (i->f->set_qas && spi_qas(starget)) {
-                       SPI_PRINTK(starget, KERN_ERR, "Domain Validation Disabing Quick Arbitration and Selection\n");
+                       starget_printk(KERN_ERR, starget, "Domain Validation Disabing Quick Arbitration and Selection\n");
                        DV_SET(qas, 0);
                } else {
                        newperiod = spi_period(starget);
@@ -717,11 +715,11 @@ spi_dv_retrain(struct scsi_device *sdev, u8 *buffer, u8 *ptr,
 
                        if (unlikely(period > 0xff || period == prevperiod)) {
                                /* Total failure; set to async and return */
-                               SPI_PRINTK(starget, KERN_ERR, "Domain Validation Failure, dropping back to Asynchronous\n");
+                               starget_printk(KERN_ERR, starget, "Domain Validation Failure, dropping back to Asynchronous\n");
                                DV_SET(offset, 0);
                                return SPI_COMPARE_FAILURE;
                        }
-                       SPI_PRINTK(starget, KERN_ERR, "Domain Validation detected failure, dropping back\n");
+                       starget_printk(KERN_ERR, starget, "Domain Validation detected failure, dropping back\n");
                        DV_SET(period, period);
                        prevperiod = period;
                }
@@ -788,7 +786,7 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
        
        if (spi_dv_device_compare_inquiry(sdev, buffer, buffer, DV_LOOPS)
            != SPI_COMPARE_SUCCESS) {
-               SPI_PRINTK(starget, KERN_ERR, "Domain Validation Initial Inquiry Failed\n");
+               starget_printk(KERN_ERR, starget, "Domain Validation Initial Inquiry Failed\n");
                /* FIXME: should probably offline the device here? */
                return;
        }
@@ -802,7 +800,7 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
                                                   buffer + len,
                                                   DV_LOOPS)
                    != SPI_COMPARE_SUCCESS) {
-                       SPI_PRINTK(starget, KERN_ERR, "Wide Transfers Fail\n");
+                       starget_printk(KERN_ERR, starget, "Wide Transfers Fail\n");
                        i->f->set_width(starget, 0);
                }
        }
@@ -844,14 +842,14 @@ spi_dv_device_internal(struct scsi_device *sdev, u8 *buffer)
        }
 
        if (len == 0) {
-               SPI_PRINTK(starget, KERN_INFO, "Domain Validation skipping write tests\n");
+               starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n");
                spi_dv_retrain(sdev, buffer, buffer + len,
                               spi_dv_device_compare_inquiry);
                return;
        }
 
        if (len > SPI_MAX_ECHO_BUFFER_SIZE) {
-               SPI_PRINTK(starget, KERN_WARNING, "Echo buffer size %d is too big, trimming to %d\n", len, SPI_MAX_ECHO_BUFFER_SIZE);
+               starget_printk(KERN_WARNING, starget, "Echo buffer size %d is too big, trimming to %d\n", len, SPI_MAX_ECHO_BUFFER_SIZE);
                len = SPI_MAX_ECHO_BUFFER_SIZE;
        }
 
@@ -902,11 +900,11 @@ spi_dv_device(struct scsi_device *sdev)
        spi_dv_pending(starget) = 1;
        down(&spi_dv_sem(starget));
 
-       SPI_PRINTK(starget, KERN_INFO, "Beginning Domain Validation\n");
+       starget_printk(KERN_INFO, starget, "Beginning Domain Validation\n");
 
        spi_dv_device_internal(sdev, buffer);
 
-       SPI_PRINTK(starget, KERN_INFO, "Ending Domain Validation\n");
+       starget_printk(KERN_INFO, starget, "Ending Domain Validation\n");
 
        up(&spi_dv_sem(starget));
        spi_dv_pending(starget) = 0;
index 98da5c8057bfb5e28a121e3ed91acfa4c1d5cb97..9de8e186cb69c971bb0f130e26638660e8814548 100644 (file)
@@ -1534,8 +1534,8 @@ static int sd_probe(struct device *dev)
        if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD && sdp->type != TYPE_RBC)
                goto out;
 
-       SCSI_LOG_HLQUEUE(3, printk("sd_attach: scsi device: <%d,%d,%d,%d>\n", 
-                        sdp->host->host_no, sdp->channel, sdp->id, sdp->lun));
+       SCSI_LOG_HLQUEUE(3, sdev_printk(KERN_INFO, sdp,
+                                       "sd_attach\n"));
 
        error = -ENOMEM;
        sdkp = kmalloc(sizeof(*sdkp), GFP_KERNEL);
@@ -1607,10 +1607,8 @@ static int sd_probe(struct device *dev)
        dev_set_drvdata(dev, sdkp);
        add_disk(gd);
 
-       printk(KERN_NOTICE "Attached scsi %sdisk %s at scsi%d, channel %d, "
-              "id %d, lun %d\n", sdp->removable ? "removable " : "",
-              gd->disk_name, sdp->host->host_no, sdp->channel,
-              sdp->id, sdp->lun);
+       sdev_printk(KERN_NOTICE, sdp, "Attached scsi %sdisk %s\n",
+                   sdp->removable ? "removable " : "", gd->disk_name);
 
        return 0;
 
index fd56b7ec88b656e645a2af4551be76873d746531..49b9269d487a39a593a5732a7c591a679d8c0c7f 100644 (file)
@@ -1497,10 +1497,9 @@ static int sg_alloc(struct gendisk *disk, struct scsi_device *scsidp)
 
  overflow:
        write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
-       printk(KERN_WARNING
-              "Unable to attach sg device <%d, %d, %d, %d> type=%d, minor "
-              "number exceeds %d\n", scsidp->host->host_no, scsidp->channel,
-              scsidp->id, scsidp->lun, scsidp->type, SG_MAX_DEVS - 1);
+       sdev_printk(KERN_WARNING, scsidp,
+                   "Unable to attach sg device type=%d, minor "
+                   "number exceeds %d\n", scsidp->type, SG_MAX_DEVS - 1);
        error = -ENODEV;
        goto out;
 }
@@ -1566,11 +1565,8 @@ sg_add(struct class_device *cl_dev)
        } else
                printk(KERN_WARNING "sg_add: sg_sys INvalid\n");
 
-       printk(KERN_NOTICE
-              "Attached scsi generic sg%d at scsi%d, channel"
-              " %d, id %d, lun %d,  type %d\n", k,
-              scsidp->host->host_no, scsidp->channel, scsidp->id,
-              scsidp->lun, scsidp->type);
+       sdev_printk(KERN_NOTICE, scsidp,
+                   "Attached scsi generic sg%d type %d\n", k,scsidp->type);
 
        return 0;
 
index 561901b1cf1178c70f8a30db85b57b07f9ea09cb..9e267c6d3a436d8581c6064faa6577b32a42550c 100644 (file)
@@ -360,7 +360,7 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
        }
 
        if (s_size != 512 && s_size != 1024 && s_size != 2048) {
-               printk("sr: bad sector size %d\n", s_size);
+               sdev_printk(KERN_ERR, SCpnt->device, "bad sector size %d\n", s_size);
                return 0;
        }
 
@@ -385,8 +385,9 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
                        size += sg[i].length;
 
                if (size != SCpnt->request_bufflen && SCpnt->use_sg) {
-                       printk(KERN_ERR "sr: mismatch count %d, bytes %d\n",
-                                       size, SCpnt->request_bufflen);
+                       sdev_printk(KERN_ERR, SCpnt->device,
+                                   "mismatch count %d, bytes %d\n",
+                                   size, SCpnt->request_bufflen);
                        if (SCpnt->request_bufflen > size)
                                SCpnt->request_bufflen = SCpnt->bufflen = size;
                }
@@ -397,7 +398,7 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
         */
        if (((unsigned int)SCpnt->request->sector % (s_size >> 9)) ||
            (SCpnt->request_bufflen % s_size)) {
-               printk("sr: unaligned transfer\n");
+               sdev_printk(KERN_NOTICE, SCpnt->device, "unaligned transfer\n");
                return 0;
        }
 
@@ -622,10 +623,8 @@ static int sr_probe(struct device *dev)
        disk->flags |= GENHD_FL_REMOVABLE;
        add_disk(disk);
 
-       printk(KERN_DEBUG
-           "Attached scsi CD-ROM %s at scsi%d, channel %d, id %d, lun %d\n",
-           cd->cdi.name, sdev->host->host_no, sdev->channel,
-           sdev->id, sdev->lun);
+       sdev_printk(KERN_DEBUG, sdev,
+                   "Attached scsi CD-ROM %s\n", cd->cdi.name);
        return 0;
 
 fail_put:
index 927d700f00736af5a0249cc8f17ee7bff6b90179..dc5ffc16a252b79db7b57eb48647fa5ac46a8361 100644 (file)
@@ -3887,9 +3887,8 @@ static int st_probe(struct device *dev)
        if (SDp->type != TYPE_TAPE)
                return -ENODEV;
        if ((stp = st_incompatible(SDp))) {
-               printk(KERN_INFO
-                      "st: Found incompatible tape at scsi%d, channel %d, id %d, lun %d\n",
-                      SDp->host->host_no, SDp->channel, SDp->id, SDp->lun);
+         sdev_printk(KERN_INFO, SDp,
+                     "Found incompatible tape\n");
                printk(KERN_INFO "st: The suggested driver is %s.\n", stp);
                return -ENODEV;
        }
@@ -4077,9 +4076,8 @@ static int st_probe(struct device *dev)
        }
        disk->number = devfs_register_tape(SDp->devfs_name);
 
-       printk(KERN_WARNING
-       "Attached scsi tape %s at scsi%d, channel %d, id %d, lun %d\n",
-              tape_name(tpnt), SDp->host->host_no, SDp->channel, SDp->id, SDp->lun);
+       sdev_printk(KERN_WARNING, SDp,
+                   "Attached scsi tape %s", tape_name(tpnt));
        printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B), max page reachable by HBA %lu\n",
               tape_name(tpnt), tpnt->try_dio ? "yes" : "no",
               queue_dma_alignment(SDp->request_queue) + 1, tpnt->max_pfn);
index 7ece05666febc367c9da22625177a1175c9b07da..7f621ab2865d87be0213c453a37614803fb5f9ba 100644 (file)
@@ -148,6 +148,9 @@ struct scsi_device {
 #define transport_class_to_sdev(class_dev) \
        to_scsi_device(class_dev->dev)
 
+#define sdev_printk(prefix, sdev, fmt, a...)   \
+       dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
+
 /*
  * scsi_target: representation of a scsi target, for now, this is only
  * 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)
 #define transport_class_to_starget(class_dev) \
        to_scsi_target(class_dev->dev)
 
+#define starget_printk(prefix, starget, fmt, a...)     \
+       dev_printk(prefix, &(starget)->dev, fmt, ##a)
+
 extern struct scsi_device *__scsi_add_device(struct Scsi_Host *,
                uint, uint, uint, void *hostdata);
 extern int scsi_add_device(struct Scsi_Host *host, uint channel,
index 69313ba7505b30323e37eb2134693d41c242512d..ea7ad723539707a43d2edae484f4858c23700106 100644 (file)
@@ -609,6 +609,10 @@ struct Scsi_Host {
 #define                class_to_shost(d)       \
        container_of(d, struct Scsi_Host, shost_classdev)
 
+#define shost_printk(prefix, shost, fmt, a...) \
+       dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
+
+
 int scsi_is_host_device(const struct device *);
 
 static inline struct Scsi_Host *dev_to_shost(struct device *dev)