mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harald Welte <laforge@gnumonks.org>
To: Joachim Breitner <mail@joachim-breitner.de>
Cc: Linux Kernel Mailinglist <linux-kernel@vger.kernel.org>, akpm@osdl.org
Subject: [PATCH] [CM4000,CM4040] Add device class bits to enable udev device creation
Date: Tue, 31 Jan 2006 11:10:46 +0100	[thread overview]
Message-ID: <20060131101046.GS4603@sunbeam.de.gnumonks.org> (raw)
In-Reply-To: <1138541796.6395.8.camel@otto.ehbuehl.net>

[-- Attachment #1: Type: text/plain, Size: 4781 bytes --]

Hi!

Please apply this fix to the cm4000/4040 drivers, thanks!

[CM4000,CM4040] Add device class bits to enable udev device creation

Using this patch, Omnikey CardMan 4000 and 4040 devices automatically
get their device nodes created by udev.

Signed-off-by: Harald Welte <laforge@gnumonks.org>

---
commit 904a871a628c42031c3093c2b90bde526f0f35f0
tree fd05d26498ff86bf857331f270b7db13f4e077c0
parent 5b130c9da429fe28af1e59ce6589890f326cc182
author Harald Welte <laforge@gnumonks.org> Tue, 31 Jan 2006 11:08:33 +0100
committer Harald Welte <laforge@gnumonks.org> Tue, 31 Jan 2006 11:08:33 +0100

 drivers/char/pcmcia/cm4000_cs.c |   14 +++++++++++++-
 drivers/char/pcmcia/cm4040_cs.c |   13 ++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 649677b..d5cc5f3 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -56,7 +56,7 @@ module_param(pc_debug, int, 0600);
 #else
 #define DEBUGP(n, rdr, x, args...)
 #endif
-static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte";
+static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
 
 #define	T_1SEC		(HZ)
 #define	T_10MSEC	msecs_to_jiffies(10)
@@ -156,6 +156,7 @@ struct cm4000_dev {
 		/*queue*/ 4*sizeof(wait_queue_head_t))
 
 static dev_link_t *dev_table[CM4000_MAX_DEV];
+static struct class *cmm_class;
 
 /* This table doesn't use spaces after the comma between fields and thus
  * violates CodingStyle.  However, I don't really think wrapping it around will
@@ -1937,6 +1938,9 @@ static int cm4000_attach(struct pcmcia_d
 	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
 	cm4000_config(link, i);
 
+	class_device_create(cmm_class, NULL, MKDEV(major, i), NULL,
+			    "cmm%d", i);
+
 	return 0;
 }
 
@@ -1962,6 +1966,8 @@ static void cm4000_detach(struct pcmcia_
 	dev_table[devno] = NULL;
  	kfree(dev);
 
+	class_device_destroy(cmm_class, MKDEV(major, devno));
+
 	return;
 }
 
@@ -1996,6 +2002,11 @@ static struct pcmcia_driver cm4000_drive
 static int __init cmm_init(void)
 {
 	printk(KERN_INFO "%s\n", version);
+
+	cmm_class = class_create(THIS_MODULE, "cmm");
+	if (!cmm_class)
+		return -1;
+
 	pcmcia_register_driver(&cm4000_driver);
 	major = register_chrdev(0, DEVICE_NAME, &cm4000_fops);
 	if (major < 0) {
@@ -2012,6 +2023,7 @@ static void __exit cmm_exit(void)
 	printk(KERN_INFO MODULE_NAME ": unloading\n");
 	pcmcia_unregister_driver(&cm4000_driver);
 	unregister_chrdev(major, DEVICE_NAME);
+	class_destroy(cmm_class);
 };
 
 module_init(cmm_init);
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 46eb371..e907a7c 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -53,7 +53,7 @@ module_param(pc_debug, int, 0600);
 #endif
 
 static char *version =
-"OMNIKEY CardMan 4040 v1.1.0gm4 - All bugs added by Harald Welte";
+"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte";
 
 #define	CCID_DRIVER_BULK_DEFAULT_TIMEOUT  	(150*HZ)
 #define	CCID_DRIVER_ASYNC_POWERUP_TIMEOUT 	(35*HZ)
@@ -67,6 +67,7 @@ static char *version =
 static void reader_release(dev_link_t *link);
 
 static int major;
+static struct class *cmx_class;
 
 #define		BS_READABLE	0x01
 #define		BS_WRITABLE	0x02
@@ -696,6 +697,9 @@ static int reader_attach(struct pcmcia_d
 	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
 	reader_config(link, i);
 
+	class_device_create(cmx_class, NULL, MKDEV(major, i), NULL,
+			    "cmx%d", i);
+
 	return 0;
 }
 
@@ -721,6 +725,8 @@ static void reader_detach(struct pcmcia_
 	dev_table[devno] = NULL;
 	kfree(dev);
 
+	class_device_destroy(cmx_class, MKDEV(major, devno));
+
 	return;
 }
 
@@ -756,6 +762,10 @@ static struct pcmcia_driver reader_drive
 static int __init cm4040_init(void)
 {
 	printk(KERN_INFO "%s\n", version);
+	cmx_class = class_create(THIS_MODULE, "cmx");
+	if (!cmx_class)
+		return -1;
+
 	pcmcia_register_driver(&reader_driver);
 	major = register_chrdev(0, DEVICE_NAME, &reader_fops);
 	if (major < 0) {
@@ -771,6 +781,7 @@ static void __exit cm4040_exit(void)
 	printk(KERN_INFO MODULE_NAME ": unloading\n");
 	pcmcia_unregister_driver(&reader_driver);
 	unregister_chrdev(major, DEVICE_NAME);
+	class_destroy(cmx_class);
 }
 
 module_init(cm4040_init);
-- 
- Harald Welte <laforge@gnumonks.org>          	        http://gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

       reply	other threads:[~2006-01-31 10:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1138536696.6509.9.camel@otto.ehbuehl.net>
     [not found] ` <1138541796.6395.8.camel@otto.ehbuehl.net>
2006-01-31 10:10   ` Harald Welte [this message]
2006-02-01  2:09     ` Andrew Morton
2006-02-14  8:05       ` Harald Welte
2006-02-14  8:16         ` Andrew Morton
2006-02-14  8:30           ` Harald Welte
     [not found]     ` <200601312259.32863.dtor_core@ameritech.net>
2006-02-01  9:03       ` Harald Welte

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=20060131101046.GS4603@sunbeam.de.gnumonks.org \
    --to=laforge@gnumonks.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@joachim-breitner.de \
    /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

all inboxes | Powered by JetHome®