linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [CM4000,CM4040] Add device class bits to enable udev device creation
       [not found] ` <1138541796.6395.8.camel@otto.ehbuehl.net>
@ 2006-01-31 10:10   ` Harald Welte
  2006-02-01  2:09     ` Andrew Morton
       [not found]     ` <200601312259.32863.dtor_core@ameritech.net>
  0 siblings, 2 replies; 6+ messages in thread
From: Harald Welte @ 2006-01-31 10:10 UTC (permalink / raw)
  To: Joachim Breitner; +Cc: Linux Kernel Mailinglist, akpm

[-- 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 --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] [CM4000,CM4040] Add device class bits to enable udev device creation
  2006-01-31 10:10   ` [PATCH] [CM4000,CM4040] Add device class bits to enable udev device creation Harald Welte
@ 2006-02-01  2:09     ` Andrew Morton
  2006-02-14  8:05       ` Harald Welte
       [not found]     ` <200601312259.32863.dtor_core@ameritech.net>
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2006-02-01  2:09 UTC (permalink / raw)
  To: Harald Welte; +Cc: mail, linux-kernel, Dominik Brodowski

Harald Welte <laforge@gnumonks.org> wrote:
>
> 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.

Dominik has made quite widespread changes to these drivers - enough that
I'm not confident to fix the rejects, make it compile and hope that it
still works.

So can you please sort things out with Dominik?  I guess a tested patch
against -mm4 would be ideal.

I note that these drivers forget to check for pcmcia_register_driver()
failure.  That's a fairly good way of getting an oops in rmmod.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [CM4000,CM4040] Add device class bits to enable udev device creation
       [not found]     ` <200601312259.32863.dtor_core@ameritech.net>
@ 2006-02-01  9:03       ` Harald Welte
  0 siblings, 0 replies; 6+ messages in thread
From: Harald Welte @ 2006-02-01  9:03 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Joachim Breitner, Linux Kernel Mailinglist, akpm

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

On Tue, Jan 31, 2006 at 10:59:32PM -0500, Dmitry Torokhov wrote:
> On Tuesday 31 January 2006 05:10, Harald Welte wrote:
> > @@ -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;
> > +
> > 
> 
> 
> Hi,
> 
> What is "cmx" exactly? Can we have more descriptive name for a class,
> please?

'cmx' is the prefix of the device names, how the original vendor drivers
named their devices.  'cmm' in the cm4000 case is 'card man mobile'.
'cmx' is its successor, cm4040.

I'll rename the classes, thanks for your suggestion.

-- 
- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [CM4000,CM4040] Add device class bits to enable udev device creation
  2006-02-01  2:09     ` Andrew Morton
@ 2006-02-14  8:05       ` Harald Welte
  2006-02-14  8:16         ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Harald Welte @ 2006-02-14  8:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mail, linux-kernel, Dominik Brodowski

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

On Tue, Jan 31, 2006 at 06:09:27PM -0800, Andrew Morton wrote:
> Harald Welte <laforge@gnumonks.org> wrote:
> >
> > 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.
> 
> Dominik has made quite widespread changes to these drivers - enough that
> I'm not confident to fix the rejects, make it compile and hope that it
> still works.

sorry for that.  I honestly don't have the time to track two trees, and
I do all my development work against Linus' main tree, therefore my
patches are against that tree, too.

> So can you please sort things out with Dominik?  I guess a tested patch
> against -mm4 would be ideal.

The question is: Why wouldn't my patch directly go mainline but rather
via -mm?  It is a very special-purpose device, the number of users are
small, it clearly fixes the bug that no device nodes are created, and
the fix came from the original maintainer.

> I note that these drivers forget to check for pcmcia_register_driver()
> failure.  That's a fairly good way of getting an oops in rmmod.

Thanks, I'll cook up a fix.

-- 
- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [CM4000,CM4040] Add device class bits to enable udev device creation
  2006-02-14  8:05       ` Harald Welte
@ 2006-02-14  8:16         ` Andrew Morton
  2006-02-14  8:30           ` Harald Welte
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2006-02-14  8:16 UTC (permalink / raw)
  To: Harald Welte; +Cc: mail, linux-kernel, linux

Harald Welte <laforge@gnumonks.org> wrote:
>
> On Tue, Jan 31, 2006 at 06:09:27PM -0800, Andrew Morton wrote:
> > Harald Welte <laforge@gnumonks.org> wrote:
> > >
> > > 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.
> > 
> > Dominik has made quite widespread changes to these drivers - enough that
> > I'm not confident to fix the rejects, make it compile and hope that it
> > still works.
> 
> sorry for that.  I honestly don't have the time to track two trees, and
> I do all my development work against Linus' main tree, therefore my
> patches are against that tree, too.

Dominik maintains the pcmcia development tree, and these are
pcmcia drivers...

> > So can you please sort things out with Dominik?  I guess a tested patch
> > against -mm4 would be ideal.
> 
> The question is: Why wouldn't my patch directly go mainline but rather
> via -mm?  It is a very special-purpose device, the number of users are
> small, it clearly fixes the bug that no device nodes are created, and
> the fix came from the original maintainer.

pcmcia patches should preferably go via the pcmcia development tree, and
get integrated and reviewed by the maintainer and all that good stuff.

So it wouldn't go via -mm at all - pcmcia only goes into -mm for testing.


The more specific point is that your patch conflicted with Dominik's
current development tree in a big way.   That needs to get sorted out.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] [CM4000,CM4040] Add device class bits to enable udev device creation
  2006-02-14  8:16         ` Andrew Morton
@ 2006-02-14  8:30           ` Harald Welte
  0 siblings, 0 replies; 6+ messages in thread
From: Harald Welte @ 2006-02-14  8:30 UTC (permalink / raw)
  To: Andrew Morton; +Cc: mail, linux-kernel, linux

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

Thanks for helping me out, Andrew.

> Dominik maintains the pcmcia development tree, and these are
> pcmcia drivers...

ok, thanks for clarification. I'll locate his tree and prepare patches
against that tree.

-- 
- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-02-14  8:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1138536696.6509.9.camel@otto.ehbuehl.net>
     [not found] ` <1138541796.6395.8.camel@otto.ehbuehl.net>
2006-01-31 10:10   ` [PATCH] [CM4000,CM4040] Add device class bits to enable udev device creation Harald Welte
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).