@@ -900,34 +900,40 @@ static int lp_register(int nr, struct parport *port)
return 0;
}
-static void lp_attach (struct parport *port)
+static int lp_attach(struct parport *port)
{
unsigned int i;
+ int ret = -ENODEV;
switch (parport_nr[0]) {
case LP_PARPORT_UNSPEC:
case LP_PARPORT_AUTO:
if (parport_nr[0] == LP_PARPORT_AUTO &&
port->probe_info[0].class != PARPORT_CLASS_PRINTER)
- return;
+ return ret;
if (lp_count == LP_NO) {
printk(KERN_INFO "lp: ignoring parallel port (max. %d)\n",LP_NO);
- return;
+ return ret;
}
- if (!lp_register(lp_count, port))
+ if (!lp_register(lp_count, port)) {
lp_count++;
+ ret = 0;
+ }
break;
default:
for (i = 0; i < LP_NO; i++) {
if (port->number == parport_nr[i]) {
- if (!lp_register(i, port))
+ if (!lp_register(i, port)) {
lp_count++;
+ ret = 0;
+ }
break;
}
}
break;
}
+ return ret;
}
static void lp_detach (struct parport *port)
now that we are monitoring the return value from attach, make the required changes to return proper value from its attach function. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> --- drivers/char/lp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)