Re: [PATCH] lp: implement proper detach function for parport_driverlp

From: Greg Kroah-Hartman
Date: Mon Jun 03 2013 - 17:08:21 EST

On Sat, Jun 01, 2013 at 10:02:21PM +0200, Hannes Weisbach wrote:
> From: Hannes Weisbach <hannes_weisbach@xxxxxxx>
> The lp pardevice driver does not have a proper detach function. Consequently, parport_unregister_device() is not called when the underlying parport driver calls parport_remove_port(). As a result, the ref count of the parport driver's module does not go to zero and the driver module cannot be unloaded.
> The attached patch unregisters all lp pardevices which are on the to-be-detached parport.

Please wrap your changelog comments at 72 columns or so.

> Signed-off-by: Hannes Weisbach <hannes_weisbach@xxxxxxx>
> ---
> Granted, for normal parport drivers this is usually not an issue,
> because the device does not go away. However, I am currently writing a
> Linux device driver for a USB to parallel port converter [0] and
> therefore need proper detaching. Additionally, the wrong ref count
> keeps me from simply rmmod my driver and insmod a new version while
> developing and testing.

Really? We already have a usb to parallel port driver in the kernel
tree that seems to work just fine. It's been there since the 2.3 kernel
days, so either it has the same problem, or your driver is doing
something odd.

Can you test the in-kernel driver and let me know if it has the same


greg k-h
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at