]> git.hungrycats.org Git - linux/commitdiff
[PATCH] devfs: cleanup devfs use in ide
authorChristoph Hellwig <hch@lst.de>
Fri, 18 Apr 2003 02:19:31 +0000 (19:19 -0700)
committerJeff Garzik <jgarzik@redhat.com>
Fri, 18 Apr 2003 02:19:31 +0000 (19:19 -0700)
Store the path of it's devfs directory in ide_drive_t.  Use
it in the devfs_register calls instead of the devfs_handle_t
which will go away soon.

drivers/ide/ide-probe.c
drivers/ide/ide-tape.c
drivers/ide/ide.c
include/linux/ide.h

index b41f13ab39704b55e0690706a388b2e330add09c..bcc21bc863fa0faed6c134ba60a1d0fed3071391 100644 (file)
@@ -1289,7 +1289,6 @@ static void init_gendisk (ide_hwif_t *hwif)
 
        for (unit = 0; unit < MAX_DRIVES; ++unit) {
                ide_drive_t * drive = &hwif->drives[unit];
-               char name[64];
                ide_add_generic_settings(drive);
                snprintf(drive->gendev.bus_id,BUS_ID_SIZE,"%u.%u",
                         hwif->index,unit);
@@ -1298,13 +1297,13 @@ static void init_gendisk (ide_hwif_t *hwif)
                drive->gendev.parent = &hwif->gendev;
                drive->gendev.bus = &ide_bus_type;
                drive->gendev.driver_data = drive;
-               sprintf (name, "ide/host%d/bus%d/target%d/lun%d",
-                       (hwif->channel && hwif->mate) ?
-                       hwif->mate->index : hwif->index,
-                       hwif->channel, unit, drive->lun);
                if (drive->present) {
                        device_register(&drive->gendev);
-                       drive->de = devfs_mk_dir(name);
+                       sprintf(drive->devfs_name, "ide/host%d/bus%d/target%d/lun%d",
+                               (hwif->channel && hwif->mate) ?
+                               hwif->mate->index : hwif->index,
+                               hwif->channel, unit, drive->lun);
+                       drive->de = devfs_mk_dir(drive->devfs_name);
                }
        }
        blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
index 916537599979a5b029373b9daff94a63bdbc47ea..6c43fd2afffdc94b6ef36b786e4ed7e3c8c3e915 100644 (file)
@@ -866,8 +866,6 @@ typedef struct {
  */
 typedef struct {
        ide_drive_t *drive;
-       devfs_handle_t de_r, de_n;
-
        /*
         *      Since a typical character device operation requires more
         *      than one packet command, we provide here enough memory
@@ -6170,8 +6168,8 @@ static int idetape_cleanup (ide_drive_t *drive)
        DRIVER(drive)->busy = 0;
        (void) ide_unregister_subdriver(drive);
        drive->driver_data = NULL;
-       devfs_unregister(tape->de_r);
-       devfs_unregister(tape->de_n);
+       devfs_remove("%s/mt");
+       devfs_remove("%s/mtn");
        devfs_unregister_tape(drive->disk->number);
        kfree (tape);
        drive->disk->fops = ide_fops;
@@ -6272,6 +6270,7 @@ static struct block_device_operations idetape_block_ops = {
 static int idetape_attach (ide_drive_t *drive)
 {
        idetape_tape_t *tape;
+       char devfs_name[64];
        int minor;
 
        if (!strstr("ide-tape", drive->driver_req))
@@ -6306,16 +6305,19 @@ static int idetape_attach (ide_drive_t *drive)
                ;
        idetape_setup(drive, tape, minor);
        idetape_chrdevs[minor].drive = drive;
-       tape->de_r =
-           devfs_register (drive->de, "mt", DEVFS_FL_DEFAULT,
-                           HWIF(drive)->major, minor,
-                           S_IFCHR | S_IRUGO | S_IWUGO,
-                           &idetape_fops, NULL);
-       tape->de_n =
-           devfs_register (drive->de, "mtn", DEVFS_FL_DEFAULT,
-                           HWIF(drive)->major, minor + 128,
-                           S_IFCHR | S_IRUGO | S_IWUGO,
-                           &idetape_fops, NULL);
+
+       sprintf(devfs_name, "%s/mt", drive->devfs_name);
+       tape->de_r = devfs_register (NULL, devfs_name, 0,
+                       HWIF(drive)->major, minor,
+                       S_IFCHR | S_IRUGO | S_IWUGO,
+                       &idetape_fops, NULL);
+
+       sprintf(devfs_name, "%s/mtn", drive->devfs_name);
+       tape->de_n = devfs_register (NULL, devfs_name, 0,
+                       HWIF(drive)->major, minor + 128,
+                       S_IFCHR | S_IRUGO | S_IWUGO,
+                       &idetape_fops, NULL);
+
        drive->disk->number = devfs_register_tape(drive->de);
        drive->disk->fops = &idetape_block_ops;
        return 0;
index 8dd1f279b6c8ceb18b43284bf307e7148ddd50ce..474876725c5952fdd140728ad78a9c4ec9f8aca2 100644 (file)
@@ -650,9 +650,9 @@ void ide_unregister (unsigned int index)
         */
        for (i = 0; i < MAX_DRIVES; ++i) {
                drive = &hwif->drives[i];
-               if (drive->de) {
-                       devfs_unregister(drive->de);
-                       drive->de = NULL;
+               if (drive->devfs_name[0] != '\0') {
+                       devfs_remove(drive->devfs_name);
+                       drive->devfs_name[0] = '\0';
                }
                if (!drive->present)
                        continue;
index 813c375009373478e65039823b1354c450926f0a..0a36483ba0858dd54b1c1dd0bbf8a9e863c9c13c 100644 (file)
@@ -699,7 +699,8 @@ typedef struct ide_drive_s {
        struct hd_driveid       *id;    /* drive model identification info */
        struct proc_dir_entry *proc;    /* /proc/ide/ directory entry */
        struct ide_settings_s *settings;/* /proc/ide/ drive settings */
-       devfs_handle_t          de;     /* directory for device */
+       char            devfs_name[64]; /* devfs crap */
+       devfs_handle_t          de;     /* will go away soon */
 
        struct hwif_s           *hwif;  /* actually (ide_hwif_t *) */