public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* disabling "rfkill hotplug" on newer eeepc-laptop models
@ 2010-02-20 12:50 Alan Jenkins
  2010-02-20 15:44 ` Matthew Garrett
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Jenkins @ 2010-02-20 12:50 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: Corentin Chary, linux-pci, linux acpi

Hi Matthew,

We've just had the third report of a newer eeepc-laptop model which 
needs to have the wireless hotplug code disabled.  So I expect there 
are/will be more such models, and many more puzzled users :).

I seem to remember you mentioning two possibilities

1. checking PCI config space, to see whether the device is really absent 
before we mark it as unplugged.
2. a generic mechanism which would replace the current eeepc-specific code.


I think we should try to implement the former (or equivalent) asap.  Is 
there a generic mechanism yet?  If not, I have some eeepc-specific code 
ready for testing on afflicted models -

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 6a47bb7..9a844ca 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -578,6 +578,8 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc)
 	struct pci_dev *dev;
 	struct pci_bus *bus;
 	bool blocked = eeepc_wlan_rfkill_blocked(eeepc);
+	bool absent;
+	u32 l;
 
 	if (eeepc->wlan_rfkill)
 		rfkill_set_sw_state(eeepc->wlan_rfkill, blocked);
@@ -591,6 +593,22 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc)
 			goto out_unlock;
 		}
 
+		if (pci_bus_read_config_dword(bus, 0, PCI_VENDOR_ID, &l)) {
+			pr_err("Unable to read PCI config space?\n");
+			goto out_unlock;
+		}
+		absent = (l == 0xffffffff);
+
+		if (blocked != absent) {
+			pr_warning("BIOS says wireless lan is %s, "
+					"but the pci device is %s\n",
+				blocked ? "blocked" : "unblocked",
+				absent ? "absent" : "present");
+			pr_warning("skipped wireless hotplug as probably "
+					"inappropriate for this model\n");
+			goto out_unlock;
+		}
+
 		if (!blocked) {
 			dev = pci_get_slot(bus, 0);
 			if (dev) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: disabling "rfkill hotplug" on newer eeepc-laptop models
  2010-02-20 12:50 disabling "rfkill hotplug" on newer eeepc-laptop models Alan Jenkins
@ 2010-02-20 15:44 ` Matthew Garrett
  2010-02-22 14:10   ` Corentin Chary
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Garrett @ 2010-02-20 15:44 UTC (permalink / raw)
  To: Alan Jenkins; +Cc: Corentin Chary, linux-pci, linux acpi

On Sat, Feb 20, 2010 at 12:50:53PM +0000, Alan Jenkins wrote:

> 1. checking PCI config space, to see whether the device is really absent  
> before we mark it as unplugged.
> 2. a generic mechanism which would replace the current eeepc-specific code.

The generic mechanism will become necessary with .34 anyway, as soon as 
the PCI runtime power management code lands. It'll be taking the 
notification handlers for these devices.

I think we effectively need to move some of the acpiphp code and make it 
generic. These shouldn't be exposed as hotplug slots, but if we receive 
a rescan notification and the device is no longer there then it's pretty 
obvious that we need to remove it...

On the other hand, your patch looks fine for the immediate issue.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: disabling "rfkill hotplug" on newer eeepc-laptop models
  2010-02-20 15:44 ` Matthew Garrett
@ 2010-02-22 14:10   ` Corentin Chary
  0 siblings, 0 replies; 3+ messages in thread
From: Corentin Chary @ 2010-02-22 14:10 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: Alan Jenkins, linux-pci, linux acpi

On Sat, Feb 20, 2010 at 4:44 PM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Sat, Feb 20, 2010 at 12:50:53PM +0000, Alan Jenkins wrote:
>
>> 1. checking PCI config space, to see whether the device is really absent
>> before we mark it as unplugged.
>> 2. a generic mechanism which would replace the current eeepc-specific code.
>
> The generic mechanism will become necessary with .34 anyway, as soon as
> the PCI runtime power management code lands. It'll be taking the
> notification handlers for these devices.
>
> I think we effectively need to move some of the acpiphp code and make it
> generic. These shouldn't be exposed as hotplug slots, but if we receive
> a rescan notification and the device is no longer there then it's pretty
> obvious that we need to remove it...
>
> On the other hand, your patch looks fine for the immediate issue.
>
> --
> Matthew Garrett | mjg59@srcf.ucam.org
>

Alan, could you re-send the patch with a formated changelog ? (and you
can add my Acked-By)
Thanks,

-- 
Corentin Chary
http://xf.iksaif.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-22 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-20 12:50 disabling "rfkill hotplug" on newer eeepc-laptop models Alan Jenkins
2010-02-20 15:44 ` Matthew Garrett
2010-02-22 14:10   ` Corentin Chary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox