On Wed, May 03, 2017 at 08:20:58AM -0700, Greg KH wrote: > On Wed, May 03, 2017 at 02:56:34PM +0000, Grant Edwards wrote: > > I've recently received a bug report on a tty driver that I maintain: > > Which one? It's an out-of-tree driver loosely based on rocket.c, but it's for Ethernet-attached serial ports. >> the problem is that when the driver is unloaded, the /dev/tty__ files >> remain. [...] >> In my module_cleanup function I do this: >> >> for each port: >> tty_unregister_device(driver, portnum); >> tty_port_destroy(&info->port) >> >> tty_unregister_driver(driver); >> put_tty_driver(driver); >> >> What is that that is supposed to trigger removal of the char device >> files? > Are you sure you aren't leaking a reference somewhere? That will > cause the sysfs files/directory from being removed properly. I've checked the reference counts for the driver and for the tty port objects. They're all 1 when module_cleanup is called. The ports have never been opened, and AFAICT there isn't any tty object instance: tty_port_tty_get(&port) always returns NULL. I've verified that device_destory() is being called with the correct class and devt values when the device is unregistered. -- Grant -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html