All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-hotplug-devel@lists.sourceforge.net
Subject: [PATCH] add class support for lp devices [03/10]
Date: Thu, 15 Jan 2004 20:41:38 +0000	[thread overview]
Message-ID: <20040115204138.GD22199@kroah.com> (raw)
In-Reply-To: <20040115204125.GC22199@kroah.com>


Add class support for lp devices.

Based on a patch from Hanna Linder <hannal@us.ibm.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-hotplug-devel@lists.sourceforge.net
Subject: [PATCH] add class support for lp devices [03/10]
Date: Thu, 15 Jan 2004 12:41:38 -0800	[thread overview]
Message-ID: <20040115204138.GD22199@kroah.com> (raw)
In-Reply-To: <20040115204125.GC22199@kroah.com>


Add class support for lp devices.

Based on a patch from Hanna Linder <hannal@us.ibm.com>

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);

  reply	other threads:[~2004-01-15 20:41 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-15 20:40 [PATCH] sysfs class patch update [00/10] Greg KH
2004-01-15 20:40 ` Greg KH
2004-01-15 20:41 ` [PATCH] add class_simple support [01/10] Greg KH
2004-01-15 20:41   ` Greg KH
2004-01-15 20:41   ` [PATCH] add sysfs class support for input devices [02/10] Greg KH
2004-01-15 20:41     ` Greg KH
2004-01-15 20:41     ` Greg KH [this message]
2004-01-15 20:41       ` [PATCH] add class support for lp devices [03/10] Greg KH
2004-01-15 20:41       ` [PATCH] add sysfs class support for mem devices [04/10] Greg KH
2004-01-15 20:41         ` Greg KH
2004-01-15 20:42         ` [PATCH] add sysfs class support for misc devices [05/10] Greg KH
2004-01-15 20:42           ` Greg KH
2004-01-15 20:42           ` [PATCH] add sysfs class support for raw devices [06/10] Greg KH
2004-01-15 20:42             ` Greg KH
2004-01-15 20:42             ` [PATCH] add sysfs class support for OSS sound devices [07/10] Greg KH
2004-01-15 20:42               ` Greg KH
2004-01-15 20:43               ` [PATCH] add sysfs class support for ALSA sound devices [08/10] Greg KH
2004-01-15 20:43                 ` Greg KH
2004-01-15 20:43                 ` [PATCH] clean up sysfs class support for tty devices [09/10] Greg KH
2004-01-15 20:43                   ` Greg KH
2004-01-15 20:43                   ` [PATCH] add sysfs class support for vc devices [10/10] Greg KH
2004-01-15 20:43                     ` Greg KH
2004-01-16  4:13                     ` Andrew Morton
2004-01-16  4:13                       ` Andrew Morton
2004-01-16 19:04                       ` Martin Schlemmer
2004-01-16 19:17                         ` Andrew Morton
2004-01-16 19:17                           ` Andrew Morton
2004-01-16 19:52                           ` Martin Schlemmer
2004-01-16 22:15                 ` [PATCH] add sysfs class support for ALSA sound devices [08/10] Måns Rullgård
2004-01-17  0:10                   ` Greg KH
2004-01-17  0:10                     ` Greg KH
2004-01-17  0:50                     ` Måns Rullgård
2004-01-15 21:23               ` [PATCH] add sysfs class support for OSS sound devices [07/10] Prakash K. Cheemplavam
2004-01-15 21:23                 ` Prakash K. Cheemplavam
2004-01-15 21:32                 ` Greg KH
2004-01-15 21:32                   ` Greg KH
2004-01-15 22:01                   ` Prakash K. Cheemplavam
2004-01-20  1:58   ` [PATCH] add class_simple support [01/10] Rusty Russell
2004-01-20  1:58     ` Rusty Russell
2004-01-15 20:57 ` [PATCH] sysfs class patch update [00/10] Måns Rullgård
2004-01-15 22:56   ` Greg KH
2004-01-15 22:56     ` Greg KH

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=20040115204138.GD22199@kroah.com \
    --to=greg@kroah.com \
    --cc=akpm@osdl.org \
    --cc=linux-hotplug-devel@lists.sourceforge.net \
    --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 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.