Commit 06f55b09 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (8/25) Removing bogus arrays - ->de_arr[]

	similar to ->flags and ->driverfs_dev_arr, ->de_arr[] got replaced
with its (single) element + flag.
parent db09b5fc
...@@ -75,7 +75,6 @@ MODULE_LICENSE("GPL"); ...@@ -75,7 +75,6 @@ MODULE_LICENSE("GPL");
static int nr_ctlr; static int nr_ctlr;
static ctlr_info_t *hba[MAX_CTLR]; static ctlr_info_t *hba[MAX_CTLR];
static devfs_handle_t de_arr[MAX_CTLR][NWD];
static int eisa[8]; static int eisa[8];
...@@ -451,7 +450,7 @@ int __init cpqarray_init(void) ...@@ -451,7 +450,7 @@ int __init cpqarray_init(void)
disk->first_minor = j<<NWD_SHIFT; disk->first_minor = j<<NWD_SHIFT;
disk->minor_shift = NWD_SHIFT; disk->minor_shift = NWD_SHIFT;
disk->part = ida + i*256 + (j<<NWD_SHIFT); disk->part = ida + i*256 + (j<<NWD_SHIFT);
disk->de_arr = &de_arr[i][j]; disk->flags = GENHD_FL_DEVFS;
disk->fops = &ida_fops; disk->fops = &ida_fops;
if (!drv->nr_blks) if (!drv->nr_blks)
continue; continue;
...@@ -1665,6 +1664,7 @@ static void getgeometry(int ctlr) ...@@ -1665,6 +1664,7 @@ static void getgeometry(int ctlr)
(log_index < id_ctlr_buf->nr_drvs) (log_index < id_ctlr_buf->nr_drvs)
&& (log_unit < NWD); && (log_unit < NWD);
log_unit++) { log_unit++) {
struct gendisk *disk = ida_gendisk + ctlr * NWD + log_unit;
size = sizeof(sense_log_drv_stat_t); size = sizeof(sense_log_drv_stat_t);
...@@ -1729,13 +1729,10 @@ static void getgeometry(int ctlr) ...@@ -1729,13 +1729,10 @@ static void getgeometry(int ctlr)
return; return;
} }
if (!de_arr[ctlr][log_unit]) { if (!disk->de) {
char txt[16]; char txt[16];
sprintf(txt,"ida/c%dd%d",ctlr,log_unit);
sprintf(txt, "ida/c%dd%d", ctlr, disk->de = devfs_mk_dir(NULL,txt,NULL);
log_unit);
de_arr[ctlr][log_unit] =
devfs_mk_dir(NULL, txt, NULL);
} }
info_p->phys_drives = info_p->phys_drives =
sense_config_buf->ctlr_phys_drv; sense_config_buf->ctlr_phys_drv;
......
...@@ -3148,8 +3148,8 @@ static int ide_cdrom_reinit (ide_drive_t *drive) ...@@ -3148,8 +3148,8 @@ static int ide_cdrom_reinit (ide_drive_t *drive)
cdrom_read_toc(drive, &sense); cdrom_read_toc(drive, &sense);
g->minor_shift = 0; g->minor_shift = 0;
/* probably bogus, but that's the old behaviour */ /* probably bogus, but that's the old behaviour */
g->de_arr[0] = NULL; g->de = NULL;
g->flags = 0; g->flags = GENHD_FL_DEVFS;
add_gendisk(g); add_gendisk(g);
register_disk(g, mk_kdev(g->major,g->first_minor), register_disk(g, mk_kdev(g->major,g->first_minor),
1<<g->minor_shift, ide_fops, 1<<g->minor_shift, ide_fops,
......
...@@ -1703,8 +1703,9 @@ static int idedisk_reinit(ide_drive_t *drive) ...@@ -1703,8 +1703,9 @@ static int idedisk_reinit(ide_drive_t *drive)
} }
DRIVER(drive)->busy--; DRIVER(drive)->busy--;
g->minor_shift = PARTN_BITS; g->minor_shift = PARTN_BITS;
g->de_arr[0] = drive->de; g->de = drive->de;
g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0; g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0;
g->flags |= GENHD_FL_DEVFS;
add_gendisk(g); add_gendisk(g);
register_disk(g, mk_kdev(g->major,g->first_minor), register_disk(g, mk_kdev(g->major,g->first_minor),
1<<g->minor_shift, ide_fops, 1<<g->minor_shift, ide_fops,
......
...@@ -2211,8 +2211,9 @@ static int idefloppy_reinit (ide_drive_t *drive) ...@@ -2211,8 +2211,9 @@ static int idefloppy_reinit (ide_drive_t *drive)
idefloppy_setup (drive, floppy); idefloppy_setup (drive, floppy);
DRIVER(drive)->busy--; DRIVER(drive)->busy--;
g->minor_shift = PARTN_BITS; g->minor_shift = PARTN_BITS;
g->de_arr[0] = drive->de; g->de = drive->de;
g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0; g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0;
g->flags |= GENHD_FL_DEVFS;
add_gendisk(g); add_gendisk(g);
register_disk(g, mk_kdev(g->major,g->first_minor), register_disk(g, mk_kdev(g->major,g->first_minor),
1<<g->minor_shift, ide_fops, 1<<g->minor_shift, ide_fops,
......
...@@ -808,7 +808,6 @@ static void init_gendisk (ide_hwif_t *hwif) ...@@ -808,7 +808,6 @@ static void init_gendisk (ide_hwif_t *hwif)
{ {
struct gendisk *gd; struct gendisk *gd;
struct hd_struct *part; struct hd_struct *part;
devfs_handle_t *de_arr;
unsigned int unit, units, minors; unsigned int unit, units, minors;
extern devfs_handle_t ide_devfs_handle; extern devfs_handle_t ide_devfs_handle;
char *names; char *names;
...@@ -835,11 +834,6 @@ static void init_gendisk (ide_hwif_t *hwif) ...@@ -835,11 +834,6 @@ static void init_gendisk (ide_hwif_t *hwif)
memset(part, 0, minors * sizeof(struct hd_struct)); memset(part, 0, minors * sizeof(struct hd_struct));
de_arr = kmalloc(sizeof(devfs_handle_t) * MAX_DRIVES, GFP_KERNEL);
if (!de_arr)
goto err_kmalloc_gd_de_arr;
memset(de_arr, 0, sizeof(devfs_handle_t) * MAX_DRIVES);
names = kmalloc (4 * MAX_DRIVES, GFP_KERNEL); names = kmalloc (4 * MAX_DRIVES, GFP_KERNEL);
if (!names) if (!names)
goto err_kmalloc_gd_names; goto err_kmalloc_gd_names;
...@@ -847,7 +841,6 @@ static void init_gendisk (ide_hwif_t *hwif) ...@@ -847,7 +841,6 @@ static void init_gendisk (ide_hwif_t *hwif)
for (unit = 0; unit < units; ++unit) { for (unit = 0; unit < units; ++unit) {
gd[unit].part = part + (unit << PARTN_BITS); gd[unit].part = part + (unit << PARTN_BITS);
gd[unit].de_arr = de_arr + unit;
hwif->drives[unit].part = gd[unit].part; hwif->drives[unit].part = gd[unit].part;
gd[unit].major = hwif->major; gd[unit].major = hwif->major;
gd[unit].first_minor = unit << PARTN_BITS; gd[unit].first_minor = unit << PARTN_BITS;
...@@ -884,8 +877,6 @@ static void init_gendisk (ide_hwif_t *hwif) ...@@ -884,8 +877,6 @@ static void init_gendisk (ide_hwif_t *hwif)
return; return;
err_kmalloc_gd_names: err_kmalloc_gd_names:
kfree(de_arr);
err_kmalloc_gd_de_arr:
kfree(part); kfree(part);
err_kmalloc_gd_part: err_kmalloc_gd_part:
kfree(gd); kfree(gd);
......
...@@ -2062,8 +2062,6 @@ void ide_unregister (unsigned int index) ...@@ -2062,8 +2062,6 @@ void ide_unregister (unsigned int index)
if (gd) { if (gd) {
int i; int i;
kfree(gd->part); kfree(gd->part);
if (gd->de_arr)
kfree (gd->de_arr);
kfree(gd); kfree(gd);
for (i = 0; i < MAX_DRIVES; i++) for (i = 0; i < MAX_DRIVES; i++)
hwif->gd[i] = NULL; hwif->gd[i] = NULL;
......
...@@ -302,7 +302,7 @@ dasd_state_new_to_known(dasd_device_t *device) ...@@ -302,7 +302,7 @@ dasd_state_new_to_known(dasd_device_t *device)
/* Add a proc directory and the dasd device entry to devfs. */ /* Add a proc directory and the dasd device entry to devfs. */
sprintf(buffer, "%04x", device->devinfo.devno); sprintf(buffer, "%04x", device->devinfo.devno);
dir = devfs_mk_dir(dasd_devfs_handle, buffer, device); dir = devfs_mk_dir(dasd_devfs_handle, buffer, device);
gdp->de_arr[0] = dir; gdp->de = dir;
if (devmap->features & DASD_FEATURE_READONLY) if (devmap->features & DASD_FEATURE_READONLY)
devfs_perm = S_IFBLK | S_IRUSR; devfs_perm = S_IFBLK | S_IRUSR;
else else
...@@ -328,7 +328,7 @@ dasd_state_known_to_new(dasd_device_t * device) ...@@ -328,7 +328,7 @@ dasd_state_known_to_new(dasd_device_t * device)
return; return;
/* Remove device entry and devfs directory. */ /* Remove device entry and devfs directory. */
devfs_unregister(device->devfs_entry); devfs_unregister(device->devfs_entry);
devfs_unregister(gdp->de_arr[0]); devfs_unregister(gdp->de);
/* Forget the discipline information. */ /* Forget the discipline information. */
device->discipline = NULL; device->discipline = NULL;
......
...@@ -34,7 +34,6 @@ struct major_info { ...@@ -34,7 +34,6 @@ struct major_info {
struct list_head list; struct list_head list;
int major; int major;
struct gendisk disks[DASD_PER_MAJOR]; struct gendisk disks[DASD_PER_MAJOR];
devfs_handle_t de_arr[DASD_PER_MAJOR];
char names[DASD_PER_MAJOR * 8]; char names[DASD_PER_MAJOR * 8];
struct hd_struct part[1<<MINORBITS]; struct hd_struct part[1<<MINORBITS];
}; };
...@@ -106,7 +105,7 @@ dasd_register_major(int major) ...@@ -106,7 +105,7 @@ dasd_register_major(int major)
disk->first_minor = i << DASD_PARTN_BITS; disk->first_minor = i << DASD_PARTN_BITS;
disk->minor_shift = DASD_PARTN_BITS; disk->minor_shift = DASD_PARTN_BITS;
disk->fops = &dasd_device_operations; disk->fops = &dasd_device_operations;
disk->de_arr = mi->de_arr + i; disk->flags = GENHD_FL_DEVFS;
disk->part = mi->part + (i << DASD_PARTN_BITS); disk->part = mi->part + (i << DASD_PARTN_BITS);
} }
......
...@@ -1300,7 +1300,6 @@ static int sd_attach(Scsi_Device * sdp) ...@@ -1300,7 +1300,6 @@ static int sd_attach(Scsi_Device * sdp)
unsigned long iflags; unsigned long iflags;
struct { struct {
struct gendisk disk; struct gendisk disk;
devfs_handle_t de;
char name[5]; char name[5];
} *p; } *p;
struct gendisk *gd; struct gendisk *gd;
...@@ -1313,7 +1312,6 @@ static int sd_attach(Scsi_Device * sdp) ...@@ -1313,7 +1312,6 @@ static int sd_attach(Scsi_Device * sdp)
if (!p) if (!p)
return 1; return 1;
gd = &p->disk; gd = &p->disk;
gd->de_arr = &p->de;
SCSI_LOG_HLQUEUE(3, printk("sd_attach: scsi device: <%d,%d,%d,%d>\n", SCSI_LOG_HLQUEUE(3, printk("sd_attach: scsi device: <%d,%d,%d,%d>\n",
sdp->host->host_no, sdp->channel, sdp->id, sdp->lun)); sdp->host->host_no, sdp->channel, sdp->id, sdp->lun));
...@@ -1345,7 +1343,7 @@ static int sd_attach(Scsi_Device * sdp) ...@@ -1345,7 +1343,7 @@ static int sd_attach(Scsi_Device * sdp)
} }
sd_template.nr_dev++; sd_template.nr_dev++;
gd->de_arr[0] = sdp->de; gd->de = sdp->de;
gd->major = SD_MAJOR(dsk_nr>>4); gd->major = SD_MAJOR(dsk_nr>>4);
gd->first_minor = (dsk_nr & 15)<<4; gd->first_minor = (dsk_nr & 15)<<4;
gd->minor_shift = 4; gd->minor_shift = 4;
...@@ -1358,7 +1356,7 @@ static int sd_attach(Scsi_Device * sdp) ...@@ -1358,7 +1356,7 @@ static int sd_attach(Scsi_Device * sdp)
gd->major_name = p->name; gd->major_name = p->name;
gd->flags = sdp->removable ? GENHD_FL_REMOVABLE : 0; gd->flags = sdp->removable ? GENHD_FL_REMOVABLE : 0;
gd->driverfs_dev = &sdp->sdev_driverfs_dev; gd->driverfs_dev = &sdp->sdev_driverfs_dev;
gd->flags |= GENHD_FL_DRIVERFS; gd->flags |= GENHD_FL_DRIVERFS | GENHD_FL_DEVFS;
sd_disks[dsk_nr] = gd; sd_disks[dsk_nr] = gd;
sd_dskname(dsk_nr, diskname); sd_dskname(dsk_nr, diskname);
printk(KERN_NOTICE "Attached scsi %sdisk %s at scsi%d, channel %d, " printk(KERN_NOTICE "Attached scsi %sdisk %s at scsi%d, channel %d, "
......
...@@ -203,8 +203,8 @@ void check_partition(struct gendisk *hd, struct block_device *bdev) ...@@ -203,8 +203,8 @@ void check_partition(struct gendisk *hd, struct block_device *bdev)
if (!state) if (!state)
return; return;
if (hd->de_arr) if (hd->flags & GENHD_FL_DEVFS)
de = hd->de_arr[0]; de = hd->de;
i = devfs_generate_path (de, buf, sizeof buf); i = devfs_generate_path (de, buf, sizeof buf);
if (i >= 0) { if (i >= 0) {
printk(KERN_INFO " /dev/%s:", buf + i); printk(KERN_INFO " /dev/%s:", buf + i);
...@@ -284,8 +284,8 @@ static void devfs_register_disc(struct gendisk *dev) ...@@ -284,8 +284,8 @@ static void devfs_register_disc(struct gendisk *dev)
return; return;
if (dev->flags & GENHD_FL_REMOVABLE) if (dev->flags & GENHD_FL_REMOVABLE)
devfs_flags |= DEVFS_FL_REMOVABLE; devfs_flags |= DEVFS_FL_REMOVABLE;
if (dev->de_arr) { if (dev->flags & GENHD_FL_DEVFS) {
dir = dev->de_arr[0]; dir = dev->de;
if (!dir) /* Aware driver wants to block disc management */ if (!dir) /* Aware driver wants to block disc management */
return; return;
pos = devfs_generate_path(dir, dirname + 3, sizeof dirname-3); pos = devfs_generate_path(dir, dirname + 3, sizeof dirname-3);
...@@ -308,7 +308,7 @@ static void devfs_register_disc(struct gendisk *dev) ...@@ -308,7 +308,7 @@ static void devfs_register_disc(struct gendisk *dev)
dev->major, dev->first_minor, dev->major, dev->first_minor,
S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL); S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL);
devfs_auto_unregister(p[0].de, slave); devfs_auto_unregister(p[0].de, slave);
if (!dev->de_arr) if (!(dev->flags & GENHD_FL_DEVFS))
devfs_auto_unregister (slave, dir); devfs_auto_unregister (slave, dir);
} }
#endif /* CONFIG_DEVFS_FS */ #endif /* CONFIG_DEVFS_FS */
......
...@@ -67,6 +67,7 @@ struct hd_struct { ...@@ -67,6 +67,7 @@ struct hd_struct {
#define GENHD_FL_REMOVABLE 1 #define GENHD_FL_REMOVABLE 1
#define GENHD_FL_DRIVERFS 2 #define GENHD_FL_DRIVERFS 2
#define GENHD_FL_DEVFS 4
struct gendisk { struct gendisk {
int major; /* major number of driver */ int major; /* major number of driver */
...@@ -79,7 +80,7 @@ struct gendisk { ...@@ -79,7 +80,7 @@ struct gendisk {
struct gendisk *next; struct gendisk *next;
struct block_device_operations *fops; struct block_device_operations *fops;
devfs_handle_t *de_arr; /* one per physical disc */ devfs_handle_t de;
struct device *driverfs_dev; struct device *driverfs_dev;
int flags; int flags;
int number; /* devfs crap */ int number; /* devfs crap */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment