Commit 91e7ecdc authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] dasd switched to alloc_disk()

parent 529ba807
...@@ -270,7 +270,7 @@ dasd_free_device(dasd_device_t *device) ...@@ -270,7 +270,7 @@ dasd_free_device(dasd_device_t *device)
kfree(device->private); kfree(device->private);
free_page((unsigned long) device->erp_mem); free_page((unsigned long) device->erp_mem);
free_pages((unsigned long) device->ccw_mem, 1); free_pages((unsigned long) device->ccw_mem, 1);
dasd_gendisk_free(device->gdp); put_disk(device->gdp);
kfree(device); kfree(device);
} }
......
...@@ -167,7 +167,6 @@ dasd_gendisk_alloc(char *device_name, int devindex) ...@@ -167,7 +167,6 @@ dasd_gendisk_alloc(char *device_name, int devindex)
struct list_head *l; struct list_head *l;
struct major_info *mi; struct major_info *mi;
struct gendisk *gdp; struct gendisk *gdp;
struct hd_struct *gd_part;
int index, len, rc; int index, len, rc;
/* Make sure the major for this device exists. */ /* Make sure the major for this device exists. */
...@@ -191,26 +190,15 @@ dasd_gendisk_alloc(char *device_name, int devindex) ...@@ -191,26 +190,15 @@ dasd_gendisk_alloc(char *device_name, int devindex)
} }
} }
/* Allocate genhd structure and gendisk arrays. */ gdp = alloc_disk();
gdp = kmalloc(sizeof(struct gendisk), GFP_KERNEL); if (!gdp)
gd_part = kmalloc(sizeof (struct hd_struct) << DASD_PARTN_BITS,
GFP_ATOMIC);
/* Check if one of the allocations failed. */
if (gdp == NULL || gd_part == NULL) {
/* We rely on kfree to do the != NULL check. */
kfree(gd_part);
kfree(gdp);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
/* Initialize gendisk structure. */ /* Initialize gendisk structure. */
memset(gdp, 0, sizeof(struct gendisk)); memcpy(gdp->disk_name, device_name, 16); /* huh? -- AV */
memcpy(gdp->disk_name, device_name, 16);
gdp->major = mi->major; gdp->major = mi->major;
gdp->first_minor = index << DASD_PARTN_BITS; gdp->first_minor = index << DASD_PARTN_BITS;
gdp->minor_shift = DASD_PARTN_BITS; gdp->minor_shift = DASD_PARTN_BITS;
gdp->part = gd_part;
gdp->fops = &dasd_device_operations; gdp->fops = &dasd_device_operations;
/* /*
...@@ -228,24 +216,9 @@ dasd_gendisk_alloc(char *device_name, int devindex) ...@@ -228,24 +216,9 @@ dasd_gendisk_alloc(char *device_name, int devindex)
'a' + (((devindex - 26) / 26) % 26)); 'a' + (((devindex - 26) / 26) % 26));
} }
len += sprintf(device_name + len, "%c", 'a' + (devindex % 26)); len += sprintf(device_name + len, "%c", 'a' + (devindex % 26));
/* Initialize the gendisk arrays. */
memset(gd_part, 0, sizeof (struct hd_struct) << DASD_PARTN_BITS);
return gdp; return gdp;
} }
/*
* Free gendisk structure for devindex.
*/
void
dasd_gendisk_free(struct gendisk *gdp)
{
/* Free memory. */
kfree(gdp->part);
kfree(gdp);
}
/* /*
* Return devindex of first device using a specific major number. * Return devindex of first device using a specific major number.
*/ */
......
...@@ -480,7 +480,6 @@ void dasd_gendisk_exit(void); ...@@ -480,7 +480,6 @@ void dasd_gendisk_exit(void);
int dasd_gendisk_major_index(int); int dasd_gendisk_major_index(int);
int dasd_gendisk_index_major(int); int dasd_gendisk_index_major(int);
struct gendisk *dasd_gendisk_alloc(char *, int); struct gendisk *dasd_gendisk_alloc(char *, int);
void dasd_gendisk_free(struct gendisk *);
void dasd_setup_partitions(dasd_device_t *); void dasd_setup_partitions(dasd_device_t *);
void dasd_destroy_partitions(dasd_device_t *); void dasd_destroy_partitions(dasd_device_t *);
......
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