public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver Core update for 2.6.4
Date: Mon, 15 Mar 2004 15:59:07 -0800	[thread overview]
Message-ID: <10793951472400@kroah.com> (raw)
In-Reply-To: <10793951472319@kroah.com>

ChangeSet 1.1608.84.7, 2004/03/10 17:34:33-08:00, ogasawara@osdl.org

[PATCH] Add sysfs simple class support for netlink

Patch adds sysfs simple class support for netlink character device
(Major 36).  Feedback appreciated.  Thanks,


 net/netlink/netlink_dev.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)


diff -Nru a/net/netlink/netlink_dev.c b/net/netlink/netlink_dev.c
--- a/net/netlink/netlink_dev.c	Mon Mar 15 15:29:27 2004
+++ b/net/netlink/netlink_dev.c	Mon Mar 15 15:29:27 2004
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/devfs_fs_kernel.h>
 #include <linux/smp_lock.h>
+#include <linux/device.h>
 
 #include <asm/bitops.h>
 #include <asm/system.h>
@@ -34,6 +35,7 @@
 
 static long open_map;
 static struct socket *netlink_user[MAX_LINKS];
+static struct class_simple *netlink_class;
 
 /*
  *	Device operations
@@ -229,17 +231,26 @@
 		return -EIO;
 	}
 
+	netlink_class = class_simple_create(THIS_MODULE, "netlink");
+	if (IS_ERR(netlink_class)) {
+		printk (KERN_ERR "Error creating netlink class.\n");
+		unregister_chrdev(NETLINK_MAJOR, "netlink");
+		return PTR_ERR(netlink_class);
+	}
+
 	devfs_mk_dir("netlink");
 
 	/*  Someone tell me the official names for the uppercase ones  */
 	for (i = 0; i < ARRAY_SIZE(entries); i++) {
 		devfs_mk_cdev(MKDEV(NETLINK_MAJOR, entries[i].minor),
 			S_IFCHR|S_IRUSR|S_IWUSR, "netlink/%s", entries[i].name);
+		class_simple_device_add(netlink_class, MKDEV(NETLINK_MAJOR, entries[i].minor), NULL, "%s", entries[i].name);
 	}
 
 	for (i = 0; i < 16; i++) {
 		devfs_mk_cdev(MKDEV(NETLINK_MAJOR, i + 16),
 			S_IFCHR|S_IRUSR|S_IWUSR, "netlink/tap%d", i);
+		class_simple_device_add(netlink_class, MKDEV(NETLINK_MAJOR, i + 16), NULL, "tap%d", i);
 	}
 
 	return 0;
@@ -249,11 +260,16 @@
 {
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(entries); i++)
+	for (i = 0; i < ARRAY_SIZE(entries); i++) {
 		devfs_remove("netlink/%s", entries[i].name);
-	for (i = 0; i < 16; i++)
+		class_simple_device_remove(MKDEV(NETLINK_MAJOR, entries[i].minor));
+	}
+	for (i = 0; i < 16; i++) {
 		devfs_remove("netlink/tap%d", i);
+		class_simple_device_remove(MKDEV(NETLINK_MAJOR, i + 16));
+	}
 	devfs_remove("netlink");
+	class_simple_destroy(netlink_class);
 	unregister_chrdev(NETLINK_MAJOR, "netlink");
 }
 


  reply	other threads:[~2004-03-16  1:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-15 23:55 [BK PATCH] Driver Core update for 2.6.4 Greg KH
2004-03-15 23:59 ` [PATCH] " Greg KH
2004-03-15 23:59   ` Greg KH
2004-03-15 23:59     ` Greg KH
2004-03-15 23:59       ` Greg KH
2004-03-15 23:59         ` Greg KH
2004-03-15 23:59           ` Greg KH
2004-03-15 23:59             ` Greg KH [this message]
2004-03-15 23:59               ` Greg KH
2004-03-15 23:59                 ` Greg KH
2004-03-15 23:59                   ` Greg KH
2004-03-15 23:59                     ` Greg KH
2004-03-15 23:59                       ` Greg KH
2004-03-15 23:59                         ` Greg KH
2004-03-15 23:59                           ` Greg KH
2004-03-15 23:59                             ` Greg KH
2004-03-15 23:59                               ` Greg KH
2004-03-16  7:04                                 ` Christoph Hellwig
2004-03-16  9:51                                   ` Andrew Morton
     [not found] <1AajM-5vw-21@gated-at.bofh.it>
     [not found] ` <1Abpq-6Av-1@gated-at.bofh.it>
     [not found]   ` <1Aj3K-5Fn-9@gated-at.bofh.it>
     [not found]     ` <1AjwZ-65D-15@gated-at.bofh.it>
2004-03-16 16:14       ` Andi Kleen
2004-03-16 19:40         ` Greg KH
2004-03-17  0:01           ` Andi Kleen
2004-03-19  9:17         ` Jamie Lokier
2004-03-19 11:52           ` Giuseppe Bilotta

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=10793951472400@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /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