diff mbox

[19/21] hpsa: enhance device messages

Message ID 20151024195422.17127.55326.stgit@brunhilda (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Don Brace Oct. 24, 2015, 7:54 p.m. UTC
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
---
 drivers/scsi/hpsa.c |   46 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)


--
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

Comments

kernel test robot Oct. 24, 2015, 8:19 p.m. UTC | #1
Hi Don,

[auto build test ERROR on scsi/for-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Don-Brace/hpsa-updates/20151025-040012
config: x86_64-randconfig-x017-201543 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   drivers/scsi/hpsa.c: In function 'hpsa_show_dev_msg':
>> drivers/scsi/hpsa.c:1182:2: error: expected expression before 'if'
     if (dev == NULL)
     ^
>> drivers/scsi/hpsa.c:1181:75: warning: left-hand operand of comma expression has no effect [-Wunused-value]
       "scsi %d:%d:%d:%d: %s %s %.8s %.16s %s SSDSmartPathCap%c En%c Exp=%d\n",
                                                                              ^

vim +/if +1182 drivers/scsi/hpsa.c

4e3d7818 Don Brace 2015-10-24  1175  		break;
4e3d7818 Don Brace 2015-10-24  1176  	default:
4e3d7818 Don Brace 2015-10-24  1177  		snprintf(label, LABEL_SIZE, "UNKNOWN");
4e3d7818 Don Brace 2015-10-24  1178  		break;
4e3d7818 Don Brace 2015-10-24  1179  	}
4e3d7818 Don Brace 2015-10-24  1180  
4e3d7818 Don Brace 2015-10-24 @1181  			"scsi %d:%d:%d:%d: %s %s %.8s %.16s %s SSDSmartPathCap%c En%c Exp=%d\n",
c59f371e Don Brace 2015-10-24 @1182  	if (dev == NULL)
c59f371e Don Brace 2015-10-24  1183  		return;
c59f371e Don Brace 2015-10-24  1184  
c59f371e Don Brace 2015-10-24  1185  	dev_warn(&h->pdev->dev,

:::::: The code at line 1182 was first introduced by commit
:::::: c59f371efab30f7066af482dc6a1b1cfddd562f0 hpsa: correct calls to dev_printk

:::::: TO: Don Brace <don.brace@pmcs.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Don Brace Oct. 26, 2015, 1:36 p.m. UTC | #2
On 10/24/2015 03:19 PM, kbuild test robot wrote:
> Hi Don,
>
> [auto build test ERROR on scsi/for-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
>
> url:    https://github.com/0day-ci/linux/commits/Don-Brace/hpsa-updates/20151025-040012
> config: x86_64-randconfig-x017-201543 (attached as .config)
> reproduce:
>          # save the attached .config to linux build tree
>          make ARCH=x86_64
>
> All error/warnings (new ones prefixed by >>):
>
>     drivers/scsi/hpsa.c: In function 'hpsa_show_dev_msg':
>>> drivers/scsi/hpsa.c:1182:2: error: expected expression before 'if'
>       if (dev == NULL)
>       ^
>>> drivers/scsi/hpsa.c:1181:75: warning: left-hand operand of comma expression has no effect [-Wunused-value]
>         "scsi %d:%d:%d:%d: %s %s %.8s %.16s %s SSDSmartPathCap%c En%c Exp=%d\n",
>                                                                                ^
>
> vim +/if +1182 drivers/scsi/hpsa.c
>
> 4e3d7818 Don Brace 2015-10-24  1175  		break;
> 4e3d7818 Don Brace 2015-10-24  1176  	default:
> 4e3d7818 Don Brace 2015-10-24  1177  		snprintf(label, LABEL_SIZE, "UNKNOWN");
> 4e3d7818 Don Brace 2015-10-24  1178  		break;
> 4e3d7818 Don Brace 2015-10-24  1179  	}
> 4e3d7818 Don Brace 2015-10-24  1180
> 4e3d7818 Don Brace 2015-10-24 @1181  			"scsi %d:%d:%d:%d: %s %s %.8s %.16s %s SSDSmartPathCap%c En%c Exp=%d\n",
> c59f371e Don Brace 2015-10-24 @1182  	if (dev == NULL)
> c59f371e Don Brace 2015-10-24  1183  		return;
> c59f371e Don Brace 2015-10-24  1184
> c59f371e Don Brace 2015-10-24  1185  	dev_warn(&h->pdev->dev,
>
> :::::: The code at line 1182 was first introduced by commit
> :::::: c59f371efab30f7066af482dc6a1b1cfddd562f0 hpsa: correct calls to dev_printk
>
> :::::: TO: Don Brace <don.brace@pmcs.com>
> :::::: CC: 0day robot <fengguang.wu@intel.com>
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Wow. I had a merge conflict that kdiff3 auto-resolved.
Sorry about that. Anyone else ever have that happen?

I'll send out v1 soon.

Thanks
--
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
diff mbox

Patch

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index dfe5c21..1841b5a 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -607,7 +607,7 @@  static inline int is_logical_dev_addr_mode(unsigned char scsi3addr[])
 }
 
 static const char * const raid_label[] = { "0", "4", "1(+0)", "5", "5+1", "6",
-	"1(+0)ADM", "UNKNOWN"
+	"1(+0)ADM", "UNKNOWN", "PHYS DRV"
 };
 #define HPSA_RAID_0	0
 #define HPSA_RAID_4	1
@@ -616,7 +616,8 @@  static const char * const raid_label[] = { "0", "4", "1(+0)", "5", "5+1", "6",
 #define HPSA_RAID_51	4
 #define HPSA_RAID_6	5	/* also used for RAID 60 */
 #define HPSA_RAID_ADM	6	/* also used for RAID 1+0 ADM */
-#define RAID_UNKNOWN (ARRAY_SIZE(raid_label) - 1)
+#define RAID_UNKNOWN (ARRAY_SIZE(raid_label) - 2)
+#define PHYSICAL_DRIVE (ARRAY_SIZE(raid_label) - 1)
 
 static inline bool is_logical_device(struct hpsa_scsi_dev_t *device)
 {
@@ -1142,19 +1143,54 @@  static int hpsa_find_target_lun(struct ctlr_info *h,
 static inline void hpsa_show_dev_msg(const char *level, struct ctlr_info *h,
 	struct hpsa_scsi_dev_t *dev, char *description)
 {
+#define LABEL_SIZE 15
+	char label[LABEL_SIZE];
+
+	switch (dev->devtype) {
+	case TYPE_RAID:
+		snprintf(label, LABEL_SIZE, "controller");
+		break;
+	case TYPE_ENCLOSURE:
+		snprintf(label, LABEL_SIZE, "enclosure");
+		break;
+	case TYPE_DISK:
+		if (dev->external)
+			snprintf(label, LABEL_SIZE, "external");
+		else if (!is_logical_dev_addr_mode(dev->scsi3addr))
+			snprintf(label, LABEL_SIZE, "%s",
+				raid_label[PHYSICAL_DRIVE]);
+		else
+			snprintf(label, LABEL_SIZE, "RAID-%s",
+				dev->raid_level > RAID_UNKNOWN ? "?" :
+				raid_label[dev->raid_level]);
+		break;
+	case TYPE_ROM:
+		snprintf(label, LABEL_SIZE, "rom");
+		break;
+	case TYPE_TAPE:
+		snprintf(label, LABEL_SIZE, "tape");
+		break;
+	case TYPE_MEDIUM_CHANGER:
+		snprintf(label, LABEL_SIZE, "changer");
+		break;
+	default:
+		snprintf(label, LABEL_SIZE, "UNKNOWN");
+		break;
+	}
+
+			"scsi %d:%d:%d:%d: %s %s %.8s %.16s %s SSDSmartPathCap%c En%c Exp=%d\n",
 	if (dev == NULL)
 		return;
 
 	dev_warn(&h->pdev->dev,
-			"scsi %d:%d:%d:%d: %s %s %.8s %.16s RAID-%s SSDSmartPathCap%c En%c Exp=%d\n",
+			"scsi %d:%d:%d:%d: %s %s %.8s %.16s %s SSDSmartPathCap%c En%c Exp=%d\n",
 			h->scsi_host->host_no, dev->bus, dev->target, dev->lun,
 			description,
 			dev->devtype >= 0 ?
 				scsi_device_type(dev->devtype) : "unknown",
 			dev->vendor,
 			dev->model,
-			dev->raid_level > RAID_UNKNOWN ?
-				"RAID-?" : raid_label[dev->raid_level],
+			label,
 			dev->offload_config ? '+' : '-',
 			dev->offload_enabled ? '+' : '-',
 			dev->expose_device);