diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-12-18 01:19:42 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-24 00:44:46 -0500 |
commit | 1fdd407f4e3f2ecb453954cbebb6c22491c61853 (patch) | |
tree | fc0508260e2e26a7ee8f728da2c57aa9b9f75703 | |
parent | 3e9b988e4edf065d39c1343937f717319b1c1065 (diff) |
dell-wmi: do not keep driver loaded on unsupported boxes
There is no point in having the driver loaded in memory if we fail
to locate particular WMI GUID.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/platform/x86/dell-wmi.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index 6561dfc028e5..916ccb2b316c 100644 --- a/drivers/platform/x86/dell-wmi.c +++ b/drivers/platform/x86/dell-wmi.c | |||
@@ -325,37 +325,34 @@ static int __init dell_wmi_init(void) | |||
325 | int err; | 325 | int err; |
326 | 326 | ||
327 | if (wmi_has_guid(DELL_EVENT_GUID)) { | 327 | if (wmi_has_guid(DELL_EVENT_GUID)) { |
328 | printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n"); | ||
329 | return -ENODEV; | ||
330 | } | ||
328 | 331 | ||
329 | dmi_walk(find_hk_type, NULL); | 332 | dmi_walk(find_hk_type, NULL); |
330 | 333 | acpi_video = acpi_video_backlight_support(); | |
331 | err = dell_wmi_input_setup(); | ||
332 | |||
333 | if (err) | ||
334 | return err; | ||
335 | |||
336 | err = wmi_install_notify_handler(DELL_EVENT_GUID, | ||
337 | dell_wmi_notify, NULL); | ||
338 | if (err) { | ||
339 | input_unregister_device(dell_wmi_input_dev); | ||
340 | printk(KERN_ERR "dell-wmi: Unable to register" | ||
341 | " notify handler - %d\n", err); | ||
342 | return err; | ||
343 | } | ||
344 | 334 | ||
345 | acpi_video = acpi_video_backlight_support(); | 335 | err = dell_wmi_input_setup(); |
336 | if (err) | ||
337 | return err; | ||
346 | 338 | ||
347 | } else | 339 | err = wmi_install_notify_handler(DELL_EVENT_GUID, |
348 | printk(KERN_WARNING "dell-wmi: No known WMI GUID found\n"); | 340 | dell_wmi_notify, NULL); |
341 | if (err) { | ||
342 | input_unregister_device(dell_wmi_input_dev); | ||
343 | printk(KERN_ERR | ||
344 | "dell-wmi: Unable to register notify handler - %d\n", | ||
345 | err); | ||
346 | return err; | ||
347 | } | ||
349 | 348 | ||
350 | return 0; | 349 | return 0; |
351 | } | 350 | } |
352 | 351 | ||
353 | static void __exit dell_wmi_exit(void) | 352 | static void __exit dell_wmi_exit(void) |
354 | { | 353 | { |
355 | if (wmi_has_guid(DELL_EVENT_GUID)) { | 354 | wmi_remove_notify_handler(DELL_EVENT_GUID); |
356 | wmi_remove_notify_handler(DELL_EVENT_GUID); | 355 | input_unregister_device(dell_wmi_input_dev); |
357 | input_unregister_device(dell_wmi_input_dev); | ||
358 | } | ||
359 | } | 356 | } |
360 | 357 | ||
361 | module_init(dell_wmi_init); | 358 | module_init(dell_wmi_init); |