[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] scsifront: consolidate printing


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Mon, 26 Nov 2012 08:33:03 +0000
  • Delivery-date: Mon, 26 Nov 2012 08:33:18 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1353918559 -3600
# Node ID b357fab4566ac8daf168e49fee383b1b0a4b9ffb
# Parent  4d1471ca031e65eca5e508eab8330bef9799f5fb
scsifront: consolidate printing

Use shost_printk() or dev_err() instead of plain printk().

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 4d1471ca031e -r b357fab4566a drivers/xen/scsifront/scsifront.c
--- a/drivers/xen/scsifront/scsifront.c Mon Nov 26 09:25:42 2012 +0100
+++ b/drivers/xen/scsifront/scsifront.c Mon Nov 26 09:29:19 2012 +0100
@@ -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;
diff -r 4d1471ca031e -r b357fab4566a drivers/xen/scsifront/xenbus.c
--- a/drivers/xen/scsifront/xenbus.c    Mon Nov 26 09:25:42 2012 +0100
+++ b/drivers/xen/scsifront/xenbus.c    Mon Nov 26 09:29:19 2012 +0100
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.