[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181207142734.27370-4-sudipm.mukherjee@gmail.com>
Date: Fri, 7 Dec 2018 14:27:33 +0000
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>
Cc: linux-kernel@...r.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH 4/5] char: lp: properly count the lp devices
When the parallel port is usb based and the lp attaches to it based on
LP_PARPORT_AUTO, we do get /dev/lp0 and when we remove the usb device
/dev/lp0 is unregistered. If we now reconnect the usb device we get
our /dev/lp0 back. But if we now disconnect and reconnect eight times
we donot get any lp device and dmesg shows:
lp: ignoring parallel port (max. 8)
Decrement the lp_count when the device detaches as this represents the
number of lp devices connected to the system.
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@...il.com>
---
drivers/char/lp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index 0e081f521f51..cef2ea386f5e 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -993,6 +993,7 @@ static void lp_detach(struct parport *port)
for (n = 0; n < LP_NO; n++) {
if (port_num[n] == port->number) {
port_num[n] = -1;
+ lp_count--;
device_destroy(lp_class, MKDEV(LP_MAJOR, n));
parport_unregister_device(lp_table[n].dev);
}
--
2.11.0
Powered by blists - more mailing lists