]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] dasd switched to alloc_disk()
authorAlexander Viro <viro@math.psu.edu>
Sat, 5 Oct 2002 11:22:18 +0000 (04:22 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sat, 5 Oct 2002 11:22:18 +0000 (04:22 -0700)
drivers/s390/block/dasd.c
drivers/s390/block/dasd_genhd.c
drivers/s390/block/dasd_int.h

index fb5ce0ffb9a0b9cd5ead4dc27689c3a581d190fe..49644ff1cf82b4fc558ed82153f5b044752a874d 100644 (file)
@@ -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);
 }
 
index 9f326e1309c6fc9232ed0250d0cc7cd101500d9c..1410812c551231559d79490083a584a227e8e93d 100644 (file)
@@ -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.
  */
index 836b8d5f3da0f405292606caeda2d8e23c4d5e29..daf720d6b0377548b2ccb2ac57559aae02a5692e 100644 (file)
@@ -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 *);