linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/4] scsi: some (very) old clean ups
@ 2016-05-06 16:23 Andy Shevchenko
  2016-05-06 16:23 ` [PATCH v1 1/4] libsas: remove private hex2bin() implementation Andy Shevchenko
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Andy Shevchenko @ 2016-05-06 16:23 UTC (permalink / raw)
  To: Martin K. Petersen, linux-scsi; +Cc: Andy Shevchenko

This is a set of independent clean ups that didn't land upstream for ages (some
are dated 2010!).  As agreed with Martin at some point I resend
them.

I have more, but the rest is not yet ready for submission.

Andy Shevchenko (3):
  libsas: remove private hex2bin() implementation
  scsi: fnic: use kernel's '%pM' format option to print MAC
  fusion: print lan address via %pMR

Oleksandr Khoshaba (1):
  scsi: qla4xxx: print MAC and SID via %p[mM][R]

 drivers/message/fusion/mptbase.c    | 14 ++++----------
 drivers/scsi/fnic/vnic_dev.c        | 10 ++--------
 drivers/scsi/libsas/sas_scsi_host.c | 22 ++++++----------------
 drivers/scsi/qla4xxx/ql4_mbx.c      |  5 +----
 drivers/scsi/qla4xxx/ql4_nx.c       |  8 ++------
 drivers/scsi/qla4xxx/ql4_os.c       | 15 ++++-----------
 6 files changed, 19 insertions(+), 55 deletions(-)

-- 
2.8.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/4] libsas: remove private hex2bin() implementation
  2016-05-06 16:23 [PATCH v1 0/4] scsi: some (very) old clean ups Andy Shevchenko
@ 2016-05-06 16:23 ` Andy Shevchenko
  2016-05-06 16:23 ` [PATCH v1 2/4] scsi: fnic: use kernel's '%pM' format option to print MAC Andy Shevchenko
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2016-05-06 16:23 UTC (permalink / raw)
  To: Martin K. Petersen, linux-scsi; +Cc: Andy Shevchenko, Christoph Hellwig

The function sas_parse_addr() could be easily substituted by hex2bin() which is
in kernel library code.

Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/scsi/libsas/sas_scsi_host.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 519dac4..30a5970 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -27,6 +27,7 @@
 #include <linux/firmware.h>
 #include <linux/export.h>
 #include <linux/ctype.h>
+#include <linux/kernel.h>
 
 #include "sas_internal.h"
 
@@ -961,21 +962,6 @@ void sas_target_destroy(struct scsi_target *starget)
 	sas_put_device(found_dev);
 }
 
-static void sas_parse_addr(u8 *sas_addr, const char *p)
-{
-	int i;
-	for (i = 0; i < SAS_ADDR_SIZE; i++) {
-		u8 h, l;
-		if (!*p)
-			break;
-		h = isdigit(*p) ? *p-'0' : toupper(*p)-'A'+10;
-		p++;
-		l = isdigit(*p) ? *p-'0' : toupper(*p)-'A'+10;
-		p++;
-		sas_addr[i] = (h<<4) | l;
-	}
-}
-
 #define SAS_STRING_ADDR_SIZE	16
 
 int sas_request_addr(struct Scsi_Host *shost, u8 *addr)
@@ -992,7 +978,11 @@ int sas_request_addr(struct Scsi_Host *shost, u8 *addr)
 		goto out;
 	}
 
-	sas_parse_addr(addr, fw->data);
+	res = hex2bin(addr, fw->data, strnlen(fw->data, SAS_ADDR_SIZE * 2) / 2);
+	if (res) {
+		res = -EINVAL;
+		goto out;
+	}
 
 out:
 	release_firmware(fw);
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 2/4] scsi: fnic: use kernel's '%pM' format option to print MAC
  2016-05-06 16:23 [PATCH v1 0/4] scsi: some (very) old clean ups Andy Shevchenko
  2016-05-06 16:23 ` [PATCH v1 1/4] libsas: remove private hex2bin() implementation Andy Shevchenko
@ 2016-05-06 16:23 ` Andy Shevchenko
  2016-05-06 16:23 ` [PATCH v1 3/4] fusion: print lan address via %pMR Andy Shevchenko
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2016-05-06 16:23 UTC (permalink / raw)
  To: Martin K. Petersen, linux-scsi
  Cc: Andy Shevchenko, Hiral Patel, Suma Ramars, Brian Uchino

Instead of supplying each byte through stack let's use %pM specifier.

Cc: Hiral Patel <hiralpat@cisco.com>
Cc: Suma Ramars <sramars@cisco.com>
Cc: Brian Uchino <buchino@cisco.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/scsi/fnic/vnic_dev.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/fnic/vnic_dev.c b/drivers/scsi/fnic/vnic_dev.c
index 9795d6f..ba69d61 100644
--- a/drivers/scsi/fnic/vnic_dev.c
+++ b/drivers/scsi/fnic/vnic_dev.c
@@ -499,10 +499,7 @@ void vnic_dev_add_addr(struct vnic_dev *vdev, u8 *addr)
 
 	err = vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait);
 	if (err)
-		printk(KERN_ERR
-			"Can't add addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n",
-			addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
-			err);
+		pr_err("Can't add addr [%pM], %d\n", addr, err);
 }
 
 void vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr)
@@ -517,10 +514,7 @@ void vnic_dev_del_addr(struct vnic_dev *vdev, u8 *addr)
 
 	err = vnic_dev_cmd(vdev, CMD_ADDR_DEL, &a0, &a1, wait);
 	if (err)
-		printk(KERN_ERR
-			"Can't del addr [%02x:%02x:%02x:%02x:%02x:%02x], %d\n",
-			addr[0], addr[1], addr[2], addr[3], addr[4], addr[5],
-			err);
+		pr_err("Can't del addr [%pM], %d\n", addr, err);
 }
 
 int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr)
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 3/4] fusion: print lan address via %pMR
  2016-05-06 16:23 [PATCH v1 0/4] scsi: some (very) old clean ups Andy Shevchenko
  2016-05-06 16:23 ` [PATCH v1 1/4] libsas: remove private hex2bin() implementation Andy Shevchenko
  2016-05-06 16:23 ` [PATCH v1 2/4] scsi: fnic: use kernel's '%pM' format option to print MAC Andy Shevchenko
@ 2016-05-06 16:23 ` Andy Shevchenko
  2016-05-06 16:23 ` [PATCH v1 4/4] scsi: qla4xxx: print MAC and SID via %p[mM][R] Andy Shevchenko
  2016-06-20  9:03 ` [PATCH v1 0/4] scsi: some (very) old clean ups Andy Shevchenko
  4 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2016-05-06 16:23 UTC (permalink / raw)
  To: Martin K. Petersen, linux-scsi
  Cc: Andy Shevchenko, Sathya Prakash, MPT-FusionLinux.pdl

LAN MAC addresses can be printed directly using %pMR specifier.

Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: MPT-FusionLinux.pdl@broadcom.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/message/fusion/mptbase.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 5537f8d..3af67e6 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -2584,10 +2584,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
 				(void) GetLanConfigPages(ioc);
 				a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
 				dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
-					"LanAddr = %02X:%02X:%02X"
-					":%02X:%02X:%02X\n",
-					ioc->name, a[5], a[4],
-					a[3], a[2], a[1], a[0]));
+					"LanAddr = %pMR\n", ioc->name, a));
 			}
 			break;
 
@@ -6782,8 +6779,7 @@ static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
 		if (ioc->bus_type == FC) {
 			if (ioc->pfacts[p].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) {
 				u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
-				seq_printf(m, "    LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
-						a[5], a[4], a[3], a[2], a[1], a[0]);
+				seq_printf(m, "    LanAddr = %pMR\n", a);
 			}
 			seq_printf(m, "    WWN = %08X%08X:%08X%08X\n",
 					ioc->fc_port_page0[p].WWNN.High,
@@ -6860,8 +6856,7 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
 
 	if (showlan && (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN)) {
 		u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
-		y += sprintf(buffer+len+y, ", LanAddr=%02X:%02X:%02X:%02X:%02X:%02X",
-			a[5], a[4], a[3], a[2], a[1], a[0]);
+		y += sprintf(buffer+len+y, ", LanAddr=%pMR", a);
 	}
 
 	y += sprintf(buffer+len+y, ", IRQ=%d", ioc->pci_irq);
@@ -6895,8 +6890,7 @@ static void seq_mpt_print_ioc_summary(MPT_ADAPTER *ioc, struct seq_file *m, int
 
 	if (showlan && (ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN)) {
 		u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
-		seq_printf(m, ", LanAddr=%02X:%02X:%02X:%02X:%02X:%02X",
-			a[5], a[4], a[3], a[2], a[1], a[0]);
+		seq_printf(m, ", LanAddr=%pMR", a);
 	}
 
 	seq_printf(m, ", IRQ=%d", ioc->pci_irq);
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 4/4] scsi: qla4xxx: print MAC and SID via %p[mM][R]
  2016-05-06 16:23 [PATCH v1 0/4] scsi: some (very) old clean ups Andy Shevchenko
                   ` (2 preceding siblings ...)
  2016-05-06 16:23 ` [PATCH v1 3/4] fusion: print lan address via %pMR Andy Shevchenko
@ 2016-05-06 16:23 ` Andy Shevchenko
  2016-06-20  9:03 ` [PATCH v1 0/4] scsi: some (very) old clean ups Andy Shevchenko
  4 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2016-05-06 16:23 UTC (permalink / raw)
  To: Martin K. Petersen, linux-scsi
  Cc: Oleksandr Khoshaba, Oleksandr Khoshaba, QLogic-Storage-Upstream,
	Andy Shevchenko

From: Oleksandr Khoshaba <oleksandr.khoshaba@gmail.com>

In the kernel we have nice specifier to print MAC by given pointer to the
address in a binary form.

Signed-off-by: Oleksandr Khoshaba <Oleksandr.Khoshaba@gmail.com>
Acked-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Cc: QLogic-Storage-Upstream@qlogic.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/scsi/qla4xxx/ql4_mbx.c |  5 +----
 drivers/scsi/qla4xxx/ql4_nx.c  |  8 ++------
 drivers/scsi/qla4xxx/ql4_os.c  | 15 ++++-----------
 3 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index c291fdf..1da04f3 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -2032,10 +2032,7 @@ int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha,
 	ptid = (uint16_t *)&fw_ddb_entry->isid[1];
 	*ptid = cpu_to_le16((uint16_t)ddb_entry->sess->target_id);
 
-	DEBUG2(ql4_printk(KERN_INFO, ha, "ISID [%02x%02x%02x%02x%02x%02x]\n",
-			  fw_ddb_entry->isid[5], fw_ddb_entry->isid[4],
-			  fw_ddb_entry->isid[3], fw_ddb_entry->isid[2],
-			  fw_ddb_entry->isid[1], fw_ddb_entry->isid[0]));
+	DEBUG2(ql4_printk(KERN_INFO, ha, "ISID [%pmR]\n", fw_ddb_entry->isid));
 
 	iscsi_opts = le16_to_cpu(fw_ddb_entry->iscsi_options);
 	memset(fw_ddb_entry->iscsi_alias, 0, sizeof(fw_ddb_entry->iscsi_alias));
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index ae87d6c..157938e 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -4094,12 +4094,8 @@ int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha)
 	ha->phy_port_num = sys_info->port_num;
 	ha->iscsi_pci_func_cnt = sys_info->iscsi_pci_func_cnt;
 
-	DEBUG2(printk("scsi%ld: %s: "
-	    "mac %02x:%02x:%02x:%02x:%02x:%02x "
-	    "serial %s\n", ha->host_no, __func__,
-	    ha->my_mac[0], ha->my_mac[1], ha->my_mac[2],
-	    ha->my_mac[3], ha->my_mac[4], ha->my_mac[5],
-	    ha->serial_number));
+	DEBUG2(printk("scsi%ld: %s: mac %pM serial %s\n",
+	    ha->host_no, __func__, ha->my_mac, ha->serial_number));
 
 	status = QLA_SUCCESS;
 
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 01c3610..9fbb33f 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -6304,13 +6304,9 @@ static int qla4xxx_compare_tuple_ddb(struct scsi_qla_host *ha,
 	 * ISID would not match firmware generated ISID.
 	 */
 	if (is_isid_compare) {
-		DEBUG2(ql4_printk(KERN_INFO, ha, "%s: old ISID [%02x%02x%02x"
-			"%02x%02x%02x] New ISID [%02x%02x%02x%02x%02x%02x]\n",
-			__func__, old_tddb->isid[5], old_tddb->isid[4],
-			old_tddb->isid[3], old_tddb->isid[2], old_tddb->isid[1],
-			old_tddb->isid[0], new_tddb->isid[5], new_tddb->isid[4],
-			new_tddb->isid[3], new_tddb->isid[2], new_tddb->isid[1],
-			new_tddb->isid[0]));
+		DEBUG2(ql4_printk(KERN_INFO, ha,
+			"%s: old ISID [%pmR] New ISID [%pmR]\n",
+			__func__, old_tddb->isid, new_tddb->isid));
 
 		if (memcmp(&old_tddb->isid[0], &new_tddb->isid[0],
 			   sizeof(old_tddb->isid)))
@@ -7925,10 +7921,7 @@ qla4xxx_sysfs_ddb_get_param(struct iscsi_bus_flash_session *fnode_sess,
 		rc = sprintf(buf, "%u\n", fnode_conn->keepalive_timeout);
 		break;
 	case ISCSI_FLASHNODE_ISID:
-		rc = sprintf(buf, "%02x%02x%02x%02x%02x%02x\n",
-			     fnode_sess->isid[0], fnode_sess->isid[1],
-			     fnode_sess->isid[2], fnode_sess->isid[3],
-			     fnode_sess->isid[4], fnode_sess->isid[5]);
+		rc = sprintf(buf, "%pm\n", fnode_sess->isid);
 		break;
 	case ISCSI_FLASHNODE_TSID:
 		rc = sprintf(buf, "%u\n", fnode_sess->tsid);
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 0/4] scsi: some (very) old clean ups
  2016-05-06 16:23 [PATCH v1 0/4] scsi: some (very) old clean ups Andy Shevchenko
                   ` (3 preceding siblings ...)
  2016-05-06 16:23 ` [PATCH v1 4/4] scsi: qla4xxx: print MAC and SID via %p[mM][R] Andy Shevchenko
@ 2016-06-20  9:03 ` Andy Shevchenko
  2016-06-21  0:59   ` Martin K. Petersen
  4 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2016-06-20  9:03 UTC (permalink / raw)
  To: Martin K. Petersen, linux-scsi

On Fri, 2016-05-06 at 19:23 +0300, Andy Shevchenko wrote:
> This is a set of independent clean ups that didn't land upstream for
> ages (some
> are dated 2010!).  As agreed with Martin at some point I resend
> them.
> 
> I have more, but the rest is not yet ready for submission.

Gentle ping to get know what is the destiny of my patches.

> 
> Andy Shevchenko (3):
>   libsas: remove private hex2bin() implementation
>   scsi: fnic: use kernel's '%pM' format option to print MAC
>   fusion: print lan address via %pMR
> 
> Oleksandr Khoshaba (1):
>   scsi: qla4xxx: print MAC and SID via %p[mM][R]
> 
>  drivers/message/fusion/mptbase.c    | 14 ++++----------
>  drivers/scsi/fnic/vnic_dev.c        | 10 ++--------
>  drivers/scsi/libsas/sas_scsi_host.c | 22 ++++++----------------
>  drivers/scsi/qla4xxx/ql4_mbx.c      |  5 +----
>  drivers/scsi/qla4xxx/ql4_nx.c       |  8 ++------
>  drivers/scsi/qla4xxx/ql4_os.c       | 15 ++++-----------
>  6 files changed, 19 insertions(+), 55 deletions(-)
> 

-- 

Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 0/4] scsi: some (very) old clean ups
  2016-06-20  9:03 ` [PATCH v1 0/4] scsi: some (very) old clean ups Andy Shevchenko
@ 2016-06-21  0:59   ` Martin K. Petersen
  0 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2016-06-21  0:59 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Martin K. Petersen, linux-scsi

>>>>> "Andy" == Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:

Andy,

Andy> Gentle ping to get know what is the destiny of my patches.

-ENOREVIEWS

At this point they have expired from patchworks so it's probably best to
post them again. And make sure to pester the relevant driver
maintainers.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-21  1:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-06 16:23 [PATCH v1 0/4] scsi: some (very) old clean ups Andy Shevchenko
2016-05-06 16:23 ` [PATCH v1 1/4] libsas: remove private hex2bin() implementation Andy Shevchenko
2016-05-06 16:23 ` [PATCH v1 2/4] scsi: fnic: use kernel's '%pM' format option to print MAC Andy Shevchenko
2016-05-06 16:23 ` [PATCH v1 3/4] fusion: print lan address via %pMR Andy Shevchenko
2016-05-06 16:23 ` [PATCH v1 4/4] scsi: qla4xxx: print MAC and SID via %p[mM][R] Andy Shevchenko
2016-06-20  9:03 ` [PATCH v1 0/4] scsi: some (very) old clean ups Andy Shevchenko
2016-06-21  0:59   ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).