From: viro@parcelfarce.linux.theplanet.co.uk Moved allocation and setup (but not adding) of gendisk into pd_probe_drive(). --- 25-akpm/drivers/block/paride/pd.c | 36 ++++++++++++++++++------------------ 1 files changed, 18 insertions(+), 18 deletions(-) diff -puN drivers/block/paride/pd.c~PI20-gendisk_setup-RC1 drivers/block/paride/pd.c --- 25/drivers/block/paride/pd.c~PI20-gendisk_setup-RC1 Wed Jan 14 13:46:22 2004 +++ 25-akpm/drivers/block/paride/pd.c Wed Jan 14 13:46:22 2004 @@ -866,13 +866,26 @@ static struct block_device_operations pd static int pd_probe_drive(struct pd_unit *disk) { + struct gendisk *p = alloc_disk(1 << PD_BITS); + if (!p) + return 0; + strcpy(p->disk_name, disk->name); + p->fops = &pd_fops; + p->major = major; + p->first_minor = (disk - pd) << PD_BITS; + disk->gd = p; + p->private_data = disk; + p->queue = pd_queue; + if (disk->drive == -1) { for (disk->drive = 0; disk->drive <= 1; disk->drive++) if (pd_identify(disk)) return 1; - return 0; - } - return pd_identify(disk); + } else if (pd_identify(disk)) + return 1; + disk->gd = NULL; + put_disk(p); + return 0; } static int pd_detect(void) @@ -910,21 +923,8 @@ static int pd_detect(void) } for (unit = 0, disk = pd; unit < PD_UNITS; unit++, disk++) { if (disk->present) { - struct gendisk *p = alloc_disk(1 << PD_BITS); - if (!p) { - disk->present = 0; - k--; - continue; - } - strcpy(p->disk_name, disk->name); - p->fops = &pd_fops; - p->major = major; - p->first_minor = unit << PD_BITS; - set_capacity(p, disk->capacity); - disk->gd = p; - p->private_data = disk; - p->queue = pd_queue; - add_disk(p); + set_capacity(disk->gd, disk->capacity); + add_disk(disk->gd); } } if (k) _