Commit 8215af01 authored by Lee, Chun-Yi's avatar Lee, Chun-Yi Committed by Matthew Garrett

acer-wmi: does not set persistence state by rfkill_init_sw_state

Acer BIOS keeps devices state when system reboot, but reset to default
device states (Wlan on, Bluetooth off, wwan on) if system cold boot.
That means BIOS's initial state is not always real persistence.

So, removed rfkill_init_sw_state because it sets initial state to
persistence then replicate to other new killswitch when rfkill-input
enabled.
After removed it, acer-wmi set initial soft-block state after rfkill
register, and doesn't allow set_block until rfkill initial finished.

Reference: bko#31002
	https://bugzilla.kernel.org/show_bug.cgi?id=31002

Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Oldřich Jedlička <oldium.pro@seznam.cz>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarLee, Chun-Yi <jlee@novell.com>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent c8440336
...@@ -217,6 +217,7 @@ struct acer_debug { ...@@ -217,6 +217,7 @@ struct acer_debug {
static struct rfkill *wireless_rfkill; static struct rfkill *wireless_rfkill;
static struct rfkill *bluetooth_rfkill; static struct rfkill *bluetooth_rfkill;
static struct rfkill *threeg_rfkill; static struct rfkill *threeg_rfkill;
static bool rfkill_inited;
/* Each low-level interface must define at least some of the following */ /* Each low-level interface must define at least some of the following */
struct wmi_interface { struct wmi_interface {
...@@ -1157,9 +1158,13 @@ static int acer_rfkill_set(void *data, bool blocked) ...@@ -1157,9 +1158,13 @@ static int acer_rfkill_set(void *data, bool blocked)
{ {
acpi_status status; acpi_status status;
u32 cap = (unsigned long)data; u32 cap = (unsigned long)data;
if (rfkill_inited) {
status = set_u32(!blocked, cap); status = set_u32(!blocked, cap);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
}
return 0; return 0;
} }
...@@ -1183,14 +1188,16 @@ static struct rfkill *acer_rfkill_register(struct device *dev, ...@@ -1183,14 +1188,16 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
status = get_device_status(&state, cap); status = get_device_status(&state, cap);
if (ACPI_SUCCESS(status))
rfkill_init_sw_state(rfkill_dev, !state);
err = rfkill_register(rfkill_dev); err = rfkill_register(rfkill_dev);
if (err) { if (err) {
rfkill_destroy(rfkill_dev); rfkill_destroy(rfkill_dev);
return ERR_PTR(err); return ERR_PTR(err);
} }
if (ACPI_SUCCESS(status))
rfkill_set_sw_state(rfkill_dev, !state);
return rfkill_dev; return rfkill_dev;
} }
...@@ -1225,6 +1232,8 @@ static int acer_rfkill_init(struct device *dev) ...@@ -1225,6 +1232,8 @@ static int acer_rfkill_init(struct device *dev)
} }
} }
rfkill_inited = true;
schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ)); schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ));
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment