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