diff options
author | Anssi Hannula <anssi.hannula@iki.fi> | 2011-02-20 13:07:23 -0500 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-03-28 06:07:18 -0400 |
commit | eceb7bdf644b418175aab1c998137e692ac98a4c (patch) | |
tree | 5fd2c9cda3215d3efb3ff236be063bd5f6a0ab40 | |
parent | c3021ea1beeeb1aa8a92fa6946a6e25fc55f171d (diff) |
hp-wmi: split rfkill initialization out of hp_wmi_bios_setup
Split initialization of rfkill devices from hp_wmi_bios_setup() to
hp_wmi_rfkill_setup(). This makes the code somewhat cleaner, especially
with the future command 0x1b rfkill support.
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r-- | drivers/platform/x86/hp-wmi.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 5c8ae65950d4..f6a1c37af9cc 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -532,7 +532,7 @@ static void cleanup_sysfs(struct platform_device *device) | |||
532 | device_remove_file(&device->dev, &dev_attr_tablet); | 532 | device_remove_file(&device->dev, &dev_attr_tablet); |
533 | } | 533 | } |
534 | 534 | ||
535 | static int __devinit hp_wmi_bios_setup(struct platform_device *device) | 535 | static int __devinit hp_wmi_rfkill_setup(struct platform_device *device) |
536 | { | 536 | { |
537 | int err; | 537 | int err; |
538 | int wireless = 0; | 538 | int wireless = 0; |
@@ -542,22 +542,6 @@ static int __devinit hp_wmi_bios_setup(struct platform_device *device) | |||
542 | if (err) | 542 | if (err) |
543 | return err; | 543 | return err; |
544 | 544 | ||
545 | err = device_create_file(&device->dev, &dev_attr_display); | ||
546 | if (err) | ||
547 | goto add_sysfs_error; | ||
548 | err = device_create_file(&device->dev, &dev_attr_hddtemp); | ||
549 | if (err) | ||
550 | goto add_sysfs_error; | ||
551 | err = device_create_file(&device->dev, &dev_attr_als); | ||
552 | if (err) | ||
553 | goto add_sysfs_error; | ||
554 | err = device_create_file(&device->dev, &dev_attr_dock); | ||
555 | if (err) | ||
556 | goto add_sysfs_error; | ||
557 | err = device_create_file(&device->dev, &dev_attr_tablet); | ||
558 | if (err) | ||
559 | goto add_sysfs_error; | ||
560 | |||
561 | if (wireless & 0x1) { | 545 | if (wireless & 0x1) { |
562 | wifi_rfkill = rfkill_alloc("hp-wifi", &device->dev, | 546 | wifi_rfkill = rfkill_alloc("hp-wifi", &device->dev, |
563 | RFKILL_TYPE_WLAN, | 547 | RFKILL_TYPE_WLAN, |
@@ -611,6 +595,34 @@ register_bluetooth_error: | |||
611 | rfkill_unregister(wifi_rfkill); | 595 | rfkill_unregister(wifi_rfkill); |
612 | register_wifi_error: | 596 | register_wifi_error: |
613 | rfkill_destroy(wifi_rfkill); | 597 | rfkill_destroy(wifi_rfkill); |
598 | return err; | ||
599 | } | ||
600 | |||
601 | static int __devinit hp_wmi_bios_setup(struct platform_device *device) | ||
602 | { | ||
603 | int err; | ||
604 | |||
605 | err = hp_wmi_rfkill_setup(device); | ||
606 | if (err) | ||
607 | return err; | ||
608 | |||
609 | err = device_create_file(&device->dev, &dev_attr_display); | ||
610 | if (err) | ||
611 | goto add_sysfs_error; | ||
612 | err = device_create_file(&device->dev, &dev_attr_hddtemp); | ||
613 | if (err) | ||
614 | goto add_sysfs_error; | ||
615 | err = device_create_file(&device->dev, &dev_attr_als); | ||
616 | if (err) | ||
617 | goto add_sysfs_error; | ||
618 | err = device_create_file(&device->dev, &dev_attr_dock); | ||
619 | if (err) | ||
620 | goto add_sysfs_error; | ||
621 | err = device_create_file(&device->dev, &dev_attr_tablet); | ||
622 | if (err) | ||
623 | goto add_sysfs_error; | ||
624 | return 0; | ||
625 | |||
614 | add_sysfs_error: | 626 | add_sysfs_error: |
615 | cleanup_sysfs(device); | 627 | cleanup_sysfs(device); |
616 | return err; | 628 | return err; |