Skip to contentSkip to conversation

cciss: fix regression in procfs display fw version, obsoletes previous patch 2 of 2

PATCH In review Mike Miller 3 participants 6 messages Oct 16, 2008

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

PATCH 2/2 cciss: fix regression in procfs display fw version, obsoletes previous patch 2 of 2

Patch 2 of 2

This patch obsoletes patch 2/2 from yesterday. It fixes a regression in procfs where the controller firmware version is not displayed. The previous patch also addressed the problem but the code would be called whenever anything changed on the array such as the number of logical volumes, etc. This patch only gets called once for each controller.
Please consider this for inclusion.

drivers/block/cciss.c +21 -1
index 0f367b1..efa5414 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 10 lines · On Thu, 16 Oct 2008 16:50:16 -0500 Mike Miller <[email protected]> wrote:

Patch 2 of 2

This patch obsoletes patch 2/2 from yesterday. It fixes a regression in procfs where the controller firmware version is not displayed. The previous patch also addressed the problem but the code would be called whenever anything changed on the array such as the number of logical volumes, etc. This patch only gets called once for each controller.
Please consider this for inclusion.

Again, this description doesn't contain enough information for us to work out which kernels need patching.

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

Quoted 12 lines
drivers/block/cciss.c +2 -1
index 0f367b1..efa5414 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;

This initialisation is not needed.

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

Quoted 10 lines
drivers/block/cciss.c +4 -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);
+        if (inq_buff == NULL) {
+                printk(KERN_ERR "cciss: out of memory\n");

Whitespace is all screwed up.

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

Quoted 1 line
drivers/block/cciss.c +1 -0
+                return ENOMEM;

Should be -ENOMEM.

Quoted 17 lines
drivers/block/cciss.c +14 -0
+        }
+
+	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;
#2 lore raw
Quoted 77 lines

-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Thursday, October 16, 2008 4:57 PM
To: Miller, Mike (OS Dev)
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2] cciss: fix regression in procfs display fw version, obsoletes previous patch 2 of 2

Quoted 4 lines · On Thu, 16 Oct 2008 16:50:16 -0500 Mike Miller <[email protected]> wrote:

Patch 2 of 2

This patch obsoletes patch 2/2 from yesterday. It fixes a

regression

Quoted 1 line

in procfs where the controller firmware version is not

displayed. The

Quoted 1 line

previous patch also addressed the problem but the code

would be called

Quoted 1 line

whenever anything changed on the array such as the number

of logical volumes, etc.

Quoted 3 lines

This patch only gets called once for each controller. Please consider this for inclusion.

Again, this description doesn't contain enough information for us to work out which kernels need patching.

drivers/block/cciss.c static int __devinit

Quoted 6 lines
drivers/block/cciss.c index renamed from drivers/block/cciss.c +0 -0

0f367b1..efa5414 100644

drivers/block/cciss.c +0 -0
@@ -3404,7 +3404,8 @@ static int __devinit

