]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
parport: quickfix the proc registration bug
authorAlan Cox <alan@etchedpixels.co.uk>
Tue, 18 Aug 2009 14:27:34 +0000 (10:27 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 9 Sep 2009 03:17:46 +0000 (20:17 -0700)
commit 05ad709d04799125ed85dd816fdb558258102172 upstream

parport: quickfix the proc registration bug

Ideally we should have a directory of drivers and a link to the 'active'
driver. For now just show the first device which is effectively the existing
semantics without a warning.

This is an update on the original buggy patch that I then forgot to
resubmit. Confusingly it was proposed by Red Hat, written by Etched Pixels
fixed and submitted by Intel ...

Resolves-Bug: http://bugzilla.kernel.org/show_bug.cgi?id=9749
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/parport/share.c
include/linux/parport.h

index a8a62bbbb5769c61446386205c64266887793d5d..a592f29a5a4330262e941cee029226a0ca234fa8 100644 (file)
@@ -614,7 +614,10 @@ parport_register_device(struct parport *port, const char *name,
         * pardevice fields. -arca
         */
        port->ops->init_state(tmp, tmp->state);
-       parport_device_proc_register(tmp);
+       if (!test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) {
+               port->proc_device = tmp;
+               parport_device_proc_register(tmp);
+       }
        return tmp;
 
  out_free_all:
@@ -646,10 +649,14 @@ void parport_unregister_device(struct pardevice *dev)
        }
 #endif
 
-       parport_device_proc_unregister(dev);
-
        port = dev->port->physport;
 
+       if (port->proc_device == dev) {
+               port->proc_device = NULL;
+               clear_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags);
+               parport_device_proc_unregister(dev);
+       }
+
        if (port->cad == dev) {
                printk(KERN_DEBUG "%s: %s forgot to release port\n",
                       port->name, dev->name);
index 6a0d7cdb577465a84bf5ccf3ef8ff0b86edc4002..986252e5e76f08968f9875abb78c5d40d67d8a0c 100644 (file)
@@ -326,6 +326,10 @@ struct parport {
        int spintime;
        atomic_t ref_count;
 
+       unsigned long devflags;
+#define PARPORT_DEVPROC_REGISTERED     0
+       struct pardevice *proc_device;  /* Currently register proc device */
+
        struct list_head full_list;
        struct parport *slaves[3];
 };