On Wed, 2005-01-19 at 10:24 -0800, Stephen Hemminger wrote: > The first question about sysfs related patches is always, does the following > work: > > (sleep 120; cat /sys/some/device/file) & > rmmod thedevicemodule > > You need to make sure that all kobjects are correctly reference counted and > that the free is done by the kernel subsystem not the device. I can't try your test right now (I happend to disable module unloading) but isn't this +static void atm_release(struct class_device *cdev) +{ + struct atm_dev *adev = class_get_devdata(cdev); + + kfree(adev); +} + +static struct class atm_class = { + .name = "atm", + .release = atm_release, +#ifdef CONFIG_HOTPLUG + .hotplug = atm_hotplug, +#endif +}; and this +static void release_atm_dev(struct atm_dev *dev) +{ + /* will free via class release */ + class_device_put(&dev->class_dev); +} + ... @@ -129,6 +146,8 @@ void atm_dev_deregister(struct atm_dev * { unsigned long warning_time; + atm_unregister_sysfs(dev); + atm_proc_dev_deregister(dev); spin_lock(&atm_dev_lock); @@ -147,7 +166,7 @@ void atm_dev_deregister(struct atm_dev * } } - __free_atm_dev(dev); + release_atm_dev(dev); } not sufficient? Besides, it seems to behave with the similar test but with unplugging the modem instead of rmmoding the driver. Roman. - : send the line "unsubscribe linux-net" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html