Messages in this thread Patch in this message | | | Date | Wed, 03 Mar 2004 17:03:26 -0800 | From | Hanna Linder <> | Subject | [PATCH 2.6] Patch to hook up PPP to simple class sysfs support |
| |
Here is a small patch to add PPP support to /sys/class.
Please consider for inclusion.
Thanks.
Hanna ----
diff -Nrup -Xdontdiff linux-2.6.3/drivers/net/ppp_generic.c linux-2.6.3p/drivers/net/ppp_generic.c --- linux-2.6.3/drivers/net/ppp_generic.c 2004-02-17 19:59:31.000000000 -0800 +++ linux-2.6.3p/drivers/net/ppp_generic.c 2004-03-03 15:14:07.000000000 -0800 @@ -45,6 +45,7 @@ #include <linux/smp_lock.h> #include <linux/rwsem.h> #include <linux/stddef.h> +#include <linux/device.h> #include <net/slhc_vj.h> #include <asm/atomic.h>
@@ -271,6 +272,8 @@ static int ppp_connect_channel(struct ch static int ppp_disconnect_channel(struct channel *pch); static void ppp_destroy_channel(struct channel *pch);
+static struct class_simple *ppp_class; + /* Translates a PPP protocol number to a NP index (NP == network protocol) */ static inline int proto_to_npindex(int proto) { @@ -799,10 +802,14 @@ static int __init ppp_init(void) printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n"); err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops); if (!err) { + ppp_class = class_simple_create(THIS_MODULE, "ppp"); + class_simple_device_add(ppp_class, MKDEV(PPP_MAJOR, 0), NULL, "ppp"); err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "ppp"); - if (err) + if (err) { unregister_chrdev(PPP_MAJOR, "ppp"); + class_simple_device_remove(MKDEV(PPP_MAJOR,0)); + } }
if (err) @@ -2540,6 +2547,7 @@ static void __exit ppp_cleanup(void) if (unregister_chrdev(PPP_MAJOR, "ppp") != 0) printk(KERN_ERR "PPP: failed to unregister PPP device\n"); devfs_remove("ppp"); + class_simple_device_remove(MKDEV(PPP_MAJOR, 0)); }
/* - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |