All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Martin K . Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Jon Mason <jonmason@broadcom.com>
Subject: [PATCH v3 5/6] scsi: replace custom approach to hexdump small buffers
Date: Sat, 22 Oct 2016 20:32:30 +0300	[thread overview]
Message-ID: <20161022173231.170417-6-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20161022173231.170417-1-andriy.shevchenko@linux.intel.com>

In kernel we have defined specifier (%*ph[C]) to dump small buffers in a hex
format. Replace custom approach by a generic one.

Cc: Jon Mason <jonmason@broadcom.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/scsi/scsi_transport_srp.c | 11 +----------
 drivers/scsi/sd.c                 |  4 +---
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c
index e3cd3ec..02cfc6b 100644
--- a/drivers/scsi/scsi_transport_srp.c
+++ b/drivers/scsi/scsi_transport_srp.c
@@ -115,21 +115,12 @@ static DECLARE_TRANSPORT_CLASS(srp_host_class, "srp_host", srp_host_setup,
 static DECLARE_TRANSPORT_CLASS(srp_rport_class, "srp_remote_ports",
 			       NULL, NULL, NULL);
 
-#define SRP_PID(p) \
-	(p)->port_id[0], (p)->port_id[1], (p)->port_id[2], (p)->port_id[3], \
-	(p)->port_id[4], (p)->port_id[5], (p)->port_id[6], (p)->port_id[7], \
-	(p)->port_id[8], (p)->port_id[9], (p)->port_id[10], (p)->port_id[11], \
-	(p)->port_id[12], (p)->port_id[13], (p)->port_id[14], (p)->port_id[15]
-
-#define SRP_PID_FMT "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:" \
-	"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
-
 static ssize_t
 show_srp_rport_id(struct device *dev, struct device_attribute *attr,
 		  char *buf)
 {
 	struct srp_rport *rport = transport_class_to_srp_rport(dev);
-	return sprintf(buf, SRP_PID_FMT "\n", SRP_PID(rport));
+	return sprintf(buf, "%16phC\n", rport->port_id);
 }
 
 static DEVICE_ATTR(port_id, S_IRUGO, show_srp_rport_id, NULL);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index b9618ff..5634b54 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2472,9 +2472,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer)
 		if (sdkp->first_scan || old_wp != sdkp->write_prot) {
 			sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n",
 				  sdkp->write_prot ? "on" : "off");
-			sd_printk(KERN_DEBUG, sdkp,
-				  "Mode Sense: %02x %02x %02x %02x\n",
-				  buffer[0], buffer[1], buffer[2], buffer[3]);
+			sd_printk(KERN_DEBUG, sdkp, "Mode Sense: %4ph\n", buffer);
 		}
 	}
 }
-- 
2.9.3


  parent reply	other threads:[~2016-10-22 17:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-22 17:32 [PATCH v3 0/6] scsi: collection of clean ups Andy Shevchenko
2016-10-22 17:32 ` [PATCH v3 1/6] scsi: fnic: use kernel's '%pM' format option to print MAC Andy Shevchenko
2016-10-24 12:29   ` Ewan D. Milne
2016-10-22 17:32 ` [PATCH v3 2/6] fusion: print lan address via %pMR Andy Shevchenko
2016-10-24 12:32   ` Ewan D. Milne
2016-10-22 17:32 ` [PATCH v3 3/6] scsi: qla4xxx: print MAC and SID via %p[mM][R] Andy Shevchenko
2016-10-24 12:34   ` Ewan D. Milne
2016-10-22 17:32 ` [PATCH v3 4/6] [SCSI] ips: don't use custom hex_asc_upper[] table Andy Shevchenko
2016-10-24 12:34   ` Ewan D. Milne
2016-10-22 17:32 ` Andy Shevchenko [this message]
2016-10-24 12:35   ` [PATCH v3 5/6] scsi: replace custom approach to hexdump small buffers Ewan D. Milne
2016-10-22 17:32 ` [PATCH v3 6/6] cciss: replace custom function to hexdump Andy Shevchenko
2016-10-25  2:12 ` [PATCH v3 0/6] scsi: collection of clean ups Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161022173231.170417-6-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=jonmason@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.