Commit eceb7bdf644b418175aab1c998137e692ac98a4c

Authored by Anssi Hannula
Committed by Matthew Garrett
1 parent c3021ea1be

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>

Showing 1 changed file with 29 additions and 17 deletions Side-by-side Diff

drivers/platform/x86/hp-wmi.c
... ... @@ -532,7 +532,7 @@
532 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 537 int err;
538 538 int wireless = 0;
... ... @@ -542,22 +542,6 @@
542 542 if (err)
543 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 545 if (wireless & 0x1) {
562 546 wifi_rfkill = rfkill_alloc("hp-wifi", &device->dev,
563 547 RFKILL_TYPE_WLAN,
... ... @@ -611,6 +595,34 @@
611 595 rfkill_unregister(wifi_rfkill);
612 596 register_wifi_error:
613 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 626 add_sysfs_error:
615 627 cleanup_sysfs(device);
616 628 return err;