* [PATCH v3 1/6] scsi: fnic: use kernel's '%pM' format option to print MAC
2016-10-22 17:32 [PATCH v3 0/6] scsi: collection of clean ups Andy Shevchenko
@ 2016-10-22 17:32 ` 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
` (5 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2016-10-22 17:32 UTC (permalink / raw)
To: Martin K . Petersen, linux-scsi, James E.J. Bottomley
Cc: Andy Shevchenko, Hiral Patel, Suma Ramars
Instead of supplying each byte through stack let's use %pM specifier.
Cc: Hiral Patel <hiralpat@cisco.com>
Cc: Suma Ramars <sramars@cisco.com>
Acked-by: Tom Tucker <tom@opengridcomputing.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.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 1/6] scsi: fnic: use kernel's '%pM' format option to print MAC
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
0 siblings, 0 replies; 13+ messages in thread
From: Ewan D. Milne @ 2016-10-24 12:29 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley,
Hiral Patel, Suma Ramars
On Sat, 2016-10-22 at 20:32 +0300, Andy Shevchenko wrote:
> Instead of supplying each byte through stack let's use %pM specifier.
>
> Cc: Hiral Patel <hiralpat@cisco.com>
> Cc: Suma Ramars <sramars@cisco.com>
> Acked-by: Tom Tucker <tom@opengridcomputing.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)
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 2/6] fusion: print lan address via %pMR
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-22 17:32 ` 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
` (4 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2016-10-22 17:32 UTC (permalink / raw)
To: Martin K . Petersen, linux-scsi, James E.J. Bottomley
Cc: Andy Shevchenko, Sathya Prakash, Chaitra P B, Suganath Prabu Subramani
LAN MAC addresses can be printed directly using %pMR specifier.
Cc: Sathya Prakash <sathya.prakash@broadcom.com>
Cc: Chaitra P B <chaitra.basappa@broadcom.com>
Cc: Suganath Prabu Subramani <suganath-prabu.subramani@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 89c7ed1..f82745c 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -2585,10 +2585,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;
@@ -6783,8 +6780,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,
@@ -6861,8 +6857,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);
@@ -6896,8 +6891,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.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 2/6] fusion: print lan address via %pMR
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
0 siblings, 0 replies; 13+ messages in thread
From: Ewan D. Milne @ 2016-10-24 12:32 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley,
Sathya Prakash, Chaitra P B, Suganath Prabu Subramani
On Sat, 2016-10-22 at 20:32 +0300, Andy Shevchenko wrote:
> LAN MAC addresses can be printed directly using %pMR specifier.
>
> Cc: Sathya Prakash <sathya.prakash@broadcom.com>
> Cc: Chaitra P B <chaitra.basappa@broadcom.com>
> Cc: Suganath Prabu Subramani <suganath-prabu.subramani@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 89c7ed1..f82745c 100644
> --- a/drivers/message/fusion/mptbase.c
> +++ b/drivers/message/fusion/mptbase.c
> @@ -2585,10 +2585,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;
>
> @@ -6783,8 +6780,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,
> @@ -6861,8 +6857,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);
> @@ -6896,8 +6891,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);
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 3/6] scsi: qla4xxx: print MAC and SID via %p[mM][R]
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-22 17:32 ` [PATCH v3 2/6] fusion: print lan address via %pMR Andy Shevchenko
@ 2016-10-22 17:32 ` 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
` (3 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2016-10-22 17:32 UTC (permalink / raw)
To: Martin K . Petersen, linux-scsi, James E.J. Bottomley
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 06ddd13..bccd8b6 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.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 3/6] scsi: qla4xxx: print MAC and SID via %p[mM][R]
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
0 siblings, 0 replies; 13+ messages in thread
From: Ewan D. Milne @ 2016-10-24 12:34 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley,
Oleksandr Khoshaba, QLogic-Storage-Upstream
On Sat, 2016-10-22 at 20:32 +0300, Andy Shevchenko wrote:
> 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 06ddd13..bccd8b6 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);
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 4/6] [SCSI] ips: don't use custom hex_asc_upper[] table
2016-10-22 17:32 [PATCH v3 0/6] scsi: collection of clean ups Andy Shevchenko
` (2 preceding siblings ...)
2016-10-22 17:32 ` [PATCH v3 3/6] scsi: qla4xxx: print MAC and SID via %p[mM][R] Andy Shevchenko
@ 2016-10-22 17:32 ` Andy Shevchenko
2016-10-24 12:34 ` Ewan D. Milne
2016-10-22 17:32 ` [PATCH v3 5/6] scsi: replace custom approach to hexdump small buffers Andy Shevchenko
` (2 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2016-10-22 17:32 UTC (permalink / raw)
To: Martin K . Petersen, linux-scsi, James E.J. Bottomley
Cc: Andy Shevchenko, Adaptec OEM Raid Solutions
From: Andy Shevchenko <andy.shevchenko@gmail.com>
We have table of the HEX characters in the kernel. Replace custom by a generic
one.
Cc: Adaptec OEM Raid Solutions <aacraid@adaptec.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/scsi/ips.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 02cb76f..3419e1b 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -2241,9 +2241,6 @@ ips_get_bios_version(ips_ha_t * ha, int intr)
uint8_t minor;
uint8_t subminor;
uint8_t *buffer;
- char hexDigits[] =
- { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
- 'D', 'E', 'F' };
METHOD_TRACE("ips_get_bios_version", 1);
@@ -2374,13 +2371,13 @@ ips_get_bios_version(ips_ha_t * ha, int intr)
}
}
- ha->bios_version[0] = hexDigits[(major & 0xF0) >> 4];
+ ha->bios_version[0] = hex_asc_upper_hi(major);
ha->bios_version[1] = '.';
- ha->bios_version[2] = hexDigits[major & 0x0F];
- ha->bios_version[3] = hexDigits[subminor];
+ ha->bios_version[2] = hex_asc_upper_lo(major);
+ ha->bios_version[3] = hex_asc_upper_lo(subminor);
ha->bios_version[4] = '.';
- ha->bios_version[5] = hexDigits[(minor & 0xF0) >> 4];
- ha->bios_version[6] = hexDigits[minor & 0x0F];
+ ha->bios_version[5] = hex_asc_upper_hi(minor);
+ ha->bios_version[6] = hex_asc_upper_lo(minor);
ha->bios_version[7] = 0;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 4/6] [SCSI] ips: don't use custom hex_asc_upper[] table
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
0 siblings, 0 replies; 13+ messages in thread
From: Ewan D. Milne @ 2016-10-24 12:34 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley,
Andy Shevchenko, Adaptec OEM Raid Solutions
On Sat, 2016-10-22 at 20:32 +0300, Andy Shevchenko wrote:
> From: Andy Shevchenko <andy.shevchenko@gmail.com>
>
> We have table of the HEX characters in the kernel. Replace custom by a generic
> one.
>
> Cc: Adaptec OEM Raid Solutions <aacraid@adaptec.com>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
> drivers/scsi/ips.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
> index 02cb76f..3419e1b 100644
> --- a/drivers/scsi/ips.c
> +++ b/drivers/scsi/ips.c
> @@ -2241,9 +2241,6 @@ ips_get_bios_version(ips_ha_t * ha, int intr)
> uint8_t minor;
> uint8_t subminor;
> uint8_t *buffer;
> - char hexDigits[] =
> - { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C',
> - 'D', 'E', 'F' };
>
> METHOD_TRACE("ips_get_bios_version", 1);
>
> @@ -2374,13 +2371,13 @@ ips_get_bios_version(ips_ha_t * ha, int intr)
> }
> }
>
> - ha->bios_version[0] = hexDigits[(major & 0xF0) >> 4];
> + ha->bios_version[0] = hex_asc_upper_hi(major);
> ha->bios_version[1] = '.';
> - ha->bios_version[2] = hexDigits[major & 0x0F];
> - ha->bios_version[3] = hexDigits[subminor];
> + ha->bios_version[2] = hex_asc_upper_lo(major);
> + ha->bios_version[3] = hex_asc_upper_lo(subminor);
> ha->bios_version[4] = '.';
> - ha->bios_version[5] = hexDigits[(minor & 0xF0) >> 4];
> - ha->bios_version[6] = hexDigits[minor & 0x0F];
> + ha->bios_version[5] = hex_asc_upper_hi(minor);
> + ha->bios_version[6] = hex_asc_upper_lo(minor);
> ha->bios_version[7] = 0;
> }
>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 5/6] scsi: replace custom approach to hexdump small buffers
2016-10-22 17:32 [PATCH v3 0/6] scsi: collection of clean ups Andy Shevchenko
` (3 preceding siblings ...)
2016-10-22 17:32 ` [PATCH v3 4/6] [SCSI] ips: don't use custom hex_asc_upper[] table Andy Shevchenko
@ 2016-10-22 17:32 ` Andy Shevchenko
2016-10-24 12:35 ` 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
6 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2016-10-22 17:32 UTC (permalink / raw)
To: Martin K . Petersen, linux-scsi, James E.J. Bottomley
Cc: Andy Shevchenko, Jon Mason
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
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 5/6] scsi: replace custom approach to hexdump small buffers
2016-10-22 17:32 ` [PATCH v3 5/6] scsi: replace custom approach to hexdump small buffers Andy Shevchenko
@ 2016-10-24 12:35 ` Ewan D. Milne
0 siblings, 0 replies; 13+ messages in thread
From: Ewan D. Milne @ 2016-10-24 12:35 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley, Jon Mason
On Sat, 2016-10-22 at 20:32 +0300, Andy Shevchenko wrote:
> 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);
> }
> }
> }
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 6/6] cciss: replace custom function to hexdump
2016-10-22 17:32 [PATCH v3 0/6] scsi: collection of clean ups Andy Shevchenko
` (4 preceding siblings ...)
2016-10-22 17:32 ` [PATCH v3 5/6] scsi: replace custom approach to hexdump small buffers Andy Shevchenko
@ 2016-10-22 17:32 ` Andy Shevchenko
2016-10-25 2:12 ` [PATCH v3 0/6] scsi: collection of clean ups Martin K. Petersen
6 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2016-10-22 17:32 UTC (permalink / raw)
To: Martin K . Petersen, linux-scsi, James E.J. Bottomley
Cc: Andy Shevchenko, Don Brace, esc.storagedev
For small buffers we may use %*ph[N] specifier, for the bigger blocks
print_hex_dump() call.
Cc: Don Brace <don.brace@microsemi.com>
Cc: esc.storagedev@microsemi.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/block/cciss_scsi.c | 72 +++++++---------------------------------------
1 file changed, 10 insertions(+), 62 deletions(-)
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 1537302..a18de9d 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -260,43 +260,6 @@ scsi_cmd_stack_free(ctlr_info_t *h)
}
#if 0
-static int xmargin=8;
-static int amargin=60;
-
-static void
-print_bytes (unsigned char *c, int len, int hex, int ascii)
-{
-
- int i;
- unsigned char *x;
-
- if (hex)
- {
- x = c;
- for (i=0;i<len;i++)
- {
- if ((i % xmargin) == 0 && i>0) printk("\n");
- if ((i % xmargin) == 0) printk("0x%04x:", i);
- printk(" %02x", *x);
- x++;
- }
- printk("\n");
- }
- if (ascii)
- {
- x = c;
- for (i=0;i<len;i++)
- {
- if ((i % amargin) == 0 && i>0) printk("\n");
- if ((i % amargin) == 0) printk("0x%04x:", i);
- if (*x > 26 && *x < 128) printk("%c", *x);
- else printk(".");
- x++;
- }
- printk("\n");
- }
-}
-
static void
print_cmd(CommandList_struct *cp)
{
@@ -305,30 +268,13 @@ print_cmd(CommandList_struct *cp)
printk("sgtot:%d\n", cp->Header.SGTotal);
printk("Tag:0x%08x/0x%08x\n", cp->Header.Tag.upper,
cp->Header.Tag.lower);
- printk("LUN:0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
- cp->Header.LUN.LunAddrBytes[0],
- cp->Header.LUN.LunAddrBytes[1],
- cp->Header.LUN.LunAddrBytes[2],
- cp->Header.LUN.LunAddrBytes[3],
- cp->Header.LUN.LunAddrBytes[4],
- cp->Header.LUN.LunAddrBytes[5],
- cp->Header.LUN.LunAddrBytes[6],
- cp->Header.LUN.LunAddrBytes[7]);
+ printk("LUN:0x%8phN\n", cp->Header.LUN.LunAddrBytes);
printk("CDBLen:%d\n", cp->Request.CDBLen);
printk("Type:%d\n",cp->Request.Type.Type);
printk("Attr:%d\n",cp->Request.Type.Attribute);
printk(" Dir:%d\n",cp->Request.Type.Direction);
printk("Timeout:%d\n",cp->Request.Timeout);
- printk( "CDB: %02x %02x %02x %02x %02x %02x %02x %02x"
- " %02x %02x %02x %02x %02x %02x %02x %02x\n",
- cp->Request.CDB[0], cp->Request.CDB[1],
- cp->Request.CDB[2], cp->Request.CDB[3],
- cp->Request.CDB[4], cp->Request.CDB[5],
- cp->Request.CDB[6], cp->Request.CDB[7],
- cp->Request.CDB[8], cp->Request.CDB[9],
- cp->Request.CDB[10], cp->Request.CDB[11],
- cp->Request.CDB[12], cp->Request.CDB[13],
- cp->Request.CDB[14], cp->Request.CDB[15]),
+ printk("CDB: %16ph\n", cp->Request.CDB);
printk("edesc.Addr: 0x%08x/0%08x, Len = %d\n",
cp->ErrDesc.Addr.upper, cp->ErrDesc.Addr.lower,
cp->ErrDesc.Len);
@@ -340,9 +286,7 @@ print_cmd(CommandList_struct *cp)
printk("offense size:%d\n", cp->err_info->MoreErrInfo.Invalid_Cmd.offense_size);
printk("offense byte:%d\n", cp->err_info->MoreErrInfo.Invalid_Cmd.offense_num);
printk("offense value:%d\n", cp->err_info->MoreErrInfo.Invalid_Cmd.offense_value);
-
}
-
#endif
static int
@@ -782,8 +726,10 @@ static void complete_scsi_command(CommandList_struct *c, int timeout,
"reported\n", c);
break;
case CMD_INVALID: {
- /* print_bytes(c, sizeof(*c), 1, 0);
- print_cmd(c); */
+ /*
+ print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 1, c, sizeof(*c), false);
+ print_cmd(c);
+ */
/* We get CMD_INVALID if you address a non-existent tape drive instead
of a selection timeout (no response). You will see this if you yank
out a tape drive, then try to access it. This is kind of a shame
@@ -985,8 +931,10 @@ cciss_scsi_interpret_error(ctlr_info_t *h, CommandList_struct *c)
dev_warn(&h->pdev->dev,
"%p is reported invalid (probably means "
"target device no longer present)\n", c);
- /* print_bytes((unsigned char *) c, sizeof(*c), 1, 0);
- print_cmd(c); */
+ /*
+ print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 1, c, sizeof(*c), false);
+ print_cmd(c);
+ */
}
break;
case CMD_PROTOCOL_ERR:
--
2.9.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3 0/6] scsi: collection of clean ups
2016-10-22 17:32 [PATCH v3 0/6] scsi: collection of clean ups Andy Shevchenko
` (5 preceding siblings ...)
2016-10-22 17:32 ` [PATCH v3 6/6] cciss: replace custom function to hexdump Andy Shevchenko
@ 2016-10-25 2:12 ` Martin K. Petersen
6 siblings, 0 replies; 13+ messages in thread
From: Martin K. Petersen @ 2016-10-25 2:12 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Martin K . Petersen, linux-scsi, James E.J. Bottomley
>>>>> "Andy" == Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
Andy> Just collection of clean ups against SCSI drivers. Some of them
Andy> were Acked quite long ago, but didn't make upstream yet.
Applied to 4.10/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 13+ messages in thread