Skip to contentSkip to conversation

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

PATCH In review Mike Miller 2 participants 3 messages Oct 21, 2008 – Oct 22, 2008

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

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

Patch 2 of 2

Sorry for the delay. I've been out of the office and the network has been down since before lunch CDT. This 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.

In this patch I again initialize *inq_buff to NULL per Tomo's comments. I also use a goto clean 4 instead of returning -ENOMEM if the kzalloc fails.

I hope this finally meets everyones expectations.

Please consider this for inclusion.

drivers/block/cciss.c +22 -1
index 0f367b1..eb68f39 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");
+		goto clean4;
+	}
+
+	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;
@@ -3520,6 +3540,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 	return 1;
 
 clean4:
+	kfree(inq_buff);
 #ifdef CONFIG_CISS_SCSI_TAPE
 	kfree(hba[i]->scsi_rejects.complete);
 #endif
#1 lore raw
Quoted 1 line · On Tue, 21 Oct 2008 16:23:22 -0500 Mike Miller <[email protected]> wrote:

Patch 2 of 2

What happened with "1 of 2"?

Quoted 7 lines

Sorry for the delay. I've been out of the office and the network has been down since before lunch CDT. This 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.

Quoted 8 lines

In this patch I again initialize *inq_buff to NULL per Tomo's comments. I also use a goto clean 4 instead of returning -ENOMEM if the kzalloc fails.

I hope this finally meets everyones expectations.

Please consider this for inclusion.

So this fix is needed in 2.6.27.x, yes?

#2 lore raw
Quoted 12 lines

-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Tuesday, October 21, 2008 5:44 PM
To: Miller, Mike (OS Dev)
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2] cciss:fix regression firmware not displayed in procfs (again and again)

Quoted 6 lines
Quoted 1 line · On Tue, 21 Oct 2008 16:23:22 -0500 Mike Miller <[email protected]> wrote:

Patch 2 of 2

What happened with "1 of 2"?

Andrew,
That was the patch to fix the sysfs symlink. You merged it and then superceded with my later patch.

--- snip -----

The patch titled
cciss: fix sysfs regression
has been removed from the -mm tree. Its filename was
cciss-fix-sysfs-regression.patch

This patch was dropped because an updated version will be merged

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: cciss: fix sysfs regression
From: Mike Miller <[email protected]>

Fix a broken symlink in sysfs.

---

 drivers/block/cciss.c |    1 +
 1 file changed, 1 insertion(+)
drivers/block/cciss.c renamed from drivers/block/cciss.c~cciss-fix-sysfs-regression +1 -0
diff -puN drivers/block/cciss.c~cciss-fix-sysfs-regression drivers/block/cciss.c
@@ -1365,6 +1365,7 @@ static void cciss_add_disk(ctlr_info_t *
        disk->first_minor = drv_index << NWD_SHIFT;
        disk->fops = &cciss_fops;
        disk->private_data = &h->drv[drv_index];
+       disk->driverfs_dev = &h->pdev->dev;
 
        /* Set up queue information */
        blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask); _

Patches currently in -mm which might be from [email protected] are

origin.patch
cciss-fix-sysfs-regression.patch

----snip-----

Actually, this looks like the right one.

-- mikem

Quoted 23 lines
Quoted 2 lines

Sorry for the delay. I've been out of the office and the

network has

Quoted 3 lines

been down since before lunch CDT. This regression was introduced by commit 6ae5ce8e8d4de666f31286808d2285aa6a50fa40.
This patch fixes a regression where the controller firmware

version is

Quoted 2 lines

not displayed in procfs. The previous patch would be called anytime something changed. This will get called only once for each

controller.

Quoted 3 lines

In this patch I again initialize *inq_buff to NULL per Tomo's comments. I also use a goto clean 4 instead of returning

-ENOMEM if the kzalloc fails.

Quoted 6 lines

I hope this finally meets everyones expectations.

Please consider this for inclusion.

So this fix is needed in 2.6.27.x, yes?