char: lp: use first unused lp number while registering
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Fri, 7 Dec 2018 14:27:32 +0000 (14:27 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Dec 2018 09:40:17 +0000 (10:40 +0100)
commitdc34da42860d8ce01f64ac11752eecccf53c1a6c
treeae637d8c0a26d8dcac07db45d602c4125bb03203
parentd6318c0e8318c200aa95b50769d3635907381c08
char: lp: use first unused lp number while registering

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. But if we now reconnect the usb device we get
/dev/lp1, another disconnection and reconnection and we get /dev/lp2.

Use the port number array to find the first unused lp number and use
that to register the lp device with the parallel port.

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/lp.c