From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Thu, 15 Jan 2004 20:41:38 +0000 Subject: [PATCH] add class support for lp devices [03/10] Message-Id: <20040115204138.GD22199@kroah.com> List-Id: References: <20040115204048.GA22199@kroah.com> <20040115204111.GB22199@kroah.com> <20040115204125.GC22199@kroah.com> In-Reply-To: <20040115204125.GC22199@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-hotplug-devel@lists.sourceforge.net Add class support for lp devices. Based on a patch from Hanna Linder diff -Nru a/drivers/char/lp.c b/drivers/char/lp.c --- a/drivers/char/lp.c Thu Jan 15 12:13:07 2004 +++ b/drivers/char/lp.c Thu Jan 15 12:13:07 2004 @@ -145,6 +145,7 @@ struct lp_struct lp_table[LP_NO]; static unsigned int lp_count = 0; +static struct class_simple *lp_class; #ifdef CONFIG_LP_CONSOLE static struct parport *console_registered; // initially NULL @@ -795,6 +796,8 @@ if (reset) lp_reset(nr); + class_simple_device_add(lp_class, MKDEV(LP_MAJOR, nr), NULL, + "lp%d", nr); devfs_mk_cdev(MKDEV(LP_MAJOR, nr), S_IFCHR | S_IRUGO | S_IWUGO, "printers/%d", nr); @@ -897,6 +900,7 @@ } devfs_mk_dir("printers"); + lp_class = class_simple_create(THIS_MODULE, "printer"); if (parport_register_driver (&lp_driver)) { printk (KERN_ERR "lp: unable to register with parport\n"); @@ -958,8 +962,10 @@ continue; parport_unregister_device(lp_table[offset].dev); devfs_remove("printers/%d", offset); + class_simple_device_remove(MKDEV(LP_MAJOR, offset)); } devfs_remove("printers"); + class_simple_destroy(lp_class); } __setup("lp=", lp_setup); ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel