Commit c5f45a70 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (6/25) Removing bogus arrays - ->driverfs_dev_arr[]

	disk->driverfs_dev_arr is either NULL or consists of exactly one
element.  Same change as above (struct device ** -> struct device *); old
"is the pointer to array itself NULL or not?" replaced with a flag (in
disk->flags).
parent ab3bfaa2
...@@ -1301,7 +1301,6 @@ static int sd_attach(Scsi_Device * sdp) ...@@ -1301,7 +1301,6 @@ static int sd_attach(Scsi_Device * sdp)
struct { struct {
struct gendisk disk; struct gendisk disk;
devfs_handle_t de; devfs_handle_t de;
struct device *dev;
char name[5]; char name[5];
} *p; } *p;
struct gendisk *gd; struct gendisk *gd;
...@@ -1315,7 +1314,6 @@ static int sd_attach(Scsi_Device * sdp) ...@@ -1315,7 +1314,6 @@ static int sd_attach(Scsi_Device * sdp)
return 1; return 1;
gd = &p->disk; gd = &p->disk;
gd->de_arr = &p->de; gd->de_arr = &p->de;
gd->driverfs_dev_arr = &p->dev;
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));
...@@ -1348,7 +1346,6 @@ static int sd_attach(Scsi_Device * sdp) ...@@ -1348,7 +1346,6 @@ static int sd_attach(Scsi_Device * sdp)
sd_template.nr_dev++; sd_template.nr_dev++;
gd->de_arr[0] = sdp->de; gd->de_arr[0] = sdp->de;
gd->driverfs_dev_arr[0] = &sdp->sdev_driverfs_dev;
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;
...@@ -1360,6 +1357,8 @@ static int sd_attach(Scsi_Device * sdp) ...@@ -1360,6 +1357,8 @@ static int sd_attach(Scsi_Device * sdp)
sprintf(p->name, "sd%c", 'a'+dsk_nr%26); sprintf(p->name, "sd%c", 'a'+dsk_nr%26);
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->flags |= GENHD_FL_DRIVERFS;
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, "
......
...@@ -131,12 +131,12 @@ static void driverfs_create_partitions(struct gendisk *hd) ...@@ -131,12 +131,12 @@ static void driverfs_create_partitions(struct gendisk *hd)
struct device *dev, *parent; struct device *dev, *parent;
int part; int part;
/* get parent driverfs device structure */ /* if driverfs not supported by subsystem, skip partitions */
if (hd->driverfs_dev_arr) if (!(hd->flags & GENHD_FL_DRIVERFS))
parent = hd->driverfs_dev_arr[0];
else /* if driverfs not supported by subsystem, skip partitions */
return; return;
parent = hd->driverfs_dev;
if (parent) { if (parent) {
sprintf(name, "%s", parent->name); sprintf(name, "%s", parent->name);
sprintf(bus_id, "%s:", parent->bus_id); sprintf(bus_id, "%s:", parent->bus_id);
......
...@@ -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
struct gendisk { struct gendisk {
int major; /* major number of driver */ int major; /* major number of driver */
...@@ -80,7 +81,7 @@ struct gendisk { ...@@ -80,7 +81,7 @@ struct gendisk {
struct block_device_operations *fops; struct block_device_operations *fops;
devfs_handle_t *de_arr; /* one per physical disc */ devfs_handle_t *de_arr; /* one per physical disc */
struct device **driverfs_dev_arr;/* support driverfs hierarchy */ struct device *driverfs_dev;
int flags; int flags;
}; };
......
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