diff options
-rw-r--r-- | drivers/platform/x86/hp-wmi.c | 47 |
1 files changed, 12 insertions, 35 deletions
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 2521e45280b8..6bcbbb375401 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -502,6 +502,17 @@ static DEVICE_ATTR_RO(dock); | |||
502 | static DEVICE_ATTR_RO(tablet); | 502 | static DEVICE_ATTR_RO(tablet); |
503 | static DEVICE_ATTR_RW(postcode); | 503 | static DEVICE_ATTR_RW(postcode); |
504 | 504 | ||
505 | static struct attribute *hp_wmi_attrs[] = { | ||
506 | &dev_attr_display.attr, | ||
507 | &dev_attr_hddtemp.attr, | ||
508 | &dev_attr_als.attr, | ||
509 | &dev_attr_dock.attr, | ||
510 | &dev_attr_tablet.attr, | ||
511 | &dev_attr_postcode.attr, | ||
512 | NULL, | ||
513 | }; | ||
514 | ATTRIBUTE_GROUPS(hp_wmi); | ||
515 | |||
505 | static void hp_wmi_notify(u32 value, void *context) | 516 | static void hp_wmi_notify(u32 value, void *context) |
506 | { | 517 | { |
507 | struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; | 518 | struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; |
@@ -678,16 +689,6 @@ static void hp_wmi_input_destroy(void) | |||
678 | input_unregister_device(hp_wmi_input_dev); | 689 | input_unregister_device(hp_wmi_input_dev); |
679 | } | 690 | } |
680 | 691 | ||
681 | static void cleanup_sysfs(struct platform_device *device) | ||
682 | { | ||
683 | device_remove_file(&device->dev, &dev_attr_display); | ||
684 | device_remove_file(&device->dev, &dev_attr_hddtemp); | ||
685 | device_remove_file(&device->dev, &dev_attr_als); | ||
686 | device_remove_file(&device->dev, &dev_attr_dock); | ||
687 | device_remove_file(&device->dev, &dev_attr_tablet); | ||
688 | device_remove_file(&device->dev, &dev_attr_postcode); | ||
689 | } | ||
690 | |||
691 | static int __init hp_wmi_rfkill_setup(struct platform_device *device) | 692 | static int __init hp_wmi_rfkill_setup(struct platform_device *device) |
692 | { | 693 | { |
693 | int err, wireless; | 694 | int err, wireless; |
@@ -858,8 +859,6 @@ fail: | |||
858 | 859 | ||
859 | static int __init hp_wmi_bios_setup(struct platform_device *device) | 860 | static int __init hp_wmi_bios_setup(struct platform_device *device) |
860 | { | 861 | { |
861 | int err; | ||
862 | |||
863 | /* clear detected rfkill devices */ | 862 | /* clear detected rfkill devices */ |
864 | wifi_rfkill = NULL; | 863 | wifi_rfkill = NULL; |
865 | bluetooth_rfkill = NULL; | 864 | bluetooth_rfkill = NULL; |
@@ -869,35 +868,12 @@ static int __init hp_wmi_bios_setup(struct platform_device *device) | |||
869 | if (hp_wmi_rfkill_setup(device)) | 868 | if (hp_wmi_rfkill_setup(device)) |
870 | hp_wmi_rfkill2_setup(device); | 869 | hp_wmi_rfkill2_setup(device); |
871 | 870 | ||
872 | err = device_create_file(&device->dev, &dev_attr_display); | ||
873 | if (err) | ||
874 | goto add_sysfs_error; | ||
875 | err = device_create_file(&device->dev, &dev_attr_hddtemp); | ||
876 | if (err) | ||
877 | goto add_sysfs_error; | ||
878 | err = device_create_file(&device->dev, &dev_attr_als); | ||
879 | if (err) | ||
880 | goto add_sysfs_error; | ||
881 | err = device_create_file(&device->dev, &dev_attr_dock); | ||
882 | if (err) | ||
883 | goto add_sysfs_error; | ||
884 | err = device_create_file(&device->dev, &dev_attr_tablet); | ||
885 | if (err) | ||
886 | goto add_sysfs_error; | ||
887 | err = device_create_file(&device->dev, &dev_attr_postcode); | ||
888 | if (err) | ||
889 | goto add_sysfs_error; | ||
890 | return 0; | 871 | return 0; |
891 | |||
892 | add_sysfs_error: | ||
893 | cleanup_sysfs(device); | ||
894 | return err; | ||
895 | } | 872 | } |
896 | 873 | ||
897 | static int __exit hp_wmi_bios_remove(struct platform_device *device) | 874 | static int __exit hp_wmi_bios_remove(struct platform_device *device) |
898 | { | 875 | { |
899 | int i; | 876 | int i; |
900 | cleanup_sysfs(device); | ||
901 | 877 | ||
902 | for (i = 0; i < rfkill2_count; i++) { | 878 | for (i = 0; i < rfkill2_count; i++) { |
903 | rfkill_unregister(rfkill2[i].rfkill); | 879 | rfkill_unregister(rfkill2[i].rfkill); |
@@ -966,6 +942,7 @@ static struct platform_driver hp_wmi_driver = { | |||
966 | .driver = { | 942 | .driver = { |
967 | .name = "hp-wmi", | 943 | .name = "hp-wmi", |
968 | .pm = &hp_wmi_pm_ops, | 944 | .pm = &hp_wmi_pm_ops, |
945 | .dev_groups = hp_wmi_groups, | ||
969 | }, | 946 | }, |
970 | .remove = __exit_p(hp_wmi_bios_remove), | 947 | .remove = __exit_p(hp_wmi_bios_remove), |
971 | }; | 948 | }; |