Hi, I wonder whether more/all thinkpad_acpi_module_exit() calls should get reverted in thinkpad_acpi_module_init and cleanup should be done in the init function itself. Maybe things get clearer then (not sure...). Also the thinkpad module got loaded on a (non-lenovo :) ) server. It could be that something explicitly tried loading it, but it shouldn't. Possibly thinkpad-acpi gets loaded on a wider range of systems due to the dmi udev change? Hmm, if yes, we should notice that soon :). Thomas ------------------------ Only remove tpacpi driver attributes if they got created - There is no need to call thinkpad_acpi_module_exit if probe failed - If init fails at later point, attributes only must be removed if they got created If thinkpad module tries to get loaded on a non-thinkpad machine you see: WARNING: at lib/kref.c:33 kref_get() Call Trace: [<ffffffff802fa57d>] kref_get+0x2f/0x36 [<ffffffff802f97f7>] kobject_get+0x12/0x17 [<ffffffff8036dfd7>] get_driver+0x14/0x1a [<ffffffff8036dfee>] driver_remove_file+0x11/0x32 [<ffffffff8823b9be>] :thinkpad_acpi:thinkpad_acpi_module_exit+0xa8/0xfc [<ffffffff8824b8a0>] :thinkpad_acpi:thinkpad_acpi_module_init+0x74a/0x776 [<ffffffff8024f968>] __link_module+0x0/0x25 [<ffffffff80252269>] sys_init_module+0x162c/0x178f [<ffffffff8020bc2e>] system_call+0x7e/0x83 This is the fix for that. Signed-off-by: Thomas Renninger <trenn@xxxxxxx> Index: lenb/drivers/misc/thinkpad_acpi.c =================================================================== --- lenb.orig/drivers/misc/thinkpad_acpi.c +++ lenb/drivers/misc/thinkpad_acpi.c @@ -4632,10 +4632,8 @@ static int __init thinkpad_acpi_module_i get_thinkpad_model_data(&thinkpad_id); ret = probe_for_thinkpad(); - if (ret) { - thinkpad_acpi_module_exit(); + if (ret) return ret; - } /* Driver initialization */ @@ -4662,7 +4660,7 @@ static int __init thinkpad_acpi_module_i thinkpad_acpi_module_exit(); return ret; } - + tpacpi_attrs_created = 1; /* Device initialization */ tpacpi_pdev = platform_device_register_simple(IBM_DRVR_NAME, -1, @@ -4744,7 +4742,8 @@ static void thinkpad_acpi_module_exit(vo if (tpacpi_pdev) platform_device_unregister(tpacpi_pdev); - tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver); + if (tpacpi_attrs_created) + tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver); platform_driver_unregister(&tpacpi_pdriver); if (proc_dir) Index: lenb/drivers/misc/thinkpad_acpi.h =================================================================== --- lenb.orig/drivers/misc/thinkpad_acpi.h +++ lenb/drivers/misc/thinkpad_acpi.h @@ -176,6 +176,7 @@ static struct platform_driver tpacpi_pdr static struct input_dev *tpacpi_inputdev; static int tpacpi_create_driver_attributes(struct device_driver *drv); static void tpacpi_remove_driver_attributes(struct device_driver *drv); +static int tpacpi_attrs_created; /* Module */ static int experimental; ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ ibm-acpi-devel mailing list ibm-acpi-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel