Skip to contentSkip to conversation

cciss: removes uneeded 'pos' and 'size' variables

PATCH In review Laura Garcia 2 participants 2 messages Jul 26, 2006 – Jul 27, 2006 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cciss: removes uneeded 'pos' and 'size' variables

drivers/block/cciss.c +4 -9
diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c
@@ -238,9 +238,8 @@
 static int cciss_proc_get_info(char *buffer, char **start, off_t offset,
 			       int length, int *eof, void *data)
 {
-	off_t pos = 0;
 	off_t len = 0;
-	int size, i, ctlr;
+	int i, ctlr;
 	ctlr_info_t *h = (ctlr_info_t *) data;
 	drive_info_struct *drv;
 	unsigned long flags;
@@ -259,7 +258,7 @@
 	h->busy_configuring = 1;
 	spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
 
-	size = sprintf(buffer, "%s: HP %s Controller\n"
+	len += sprintf(buffer, "%s: HP %s Controller\n"
 		       "Board ID: 0x%08lx\n"
 		       "Firmware Version: %c%c%c%c\n"
 		       "IRQ: %d\n"
@@ -277,9 +276,7 @@
 		       h->num_luns, h->Qdepth, h->commands_outstanding,
 		       h->maxQsinceinit, h->max_outstanding, h->maxSG);
 
-	pos += size;
-	len += size;
-	cciss_proc_tape_report(ctlr, buffer, &pos, &len);
+	cciss_proc_tape_report(ctlr, buffer, &len);
 	for (i = 0; i <= h->highest_lun; i++) {
 
 		drv = &h->drv[i];
@@ -293,12 +290,10 @@
 
 		if (drv->raid_level > 5)
 			drv->raid_level = RAID_UNKNOWN;
-		size = sprintf(buffer + len, "cciss/c%dd%d:"
+		len += sprintf(buffer + len, "cciss/c%dd%d:"
 			       "\t%4u.%02uGB\tRAID %s\n",
 			       ctlr, i, (int)vol_sz, (int)vol_sz_frac,
 			       raid_label[drv->raid_level]);
-		pos += size;
-		len += size;
 	}
 
 	*eof = 1;
drivers/block/cciss_scsi.c +4 -6
diff -Nru a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
@@ -1440,19 +1440,17 @@
 }
 
 static void
-cciss_proc_tape_report(int ctlr, unsigned char *buffer, off_t *pos, off_t *len)
+cciss_proc_tape_report(int ctlr, unsigned char *buffer, off_t *len)
 {
 	unsigned long flags;
-	int size;
 
-	*pos = *pos -1; *len = *len - 1; // cut off the last trailing newline
+	*len = *len - 1; // cut off the last trailing newline
 
 	CPQ_TAPE_LOCK(ctlr, flags);
-	size = sprintf(buffer + *len,
+	*len += sprintf(buffer + *len,
 		"Sequential access devices: %d\n\n",
 			ccissscsi[ctlr].ndevices);
 	CPQ_TAPE_UNLOCK(ctlr, flags);
-	*pos += size; *len += size;
 }
 
 /* Need at least one of these error handlers to keep ../scsi/hosts.c from
@@ -1534,6 +1532,6 @@
 #define cciss_scsi_setup(cntl_num)
 #define cciss_unregister_scsi(ctlr)
 #define cciss_register_scsi(ctlr)
-#define cciss_proc_tape_report(ctlr, buffer, pos, len)
+#define cciss_proc_tape_report(ctlr, buffer, len)
 
 #endif /* CONFIG_CISS_SCSI_TAPE */
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Laura Garcia [mailto:[email protected]]
Sent: Wednesday, July 26, 2006 12:34 PM
To: ISS StorageDev; Andrew Morton
Cc: [email protected]
Subject: [PATCH] cciss: removes uneeded 'pos' and 'size' variables

Quoted 91 lines

diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c

drivers/block/cciss.c +1 -2
@@ -238,9 +238,8 @@
  static int cciss_proc_get_info(char *buffer, char **start, 
 off_t offset,
  			       int length, int *eof, void *data)
  {
-	off_t pos = 0;
  	off_t len = 0;
-	int size, i, ctlr;
+	int i, ctlr;
  	ctlr_info_t *h = (ctlr_info_t *) data;
  	drive_info_struct *drv;

unsigned long flags;

drivers/block/cciss.c +3 -7
@@ -259,7 +258,7 @@
  	h->busy_configuring = 1;
  	spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags);
 
-	size = sprintf(buffer, "%s: HP %s Controller\n"
+	len += sprintf(buffer, "%s: HP %s Controller\n"
  		       "Board ID: 0x%08lx\n"
  		       "Firmware Version: %c%c%c%c\n"
  		       "IRQ: %d\n"
@@ -277,9 +276,7 @@
  		       h->num_luns, h->Qdepth, h->commands_outstanding,
  		       h->maxQsinceinit, h->max_outstanding, h->maxSG);
 
-	pos += size;
-	len += size;
-	cciss_proc_tape_report(ctlr, buffer, &pos, &len);
+	cciss_proc_tape_report(ctlr, buffer, &len);
  	for (i = 0; i <= h->highest_lun; i++) {
 
  		drv = &h->drv[i];
@@ -293,12 +290,10 @@
 
  		if (drv->raid_level > 5)
  			drv->raid_level = RAID_UNKNOWN;
-		size = sprintf(buffer + len, "cciss/c%dd%d:"
+		len += sprintf(buffer + len, "cciss/c%dd%d:"
  			       "\t%4u.%02uGB\tRAID %s\n",
  			       ctlr, i, (int)vol_sz, (int)vol_sz_frac,
  			       raid_label[drv->raid_level]);
-		pos += size;
-		len += size;
  	}
 
  	*eof = 1;

diff -Nru a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
--- a/drivers/block/cciss_scsi.c 2006-07-15
23:53:08.000000000 +0200
+++ b/drivers/block/cciss_scsi.c 2006-07-26
11:27:43.000000000 +0200

drivers/block/cciss.c +1 -3
@@ -1440,19 +1440,17 @@
  }
 
  static void
-cciss_proc_tape_report(int ctlr, unsigned char *buffer, 
 off_t *pos, off_t *len)
+cciss_proc_tape_report(int ctlr, unsigned char *buffer, off_t *len)
  {
  	unsigned long flags;
-	int size;
 
-	*pos = *pos -1; *len = *len - 1; // cut off the last 

trailing newline

drivers/block/cciss.c +2 -2
+	*len = *len - 1; // cut off the last trailing newline
 
  	CPQ_TAPE_LOCK(ctlr, flags);
-	size = sprintf(buffer + *len,
+	*len += sprintf(buffer + *len,
  		"Sequential access devices: %d\n\n",
  			ccissscsi[ctlr].ndevices);
  	CPQ_TAPE_UNLOCK(ctlr, flags);
-	*pos += size; *len += size;
  }
 
  /* Need at least one of these error handlers to keep 

../scsi/hosts.c from @@ -1534,6 +1532,6 @@
#define cciss_scsi_setup(cntl_num)
#define cciss_unregister_scsi(ctlr)
#define cciss_register_scsi(ctlr)

drivers/block/cciss.c +1 -1
-#define cciss_proc_tape_report(ctlr, buffer, pos, len)
+#define cciss_proc_tape_report(ctlr, buffer, len)
 
  #endif /* CONFIG_CISS_SCSI_TAPE */