Received: with ECARTIS (v1.0.0; list netdev); Thu, 04 Mar 2004 18:04:30 -0800 (PST) Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.131]) by oss.sgi.com (8.12.10/8.12.9) with SMTP id i2524KKO031811 for ; Thu, 4 Mar 2004 18:04:27 -0800 Received: from westrelay02.boulder.ibm.com (westrelay02.boulder.ibm.com [9.17.195.11]) by e33.co.us.ibm.com (8.12.10/8.12.2) with ESMTP id i25246fS599084; Thu, 4 Mar 2004 21:04:06 -0500 Received: from gateway.beaverton.ibm.com (d03av02.boulder.ibm.com [9.17.193.82]) by westrelay02.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id i25245LR168546; Thu, 4 Mar 2004 19:04:05 -0700 Received: from w-hlinder.beaverton.ibm.com (w-hlinder.beaverton.ibm.com [9.47.17.19]) by gateway.beaverton.ibm.com (8.11.6/8.11.6) with ESMTP id i2522tO25629; Thu, 4 Mar 2004 18:02:55 -0800 Date: Thu, 04 Mar 2004 18:05:14 -0800 From: Hanna Linder To: Chris Wright cc: Hanna Linder , linux-kernel@vger.kernel.org, greg@kroah.com, paulus@samba.org, netdev@oss.sgi.com Subject: Re: [PATCH 2.6] Patch to hook up PPP to simple class sysfs support Message-ID: <42870000.1078452314@w-hlinder.beaverton.ibm.com> In-Reply-To: <20040303195539.S22989@build.pdx.osdl.net> References: <200403032328.i23NSwlv009796@orion.dwf.com> <22370000.1078362205@w-hlinder.beaverton.ibm.com> <20040303195539.S22989@build.pdx.osdl.net> X-Mailer: Mulberry/2.2.1 (Linux/x86) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline X-archive-position: 3764 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: hannal@us.ibm.com Precedence: bulk X-list: netdev Content-Length: 2541 Lines: 100 Thanks Chris. Your changes fixed the reload oops I was seeing. root@w-hlinder2 root]# modprobe ppp_generic [root@w-hlinder2 root]# tree /sys/class/ppp /sys/class/ppp `-- ppp `-- dev 1 directory, 1 file [root@w-hlinder2 root]# rmmod ppp_generic [root@w-hlinder2 root]# tree /sys/class/ppp /sys/class/ppp [error opening dir] 0 directories, 0 files [root@w-hlinder2 root]# modprobe ppp_generic [root@w-hlinder2 root]# tree /sys/class/ppp /sys/class/ppp `-- ppp `-- dev 1 directory, 1 file Please consider the patch below for inclusion. Thanks. --On Wednesday, March 03, 2004 07:55:39 PM -0800 Chris Wright wrote: > > something like below. > > thanks, > -chris > > ===== drivers/net/ppp_generic.c 1.43 vs edited ===== > --- 1.43/drivers/net/ppp_generic.c Wed Feb 18 19:42:37 2004 > +++ edited/drivers/net/ppp_generic.c Wed Mar 3 19:08:24 2004 > @@ -45,6 +45,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -271,6 +272,8 @@ > 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) > { > @@ -804,15 +807,29 @@ > 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"); > + if (IS_ERR(ppp_class)) { > + err = PTR_ERR(ppp_class); > + goto out_chrdev; > + } > + 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) > - unregister_chrdev(PPP_MAJOR, "ppp"); > + goto out_class; > } > > +out: > if (err) > printk(KERN_ERR "failed to register PPP device (%d)\n", err); > return err; > + > +out_class: > + class_simple_device_remove(MKDEV(PPP_MAJOR,0)); > + class_simple_destroy(ppp_class); > +out_chrdev: > + unregister_chrdev(PPP_MAJOR, "ppp"); > + goto out; > } > > /* > @@ -2545,6 +2562,8 @@ > 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)); > + class_simple_destroy(ppp_class); > } > > /* >