cciss_init_one(struct pci_dev *pdev,

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
      int i;
      int j = 0;
      int rc;
-     int dac;
+     int dac, return_code;
+     InquiryData_struct *inq_buff = NULL;

This initialisation is not needed.

drivers/block/cciss.c static int __devinit

Quoted 3 lines
drivers/block/cciss.c +0 -0
      i = alloc_cciss_hba();
      if (i < 0)
@@ -3510,6 +3511,25 @@ static int __devinit

cciss_init_one(struct pci_dev *pdev,

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

Quoted 7 lines
drivers/block/cciss.c +4 -0
      /* 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");

Whitespace is all screwed up.

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

Quoted 1 line
drivers/block/cciss.c +1 -0
+                return ENOMEM;

Should be -ENOMEM.

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

Quoted 11 lines
drivers/block/cciss.c +11 -0
+        }
+
+     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
Quoted 7 lines

determine firmware"

Quoted 6 lines
drivers/block/cciss.c +3 -0
+                     " version of controller\n");
+     }
+
      cciss_procinit(i);
 
      hba[i]->cciss_max_sectors = 2048;

Sorry, in too much of a hurry. I'll fix (again).

mikem

Quoted 1 line
#3 lore raw
Quoted 78 lines · Mike (OS Dev)
Quoted 78 lines

-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Thursday, October 16, 2008 4:57 PM
To: Miller, Mike (OS Dev)
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2] cciss: fix regression in procfs display fw version, obsoletes previous patch 2 of 2

Quoted 4 lines · On Thu, 16 Oct 2008 16:50:16 -0500 Mike Miller <[email protected]> wrote:

Patch 2 of 2

This patch obsoletes patch 2/2 from yesterday. It fixes a

regression

Quoted 1 line

in procfs where the controller firmware version is not

displayed. The

Quoted 1 line

previous patch also addressed the problem but the code

would be called

Quoted 1 line

whenever anything changed on the array such as the number

of logical volumes, etc.

Quoted 3 lines

This patch only gets called once for each controller. Please consider this for inclusion.

Again, this description doesn't contain enough information for us to work out which kernels need patching.

drivers/block/cciss.c static int __devinit

Quoted 6 lines
drivers/block/cciss.c index renamed from drivers/block/cciss.c +0 -0

0f367b1..efa5414 100644

drivers/block/cciss.c +0 -0
@@ -3404,7 +3404,8 @@ static int __devinit

cciss_init_one(struct pci_dev *pdev,

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
      int i;
      int j = 0;
      int rc;
-     int dac;
+     int dac, return_code;
+     InquiryData_struct *inq_buff = NULL;

This initialisation is not needed.

drivers/block/cciss.c static int __devinit

Quoted 3 lines
drivers/block/cciss.c +0 -0
      i = alloc_cciss_hba();
      if (i < 0)
@@ -3510,6 +3511,25 @@ static int __devinit

cciss_init_one(struct pci_dev *pdev,

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

Quoted 7 lines
drivers/block/cciss.c +4 -0
      /* 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");

Whitespace is all screwed up.

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

Quoted 1 line
drivers/block/cciss.c +1 -0
+                return ENOMEM;

Should be -ENOMEM.

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

Quoted 11 lines
drivers/block/cciss.c +11 -0
+        }
+
+     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"

Quoted 8 lines
Quoted 6 lines

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

Quoted 6 lines
drivers/block/cciss.c +3 -0
+                     " version of controller\n");
+     }
+
      cciss_procinit(i);
 
      hba[i]->cciss_max_sectors = 2048;

Sorry, in too much of a hurry. I'll fix (again).

And inq_buff is leaked, if I'm not missing simething.

#4 lore raw
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

+ return_code = sendcmd_withirq(CISS_INQUIRY, i, inq_buff,

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

Quoted 8 lines
drivers/block/cciss.c +8 -0
+             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"

Quoted 5 lines
drivers/block/cciss.c +3 -0
+                     " version of controller\n");
+     }
+
      cciss_procinit(i);
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
      hba[i]->cciss_max_sectors = 2048;

Sorry, in too much of a hurry. I'll fix (again).

And inq_buff is leaked, if I'm not missing simething.

Sorry, Alexy, I can't see the leak. Is it in the failure case?

#5 lore raw
Quoted 15 lines · Mike (OS Dev)
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

+ return_code = sendcmd_withirq(CISS_INQUIRY, i, inq_buff,

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

Quoted 8 lines
drivers/block/cciss.c +8 -0
+             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"

Quoted 5 lines
drivers/block/cciss.c +3 -0
+                     " version of controller\n");
+     }
+
      cciss_procinit(i);
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
      hba[i]->cciss_max_sectors = 2048;

Sorry, in too much of a hurry. I'll fix (again).

And inq_buff is leaked, if I'm not missing simething.

Sorry, Alexy, I can't see the leak. Is it in the failure case?

Where "inq_buff" is freed?