Skip to contentSkip to conversation

cciss: fix regression firmware version not displayed in procfs (again)

PATCH In review Mike Miller 2 participants 2 messages Oct 16, 2008

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

PATCH 2/2 cciss: fix regression firmware version not displayed in procfs (again)

Patch 2 of 2

The regression was introduced by commit 6ae5ce8e8d4de666f31286808d2285aa6a50fa40.
This patch fixes a regression where the controller firmware version is not displayed in procfs. The previous patch would be called anytime something changed. This will get called only once for each controller. Please consider this for inclusion.

drivers/block/cciss.c +21 -1
index 0f367b1..1c830bd 100644
@@ -3404,7 +3404,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 	int i;
 	int j = 0;
 	int rc;
-	int dac;
+	int dac, return_code;
+	InquiryData_struct *inq_buff = NULL;
 
 	i = alloc_cciss_hba();
 	if (i < 0)
@@ -3510,6 +3511,25 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 	/* Turn the interrupts on so we can service requests */
 	hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON);
 
+	/* Get the firmware version */
+	inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL);
+	if (inq_buff == NULL) {
+		printk(KERN_ERR "cciss: out of memory\n");
+		return -ENOMEM;
+	}
+
+	return_code = sendcmd_withirq(CISS_INQUIRY, i, inq_buff,
+		sizeof(InquiryData_struct), 0, 0 , 0, TYPE_CMD);
+	if (return_code == IO_OK) {
+		hba[i]->firm_ver[0] = inq_buff->data_byte[32];
+		hba[i]->firm_ver[1] = inq_buff->data_byte[33];
+		hba[i]->firm_ver[2] = inq_buff->data_byte[34];
+		hba[i]->firm_ver[3] = inq_buff->data_byte[35];
+	} else {	 /* send command failed */
+		printk(KERN_WARNING "cciss: unable to determine firmware"
+			" version of controller\n");
+	}
+
 	cciss_procinit(i);
 
 	hba[i]->cciss_max_sectors = 2048;
#1 lore raw
Quoted 16 lines · On Thu, 16 Oct 2008 17:48:58 -0500 Mike Miller <[email protected]> wrote:

Patch 2 of 2

The regression was introduced by commit 6ae5ce8e8d4de666f31286808d2285aa6a50fa40.
This patch fixes a regression where the controller firmware version is not displayed in procfs. The previous patch would be called anytime something changed. This will get called only once for each controller. Please consider this for inclusion.

drivers/block/cciss.c +0 -0
index 0f367b1..1c830bd 100644

drivers/block/cciss.c static int __devinit cciss_init_one(struct pci_dev *pdev, · line 3408

Quoted 6 lines
drivers/block/cciss.c +2 -1
@@ -3404,7 +3404,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 	int i;
 	int j = 0;
 	int rc;
-	int dac;
+	int dac, return_code;
+	InquiryData_struct *inq_buff = NULL;

unneeded initialisation is still there.

drivers/block/cciss.c static int __devinit cciss_init_one(struct pci_dev *pdev, · line 3515

Quoted 8 lines
drivers/block/cciss.c +2 -0
 	i = alloc_cciss_hba();
 	if (i < 0)
@@ -3510,6 +3511,25 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 	/* Turn the interrupts on so we can service requests */
 	hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON);
 
+	/* Get the firmware version */
+	inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL);

Does this ever get freed?

Quoted 20 lines
drivers/block/cciss.c +17 -0
+	if (inq_buff == NULL) {
+		printk(KERN_ERR "cciss: out of memory\n");
+		return -ENOMEM;
+	}
+
+	return_code = sendcmd_withirq(CISS_INQUIRY, i, inq_buff,
+		sizeof(InquiryData_struct), 0, 0 , 0, TYPE_CMD);
+	if (return_code == IO_OK) {
+		hba[i]->firm_ver[0] = inq_buff->data_byte[32];
+		hba[i]->firm_ver[1] = inq_buff->data_byte[33];
+		hba[i]->firm_ver[2] = inq_buff->data_byte[34];
+		hba[i]->firm_ver[3] = inq_buff->data_byte[35];
+	} else {	 /* send command failed */
+		printk(KERN_WARNING "cciss: unable to determine firmware"
+			" version of controller\n");
+	}
+
 	cciss_procinit(i);
 
 	hba[i]->cciss_max_sectors = 2048;