From: Jiri Slaby <jirislaby@gmail.com>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Jiri Slaby <jslaby@suse.cz>,
corentincj@iksaif.net, acpi4asus-user@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: eeepc: rfkill on 900A defunct
Date: Mon, 28 Feb 2011 10:49:14 +0100 [thread overview]
Message-ID: <4D6B6F9A.1020102@gmail.com> (raw)
In-Reply-To: <20101124201834.GA7760@srcf.ucam.org>
On 11/24/2010 09:18 PM, Matthew Garrett wrote:
> Hm. As a shorter term fix, can you try this (entirely untested!)
> approach?
What is the status of this? Was there any alternative merged?
> diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
> index b2edfdc..8f817d6 100644
> --- a/drivers/platform/x86/eeepc-laptop.c
> +++ b/drivers/platform/x86/eeepc-laptop.c
> @@ -574,8 +574,9 @@ static bool eeepc_wlan_rfkill_blocked(struct eeepc_laptop *eeepc)
> return true;
> }
>
> -static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc)
> +static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle)
> {
> + struct pci_dev *port;
> struct pci_dev *dev;
> struct pci_bus *bus;
> bool blocked = eeepc_wlan_rfkill_blocked(eeepc);
> @@ -588,9 +589,17 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc)
> mutex_lock(&eeepc->hotplug_lock);
>
> if (eeepc->hotplug_slot) {
> - bus = pci_find_bus(0, 1);
> + port = acpi_get_pci_dev(handle);
> +
> + if (!port) {
> + pr_warning("Unable to find port\n");
> + goto out_unlock;
> + }
> +
> + bus = port->subordinate;
> +
> if (!bus) {
> - pr_warning("Unable to find PCI bus 1?\n");
> + pr_warning("Unable to find PCI bus?\n");
> goto out_unlock;
> }
>
> @@ -636,6 +645,17 @@ out_unlock:
> mutex_unlock(&eeepc->hotplug_lock);
> }
>
> +static void eeepc_rfkill_hotplug_update(struct eeepc_laptop *eeepc, char *node)
> +{
> + acpi_status status = AE_OK;
> + acpi_handle handle;
> +
> + status = acpi_get_handle(NULL, node, &handle);
> +
> + if (ACPI_SUCCESS(status))
> + eeepc_rfkill_hotplug(eeepc, handle);
> +}
> +
> static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
> {
> struct eeepc_laptop *eeepc = data;
> @@ -643,7 +663,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
> if (event != ACPI_NOTIFY_BUS_CHECK)
> return;
>
> - eeepc_rfkill_hotplug(eeepc);
> + eeepc_rfkill_hotplug(eeepc, handle);
> }
>
> static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc,
> @@ -661,6 +681,11 @@ static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc,
> eeepc);
> if (ACPI_FAILURE(status))
> pr_warning("Failed to register notify on %s\n", node);
> + /*
> + * Refresh pci hotplug in case the rfkill state was
> + * changed during setup.
> + */
> + eeepc_rfkill_hotplug(eeepc, handle);
> } else
> return -ENODEV;
>
> @@ -682,6 +707,12 @@ static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc,
> if (ACPI_FAILURE(status))
> pr_err("Error removing rfkill notify handler %s\n",
> node);
> + /*
> + * Refresh pci hotplug in case the rfkill
> + * state was changed after
> + * eeepc_unregister_rfkill_notifier()
> + */
> + eeepc_rfkill_hotplug(eeepc, handle);
> }
> }
>
> @@ -805,11 +836,7 @@ static void eeepc_rfkill_exit(struct eeepc_laptop *eeepc)
> rfkill_destroy(eeepc->wlan_rfkill);
> eeepc->wlan_rfkill = NULL;
> }
> - /*
> - * Refresh pci hotplug in case the rfkill state was changed after
> - * eeepc_unregister_rfkill_notifier()
> - */
> - eeepc_rfkill_hotplug(eeepc);
> +
> if (eeepc->hotplug_slot)
> pci_hp_deregister(eeepc->hotplug_slot);
>
> @@ -878,11 +905,6 @@ static int eeepc_rfkill_init(struct eeepc_laptop *eeepc)
> eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5");
> eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6");
> eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7");
> - /*
> - * Refresh pci hotplug in case the rfkill state was changed during
> - * setup.
> - */
> - eeepc_rfkill_hotplug(eeepc);
>
> exit:
> if (result && result != -ENODEV)
> @@ -917,8 +939,11 @@ static int eeepc_hotk_restore(struct device *device)
> struct eeepc_laptop *eeepc = dev_get_drvdata(device);
>
> /* Refresh both wlan rfkill state and pci hotplug */
> - if (eeepc->wlan_rfkill)
> - eeepc_rfkill_hotplug(eeepc);
> + if (eeepc->wlan_rfkill) {
> + eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P5");
> + eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P6");
> + eeepc_rfkill_hotplug_update(eeepc, "\\_SB.PCI0.P0P7");
> + }
>
> if (eeepc->bluetooth_rfkill)
> rfkill_set_sw_state(eeepc->bluetooth_rfkill,
thanks,
--
js
next prev parent reply other threads:[~2011-02-28 9:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 14:53 eeepc: rfkill on 900A defunct Jiri Slaby
2010-11-24 14:57 ` Matthew Garrett
2010-11-24 20:18 ` Matthew Garrett
2010-11-26 13:01 ` Woody Suwalski
2010-12-13 10:19 ` Jiri Slaby
2011-02-28 9:49 ` Jiri Slaby [this message]
2011-03-08 10:06 ` Jiri Slaby
2011-03-08 10:22 ` Corentin Chary
2011-03-08 10:51 ` Jiri Slaby
2011-03-09 12:50 ` Woody Suwalski
2011-04-19 13:53 ` [ping] " Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D6B6F9A.1020102@gmail.com \
--to=jirislaby@gmail.com \
--cc=acpi4asus-user@lists.sourceforge.net \
--cc=corentincj@iksaif.net \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox