Skip to contentSkip to conversation

scsi: use kernel's '%pM' format option to print MAC

PATCH In review Andy Shevchenko 2 participants 4 messages Jul 12, 2012 – May 28, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 scsi: use kernel's '%pM' format option to print MAC

---
 drivers/scsi/fnic/vnic_dev.c  |   10 ++--------
 drivers/scsi/qla4xxx/ql4_nx.c |    8 ++------
 2 files changed, 4 insertions(+), 14 deletions(-)
drivers/scsi/fnic/vnic_dev.c +2 -8
index b576be7..0cb8ad0 100644
@@ -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);
+		printk(KERN_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);
+		printk(KERN_ERR "Can't del addr [%pM], %d\n", addr, err);
 }
 
 int vnic_dev_notify_set(struct vnic_dev *vdev, u16 intr)
drivers/scsi/qla4xxx/ql4_nx.c +2 -6
index 228b670..c163767 100644
@@ -2964,12 +2964,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;
 
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/2 scsi: qla2xxx: print MAC via %pMR

---
 drivers/scsi/qla2xxx/qla_attr.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +1 -4
index 5ab9530..095ba85 100644
@@ -1193,10 +1193,7 @@ qla2x00_vn_port_mac_address_show(struct device *dev,
 	if (!IS_CNA_CAPABLE(vha->hw))
 		return snprintf(buf, PAGE_SIZE, "\n");
 
-	return snprintf(buf, PAGE_SIZE, "%02x:%02x:%02x:%02x:%02x:%02x\n",
-	    vha->fcoe_vn_port_mac[5], vha->fcoe_vn_port_mac[4],
-	    vha->fcoe_vn_port_mac[3], vha->fcoe_vn_port_mac[2],
-	    vha->fcoe_vn_port_mac[1], vha->fcoe_vn_port_mac[0]);
+	return snprintf(buf, PAGE_SIZE, "%pMR\n", vha->fcoe_vn_port_mac);
 }
 
 static ssize_t
Signature · 1 line
1.7.10.4
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] scsi: qla2xxx: print MAC via %pMR

Quoted 20 lines · Andy Shevchenko

---
drivers/scsi/qla2xxx/qla_attr.c | 5 +----

1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +1 -4
index 5ab9530..095ba85 100644
@@ -1193,10 +1193,7 @@ qla2x00_vn_port_mac_address_show(struct device *dev,
      if (!IS_CNA_CAPABLE(vha->hw))
              return snprintf(buf, PAGE_SIZE, "\n");
 
-     return snprintf(buf, PAGE_SIZE, "%02x:%02x:%02x:%02x:%02x:%02x\n",
-         vha->fcoe_vn_port_mac[5], vha->fcoe_vn_port_mac[4],
-         vha->fcoe_vn_port_mac[3], vha->fcoe_vn_port_mac[2],
-         vha->fcoe_vn_port_mac[1], vha->fcoe_vn_port_mac[0]);
+     return snprintf(buf, PAGE_SIZE, "%pMR\n", vha->fcoe_vn_port_mac);
 }
 
Quoted 2 lines

static ssize_t

This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.

#3 lore raw

Re: [PATCH 2/2] scsi: qla2xxx: print MAC via %pMR

Quoted 23 lines · Chad Dupuis
Quoted 20 lines · Andy Shevchenko

---
drivers/scsi/qla2xxx/qla_attr.c | 5 +----

1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +1 -4
index 5ab9530..095ba85 100644
@@ -1193,10 +1193,7 @@ qla2x00_vn_port_mac_address_show(struct device *dev,
      if (!IS_CNA_CAPABLE(vha->hw))
              return snprintf(buf, PAGE_SIZE, "\n");
 
-     return snprintf(buf, PAGE_SIZE, "%02x:%02x:%02x:%02x:%02x:%02x\n",
-         vha->fcoe_vn_port_mac[5], vha->fcoe_vn_port_mac[4],
-         vha->fcoe_vn_port_mac[3], vha->fcoe_vn_port_mac[2],
-         vha->fcoe_vn_port_mac[1], vha->fcoe_vn_port_mac[0]);
+     return snprintf(buf, PAGE_SIZE, "%pMR\n", vha->fcoe_vn_port_mac);
 }
 
Quoted 4 lines
Quoted 2 lines

static ssize_t

James, do you have any comments on this patch and patch 1/2?

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy