public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] devfs (3/7) - cleanup devfs use in ide
Date: Fri, 18 Apr 2003 18:12:54 +0200	[thread overview]
Message-ID: <20030418181254.C363@lst.de> (raw)

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.


diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c	Fri Apr 18 15:57:08 2003
+++ b/drivers/ide/ide-probe.c	Fri Apr 18 15:57:08 2003
@@ -1289,7 +1289,6 @@
 
 	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 @@
 		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,
diff -Nru a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
--- a/drivers/ide/ide-tape.c	Fri Apr 18 15:57:08 2003
+++ b/drivers/ide/ide-tape.c	Fri Apr 18 15:57:08 2003
@@ -866,8 +866,6 @@
  */
 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 @@
 	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 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 @@
 		;
 	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;
diff -Nru a/drivers/ide/ide.c b/drivers/ide/ide.c
--- a/drivers/ide/ide.c	Fri Apr 18 15:57:08 2003
+++ b/drivers/ide/ide.c	Fri Apr 18 15:57:08 2003
@@ -650,9 +650,9 @@
 	 */
 	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;
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	Fri Apr 18 15:57:08 2003
+++ b/include/linux/ide.h	Fri Apr 18 15:57:08 2003
@@ -699,7 +699,8 @@
 	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 *) */
 

                 reply	other threads:[~2003-04-18 16:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030418181254.C363@lst.de \
    --to=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox