All of lore.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 (2/7) - minor miscdev changes
Date: Fri, 18 Apr 2003 18:12:50 +0200	[thread overview]
Message-ID: <20030418181250.B363@lst.de> (raw)

Make sure the first argument to devfs_register is zero.


diff -Nru a/drivers/char/misc.c b/drivers/char/misc.c
--- a/drivers/char/misc.c	Fri Apr 18 15:56:44 2003
+++ b/drivers/char/misc.c	Fri Apr 18 15:56:44 2003
@@ -166,8 +166,8 @@
  
 int misc_register(struct miscdevice * misc)
 {
-	static devfs_handle_t devfs_handle, dir;
 	struct miscdevice *c;
+	char buf[256];
 	
 	if (misc->next || misc->prev)
 		return -EBUSY;
@@ -195,14 +195,16 @@
 	}
 	if (misc->minor < DYNAMIC_MINORS)
 		misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7);
-	if (!devfs_handle)
-		devfs_handle = devfs_mk_dir("misc");
-	dir = strchr (misc->name, '/') ? NULL : devfs_handle;
-	misc->devfs_handle =
-		devfs_register (dir, misc->name, DEVFS_FL_NONE,
-				MISC_MAJOR, misc->minor,
-				S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP,
-				misc->fops, NULL);
+
+
+	/* yuck, yet another stupid special-casing.  We should rather
+	   add ->devfs_name to avoid this mess. */
+	snprintf(buf, sizeof(buf), strchr(misc->name, '/') ?
+			"%s" : "misc/%s", misc->name);
+	misc->devfs_handle = devfs_register(NULL, buf, 0,
+			MISC_MAJOR, misc->minor,
+			S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP,
+			misc->fops, NULL);
 
 	/*
 	 * Add it to the front, so that later devices can "override"

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-18 16:12 Christoph Hellwig [this message]
2003-04-18 16:29 ` [PATCH] devfs (2/7) - minor miscdev changes Roland Dreier
2003-04-18 17:03   ` Christoph Hellwig

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=20030418181250.B363@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.