* [PATCH] parport: quickfix the proc registration bug
@ 2009-06-02 15:58 Alan Cox
2009-06-03 21:20 ` Frans Pop
0 siblings, 1 reply; 2+ messages in thread
From: Alan Cox @ 2009-06-02 15:58 UTC (permalink / raw)
To: linux-kernel, torvalds
From: Alan Cox <alan@etchedpixels.co.uk>
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>
---
drivers/parport/share.c | 13 ++++++++++---
include/linux/parport.h | 4 ++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 0ebca45..dffa5d4 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -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);
diff --git a/include/linux/parport.h b/include/linux/parport.h
index e1f83c5..38a423e 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -324,6 +324,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];
};
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] parport: quickfix the proc registration bug
2009-06-02 15:58 [PATCH] parport: quickfix the proc registration bug Alan Cox
@ 2009-06-03 21:20 ` Frans Pop
0 siblings, 0 replies; 2+ messages in thread
From: Frans Pop @ 2009-06-03 21:20 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-kernel
Alan Cox wrote:
> 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>
Thanks Alan. Unfortunately I'm no longer able to test this as my printer
is now connected via USB to my notebook's docking station instead of via
a parport to my desktop (which was prompted to home server and moved to a
different room).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-06-03 21:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-02 15:58 [PATCH] parport: quickfix the proc registration bug Alan Cox
2009-06-03 21:20 ` Frans Pop
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®