Skip to contentSkip to conversation

Cleanup for sd in 2.4.19

PATCH Pete Zaitcev 2 participants 2 messages Aug 8, 2002 SCSI

lore
Share & tools
lore
#0 lore raw

A pure cleanup here. I know that something that works should not be fixed, but cheesh. There are limits to everything. I cannot wait until James destroys all this crap, it's just too painful to read.

-- Pete

drivers/scsi/sd.c +8 -14
@@ -119,7 +119,7 @@
 static int check_scsidisk_media_change(kdev_t);
 static int fop_revalidate_scsidisk(kdev_t);
 
-static int sd_init_onedisk(int);
+static void sd_init_onedisk(int);
 
 
 static int sd_init(void);
@@ -718,7 +718,6 @@
 {
 	int retval;
 	int target;
-	int flag = 0;
 	Scsi_Device * SDev;
 
 	target = DEVICE_NR(full_dev);
@@ -774,12 +773,11 @@
 	rscsi_disks[target].ready = 1;	/* FLOPTICAL */
 
 	retval = SDev->changed;
-	if (!flag)
-		SDev->changed = 0;
+	SDev->changed = 0;
 	return retval;
 }
 
-static int sd_init_onedisk(int i)
+static void sd_init_onedisk(int i)
 {
 	unsigned char cmd[10];
 	char nbuff[6];
@@ -799,7 +797,7 @@
 	 * of the other niceties.
 	 */
 	if (rscsi_disks[i].device->online == FALSE)
-		return i;
+		return;
 
 	/*
 	 * We need to retry the READ_CAPACITY because a UNIT_ATTENTION is
@@ -810,14 +808,14 @@
 	SRpnt = scsi_allocate_request(rscsi_disks[i].device);
 	if (!SRpnt) {
 		printk(KERN_WARNING "(sd_init_onedisk:) Request allocation failure.\n");
-		return i;
+		return;
 	}
 
 	buffer = (unsigned char *) scsi_malloc(512);
 	if (!buffer) {
 		printk(KERN_WARNING "(sd_init_onedisk:) Memory allocation failure.\n");
 		scsi_release_request(SRpnt);
-		return i;
+		return;
 	}
 
 	spintime = 0;
@@ -1095,7 +1093,7 @@
 	SRpnt = NULL;
 
 	scsi_free(buffer, 512);
-	return i;
+	return;
 }
 
 /*
@@ -1346,7 +1344,6 @@
 #define ALLOW_REVALIDATE rscsi_disks[target].device->allow_revalidate
 #define USAGE rscsi_disks[target].device->access_count
 #define CAPACITY rscsi_disks[target].capacity
-#define MAYBE_REINIT  sd_init_onedisk(target)
 
 /* This routine is called to flush all partitions and partition tables
  * for a changed scsi disk, and then re-read the new partition table.
@@ -1393,10 +1390,7 @@
 			sd_blocksizes[index] = 1024;
 	}
 
-#ifdef MAYBE_REINIT
-	MAYBE_REINIT;
-#endif
-
+	sd_init_onedisk(target);
 	grok_partitions(&SD_GENDISK(target), target % SCSI_DISKS_PER_MAJOR,
 			1<<4, CAPACITY);
 
#1 lore raw
Quoted 3 lines · [email protected] said:

A pure cleanup here. I know that something that works should not be fixed, but cheesh. There are limits to everything. I cannot wait until James destroys all this crap, it's just too painful to read.

I didn't sign up to clean out the Augean Stables on my own. I'm trying to rationalise the substance. Beautifying the structure when not part of a substantive change (however painful it may be to the eye) isn't high on my list of priorities. And 2.4 is nowhere; I'm working on 2.5 almost exclusively.

The patch looks fine to me: send it off to Marcelo---he's been wanting to get into SCSI coding anyway, so he might be interested in helping out on this type of work.

Oh, and if the same problem persists in 2.5, I'll take patches (or you can toss them over the wall at Doug Leadford).

James