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>
This commit is contained in:
committed by
Matthew Garrett
parent
c3021ea1be
commit
eceb7bdf64
@@ -532,7 +532,7 @@ static void cleanup_sysfs(struct platform_device *device)
|
|||||||
device_remove_file(&device->dev, &dev_attr_tablet);
|
device_remove_file(&device->dev, &dev_attr_tablet);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __devinit hp_wmi_bios_setup(struct platform_device *device)
|
static int __devinit hp_wmi_rfkill_setup(struct platform_device *device)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
int wireless = 0;
|
int wireless = 0;
|
||||||
@@ -542,22 +542,6 @@ static int __devinit hp_wmi_bios_setup(struct platform_device *device)
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = device_create_file(&device->dev, &dev_attr_display);
|
|
||||||
if (err)
|
|
||||||
goto add_sysfs_error;
|
|
||||||
err = device_create_file(&device->dev, &dev_attr_hddtemp);
|
|
||||||
if (err)
|
|
||||||
goto add_sysfs_error;
|
|
||||||
err = device_create_file(&device->dev, &dev_attr_als);
|
|
||||||
if (err)
|
|
||||||
goto add_sysfs_error;
|
|
||||||
err = device_create_file(&device->dev, &dev_attr_dock);
|
|
||||||
if (err)
|
|
||||||
goto add_sysfs_error;
|
|
||||||
err = device_create_file(&device->dev, &dev_attr_tablet);
|
|
||||||
if (err)
|
|
||||||
goto add_sysfs_error;
|
|
||||||
|
|
||||||
if (wireless & 0x1) {
|
if (wireless & 0x1) {
|
||||||
wifi_rfkill = rfkill_alloc("hp-wifi", &device->dev,
|
wifi_rfkill = rfkill_alloc("hp-wifi", &device->dev,
|
||||||
RFKILL_TYPE_WLAN,
|
RFKILL_TYPE_WLAN,
|
||||||
@@ -611,6 +595,34 @@ register_bluetooth_error:
|
|||||||
rfkill_unregister(wifi_rfkill);
|
rfkill_unregister(wifi_rfkill);
|
||||||
register_wifi_error:
|
register_wifi_error:
|
||||||
rfkill_destroy(wifi_rfkill);
|
rfkill_destroy(wifi_rfkill);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __devinit hp_wmi_bios_setup(struct platform_device *device)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = hp_wmi_rfkill_setup(device);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
err = device_create_file(&device->dev, &dev_attr_display);
|
||||||
|
if (err)
|
||||||
|
goto add_sysfs_error;
|
||||||
|
err = device_create_file(&device->dev, &dev_attr_hddtemp);
|
||||||
|
if (err)
|
||||||
|
goto add_sysfs_error;
|
||||||
|
err = device_create_file(&device->dev, &dev_attr_als);
|
||||||
|
if (err)
|
||||||
|
goto add_sysfs_error;
|
||||||
|
err = device_create_file(&device->dev, &dev_attr_dock);
|
||||||
|
if (err)
|
||||||
|
goto add_sysfs_error;
|
||||||
|
err = device_create_file(&device->dev, &dev_attr_tablet);
|
||||||
|
if (err)
|
||||||
|
goto add_sysfs_error;
|
||||||
|
return 0;
|
||||||
|
|
||||||
add_sysfs_error:
|
add_sysfs_error:
|
||||||
cleanup_sysfs(device);
|
cleanup_sysfs(device);
|
||||||
return err;
|
return err;
|
||||||
|
Reference in New Issue
Block a user