2.1.124ac2 sd module breakage

Matthew Kirkwood (weejock@ferret.lmh.ox.ac.uk)
Tue, 6 Oct 1998 21:17:18 +0100 (GMT)


Hi,

2.1.124ac2 broke (the compilation of) modular sd - the
attached patch seems to fix it, but it's only tested with
a single ZIP drive, so who knows...?

Matthew.

--- linux-2.1.124ac1/drivers/scsi/sd.c Mon Oct 5 21:47:14 1998
+++ linux-2.1.124ac2/drivers/scsi/sd.c Tue Oct 6 21:03:27 1998
@@ -65,7 +65,8 @@
#define SD_MINOR_NUMBER(i) ((i) & 255)
#define MKDEV_SD_PARTITION(i) MKDEV(SD_MAJOR_NUMBER(i), (i) & 255)
#define MKDEV_SD(index) MKDEV_SD_PARTITION((index) << 4)
-#define N_USED_SD_MAJORS ((sd_template.dev_max + SCSI_DISKS_PER_MAJOR - 1) / SCSI_DISKS_PER_MAJOR)
+#define N_USED_SCSI_DISKS (sd_template.dev_max + SCSI_DISKS_PER_MAJOR - 1)
+#define N_USED_SD_MAJORS (N_USED_SCSI_DISKS / SCSI_DISKS_PER_MAJOR)

#define MAX_RETRIES 5

@@ -1760,10 +1761,11 @@
struct gendisk * prev_sdgd;
struct gendisk * sdgd;

- int removed = 0;
+ int removed = 0, i;

scsi_unregister_module(MODULE_SCSI_DEV, &sd_template);
- unregister_blkdev(SCSI_DISK_MAJOR, "sd");
+ for (i=0; i <= sd_template.dev_max / SCSI_DISKS_PER_MAJOR; i++)
+ unregister_blkdev(SD_MAJOR(i),"sd");
sd_registered--;
if( rscsi_disks != NULL )
{
@@ -1780,7 +1782,7 @@

for (sdgd = gendisk_head; sdgd; sdgd = sdgd->next)
{
- if (sdgd->next >= sd_gendisks && sdgd->next <= LAST_SD_GENDISK)
+ if (sdgd->next >= sd_gendisks && sdgd->next <= LAST_SD_GENDISK.max_nr)
removed++, sdgd->next = sdgd->next->next;
else sdgd = sdgd->next;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/