From patchwork Mon Mar 21 17:52:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Lee X-Patchwork-Id: 648431 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2LHrGpd021824 for ; Mon, 21 Mar 2011 17:53:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754025Ab1CURxH (ORCPT ); Mon, 21 Mar 2011 13:53:07 -0400 Received: from novprvlin0050.provo.novell.com ([137.65.248.33]:54043 "EHLO novprvlin0050.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754021Ab1CURxD (ORCPT ); Mon, 21 Mar 2011 13:53:03 -0400 Received: from INET-PRV1-MTA by novprvlin0050.provo.novell.com with Novell_GroupWise; Mon, 21 Mar 2011 11:53:01 -0600 Message-Id: <4D882B2A020000230002A319@novprvlin0050.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 8.0.2 Date: Mon, 21 Mar 2011 11:52:58 -0600 From: "Joey Lee" To: Cc: , , "Al Cho" , "Gary Lin" , , , , , Subject: Re: acer-wmi: rfkill and bluetooth enabling doesn't work as in 2.6.37 Mime-Version: 1.0 Content-Disposition: inline Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 21 Mar 2011 17:53:17 +0000 (UTC) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 38b34a7..3d3cb46 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -222,6 +222,7 @@ struct acer_debug { static struct rfkill *wireless_rfkill; static struct rfkill *bluetooth_rfkill; static struct rfkill *threeg_rfkill; +static int rfkill_inited; /* Each low-level interface must define at least some of the following */ struct wmi_interface { @@ -1161,9 +1162,13 @@ static int acer_rfkill_set(void *data, bool blocked) { acpi_status status; u32 cap = (unsigned long)data; - status = set_u32(!blocked, cap); - if (ACPI_FAILURE(status)) - return -ENODEV; + + if (rfkill_inited) { + status = set_u32(!blocked, cap); + if (ACPI_FAILURE(status)) + return -ENODEV; + } + return 0; } @@ -1187,14 +1192,16 @@ static struct rfkill *acer_rfkill_register(struct device *dev, return ERR_PTR(-ENOMEM); status = get_device_status(&state, cap); - if (ACPI_SUCCESS(status)) - rfkill_init_sw_state(rfkill_dev, !state); err = rfkill_register(rfkill_dev); if (err) { rfkill_destroy(rfkill_dev); return ERR_PTR(err); } + + if (ACPI_SUCCESS(status)) + rfkill_set_sw_state(rfkill_dev, !state); + return rfkill_dev; } @@ -1229,6 +1236,8 @@ static int acer_rfkill_init(struct device *dev) } } + rfkill_inited = 1; + schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ)); return 0;