Commit 05ad709d04799125ed85dd816fdb558258102172
Committed by
Linus Torvalds
1 parent
d3ae33efb8
Exists in
master
and in
7 other branches
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>
Showing 2 changed files with 14 additions and 3 deletions Side-by-side Diff
drivers/parport/share.c
... | ... | @@ -614,7 +614,10 @@ |
614 | 614 | * pardevice fields. -arca |
615 | 615 | */ |
616 | 616 | port->ops->init_state(tmp, tmp->state); |
617 | - parport_device_proc_register(tmp); | |
617 | + if (!test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) { | |
618 | + port->proc_device = tmp; | |
619 | + parport_device_proc_register(tmp); | |
620 | + } | |
618 | 621 | return tmp; |
619 | 622 | |
620 | 623 | out_free_all: |
621 | 624 | |
... | ... | @@ -646,9 +649,13 @@ |
646 | 649 | } |
647 | 650 | #endif |
648 | 651 | |
649 | - parport_device_proc_unregister(dev); | |
650 | - | |
651 | 652 | port = dev->port->physport; |
653 | + | |
654 | + if (port->proc_device == dev) { | |
655 | + port->proc_device = NULL; | |
656 | + clear_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags); | |
657 | + parport_device_proc_unregister(dev); | |
658 | + } | |
652 | 659 | |
653 | 660 | if (port->cad == dev) { |
654 | 661 | printk(KERN_DEBUG "%s: %s forgot to release port\n", |
include/linux/parport.h
... | ... | @@ -324,6 +324,10 @@ |
324 | 324 | int spintime; |
325 | 325 | atomic_t ref_count; |
326 | 326 | |
327 | + unsigned long devflags; | |
328 | +#define PARPORT_DEVPROC_REGISTERED 0 | |
329 | + struct pardevice *proc_device; /* Currently register proc device */ | |
330 | + | |
327 | 331 | struct list_head full_list; |
328 | 332 | struct parport *slaves[3]; |
329 | 333 | }; |