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)
kfree(device->private);
free_page((unsigned long) device->erp_mem);
free_pages((unsigned long) device->ccw_mem, 1);
dasd_gendisk_free(device->gdp);
put_disk(device->gdp);
kfree(device);
}
......
......@@ -167,7 +167,6 @@ dasd_gendisk_alloc(char *device_name, int devindex)
struct list_head *l;
struct major_info *mi;
struct gendisk *gdp;
struct hd_struct *gd_part;
int index, len, rc;
/* Make sure the major for this device exists. */
......@@ -191,26 +190,15 @@ dasd_gendisk_alloc(char *device_name, int devindex)
}
}
/* Allocate genhd structure and gendisk arrays. */
gdp = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
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);
gdp = alloc_disk();
if (!gdp)
return ERR_PTR(-ENOMEM);
}
/* Initialize gendisk structure. */
memset(gdp, 0, sizeof(struct gendisk));
memcpy(gdp->disk_name, device_name, 16);
memcpy(gdp->disk_name, device_name, 16); /* huh? -- AV */
gdp->major = mi->major;
gdp->first_minor = index << DASD_PARTN_BITS;
gdp->minor_shift = DASD_PARTN_BITS;
gdp->part = gd_part;
gdp->fops = &dasd_device_operations;
/*
......@@ -228,24 +216,9 @@ dasd_gendisk_alloc(char *device_name, int devindex)
'a' + (((devindex - 26) / 26) % 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;
}
/*
* 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.
*/
......
......@@ -480,7 +480,6 @@ void dasd_gendisk_exit(void);
int dasd_gendisk_major_index(int);
int dasd_gendisk_index_major(int);
struct gendisk *dasd_gendisk_alloc(char *, int);
void dasd_gendisk_free(struct gendisk *);
void dasd_setup_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