Skip to content

Commit

Permalink
char: lp: properly count the lp devices
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
sudipm-mukherjee authored and gregkh committed Dec 19, 2018
1 parent dc34da4 commit e379c1a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/char/lp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit e379c1a

Please sign in to comment.