Use shost_printk() or dev_err() instead of plain printk(). Signed-off-by: Jan Beulich <jbeulich@suse.com> --- a/drivers/xen/scsifront/scsifront.c +++ b/drivers/xen/scsifront/scsifront.c @@ -30,6 +30,8 @@ #include "common.h" +#define PREFIX(lvl) KERN_##lvl "scsifront: " + static int get_id_from_freelist(struct vscsifrnt_info *info) { unsigned long flags; @@ -108,26 +110,22 @@ irqreturn_t scsifront_intr(int irq, void } -static void scsifront_gnttab_done(struct vscsifrnt_shadow *s, uint32_t id) +static void scsifront_gnttab_done(struct vscsifrnt_info *info, uint32_t id) { + struct vscsifrnt_shadow *s = &info->shadow[id]; int i; if (s->sc->sc_data_direction == DMA_NONE) return; - if (s->nr_segments) { - for (i = 0; i < s->nr_segments; i++) { - if (unlikely(gnttab_query_foreign_access( - s->gref[i]) != 0)) { - printk(KERN_ALERT "scsifront: " - "grant still in use by backend.\n"); - BUG(); - } - gnttab_end_foreign_access(s->gref[i], 0UL); + for (i = 0; i < s->nr_segments; i++) { + if (unlikely(gnttab_query_foreign_access(s->gref[i]) != 0)) { + shost_printk(PREFIX(ALERT), info->host, + "grant still in use by backend\n"); + BUG(); } + gnttab_end_foreign_access(s->gref[i], 0UL); } - - return; } @@ -144,7 +142,7 @@ static void scsifront_cdb_cmd_done(struc if (sc == NULL) BUG(); - scsifront_gnttab_done(&info->shadow[id], id); + scsifront_gnttab_done(info, id); add_id_to_freelist(info, id); sc->result = ring_res->rslt; @@ -180,7 +178,7 @@ static void scsifront_sync_cmd_done(stru _add_id_to_freelist(info, id); break; default: - shost_printk(KERN_ERR "scsifront: ", info->host, + shost_printk(PREFIX(ERR), info->host, "bad reset state %d, possibly leaking %u\n", info->shadow[id].rslt_reset, id); break; @@ -272,7 +270,8 @@ static int map_data_for_request(struct v err = gnttab_alloc_grant_references(VSCSIIF_SG_TABLESIZE, &gref_head); if (err) { - printk(KERN_ERR "scsifront: gnttab_alloc_grant_references() error\n"); + shost_printk(PREFIX(ERR), info->host, + "gnttab_alloc_grant_references() error\n"); return -ENOMEM; } @@ -282,7 +281,8 @@ static int map_data_for_request(struct v nr_pages = (sc->request_bufflen + sg[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT; if (nr_pages > VSCSIIF_SG_TABLESIZE) { - printk(KERN_ERR "scsifront: Unable to map request_buffer for command!\n"); + shost_printk(PREFIX(ERR), info->host, + "Unable to map request_buffer for command!\n"); ref_cnt = (-E2BIG); goto big_to_sg; } @@ -369,9 +369,11 @@ static int scsifront_queuecommand(struct uint16_t rqid; /* debug printk to identify more missing scsi commands - printk(KERN_INFO "scsicmd: len=%i, 0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x",sc->cmd_len, - sc->cmnd[0],sc->cmnd[1],sc->cmnd[2],sc->cmnd[3],sc->cmnd[4], - sc->cmnd[5],sc->cmnd[6],sc->cmnd[7],sc->cmnd[8],sc->cmnd[9]); + shost_printk(KERN_INFO "scsicmd: ", sc->device->host, + "len=%u %#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x,%#x\n", + sc->cmd_len, sc->cmnd[0], sc->cmnd[1], + sc->cmnd[2], sc->cmnd[3], sc->cmnd[4], sc->cmnd[5], + sc->cmnd[6], sc->cmnd[7], sc->cmnd[8], sc->cmnd[9]); */ if (RING_FULL(&info->ring)) { goto out_host_busy; --- a/drivers/xen/scsifront/xenbus.c +++ b/drivers/xen/scsifront/xenbus.c @@ -214,7 +214,7 @@ static int scsifront_probe(struct xenbus if (IS_ERR(info->kthread)) { err = PTR_ERR(info->kthread); info->kthread = NULL; - printk(KERN_ERR "scsifront: kthread start err %d\n", err); + dev_err(&dev->dev, "kthread start err %d\n", err); goto free_sring; } @@ -226,7 +226,7 @@ static int scsifront_probe(struct xenbus err = scsi_add_host(host, &dev->dev); if (err) { - printk(KERN_ERR "scsifront: fail to add scsi host %d\n", err); + dev_err(&dev->dev, "fail to add scsi host %d\n", err); goto free_sring; } @@ -317,7 +317,7 @@ static void scsifront_do_lun_hotplug(str if (device_state == XenbusStateInitialised) { sdev = scsi_device_lookup(info->host, chn, tgt, lun); if (sdev) { - printk(KERN_ERR "scsifront: Device already in use.\n"); + dev_err(&dev->dev, "Device already in use.\n"); scsi_device_put(sdev); xenbus_printf(XBT_NIL, dev->nodename, state_str, "%d", XenbusStateClosed); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel