summaryrefslogtreecommitdiff
path: root/drivers/parport/share.c
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2017-03-07 02:23:42 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-16 11:32:21 +0300
commit03270c6ac6207fc55bbf9d20d195029dca210c79 (patch)
tree896ff6b9950bd99d7d0af511b82b6887175f4cb3 /drivers/parport/share.c
parentabda288bb207e5c681306299126af8c022709c18 (diff)
downloadlinux-03270c6ac6207fc55bbf9d20d195029dca210c79.tar.xz
parport: fix attempt to write duplicate procfiles
Usually every parallel port will have a single pardev registered with it. But ppdev driver is an exception. This userspace parallel port driver allows to create multiple parrallel port devices for a single parallel port. And as a result we were having a nice warning like: "sysctl table check failed: /dev/parport/parport0/devices/ppdev0/timeslice Sysctl already exists" Use the same logic as used in parport_register_device() and register the proc files only once for each parallel port. Fixes: 6fa45a226897 ("parport: add device-model to parport subsystem") Cc: stable <stable@vger.kernel.org> # v4.4+ Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1414656 Bugzilla: https://bugs.archlinux.org/task/52322 Tested-by: James Feeney <james@nurealm.net> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/parport/share.c')
-rw-r--r--drivers/parport/share.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index bc090daa850a..5dc53d420ca8 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -939,8 +939,10 @@ parport_register_dev_model(struct parport *port, const char *name,
* pardevice fields. -arca
*/
port->ops->init_state(par_dev, par_dev->state);
- port->proc_device = par_dev;
- parport_device_proc_register(par_dev);
+ if (!test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) {
+ port->proc_device = par_dev;
+ parport_device_proc_register(par_dev);
+ }
return par_dev;