Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Alan Cox and committed by
Linus Torvalds
05ad709d d3ae33ef

+14 -3
+10 -3
drivers/parport/share.c
··· 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: ··· 649 646 } 650 647 #endif 651 648 652 - parport_device_proc_unregister(dev); 653 - 654 649 port = dev->port->physport; 650 + 651 + if (port->proc_device == dev) { 652 + port->proc_device = NULL; 653 + clear_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags); 654 + parport_device_proc_unregister(dev); 655 + } 655 656 656 657 if (port->cad == dev) { 657 658 printk(KERN_DEBUG "%s: %s forgot to release port\n",
+4
include/linux/parport.h
··· 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 };