linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* eeepc: rfkill on 900A defunct
@ 2010-11-24 14:53 Jiri Slaby
  2010-11-24 14:57 ` Matthew Garrett
  2010-11-24 20:18 ` Matthew Garrett
  0 siblings, 2 replies; 11+ messages in thread
From: Jiri Slaby @ 2010-11-24 14:53 UTC (permalink / raw)
  To: mjg; +Cc: corentincj, acpi4asus-user, platform-driver-x86, LKML

Hi,

there is a 900A model out there with wifi at the 2nd bus:
02:00.0 Ethernet controller [0200]: Atheros Communications Inc. AR5001
Wireless Network Adapter [168c:001c] (rev 01)

but without hotplug support (pciehp cannot be bound to it). However the
eeepc-laptop driver expects the wifi on the 1st bus (pci_find_bus(0,
1)), so it operates on a NIC on this machine instead of wifi.

Changing the code to pci_find_bus(0, 2) indeed fixes the problem, but I
see no way how to determine when to do this. model == "900A" seems to be
wrong, because there are other 900A devices which work OK with bus == 1.

Any ideas?

lspci -vvnnxxx:
https://bugzillafiles.novell.org/attachment.cgi?id=370529
dmidecode:
https://bugzillafiles.novell.org/attachment.cgi?id=401633
dmesg:
https://bugzillafiles.novell.org/attachment.cgi?id=370538

The workaround for such machines:
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -588,7 +588,7 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop
*eeepc)
        mutex_lock(&eeepc->hotplug_lock);

        if (eeepc->hotplug_slot) {
-               bus = pci_find_bus(0, 1);
+               bus = pci_find_bus(0, 2);
                if (!bus) {
                        pr_warning("Unable to find PCI bus 1?\n");
                        goto out_unlock;
@@ -714,7 +714,7 @@ static struct hotplug_slot_ops
eeepc_hotplug_slot_ops = {
 static int eeepc_setup_pci_hotplug(struct eeepc_laptop *eeepc)
 {
        int ret = -ENOMEM;
-       struct pci_bus *bus = pci_find_bus(0, 1);
+       struct pci_bus *bus = pci_find_bus(0, 2);

        if (!bus) {
                pr_err("Unable to find wifi PCI bus\n");

thanks,
-- 
js
suse labs

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

* Re: eeepc: rfkill on 900A defunct
  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
  1 sibling, 0 replies; 11+ messages in thread
From: Matthew Garrett @ 2010-11-24 14:57 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: corentincj, acpi4asus-user, platform-driver-x86, LKML

On Wed, Nov 24, 2010 at 03:53:35PM +0100, Jiri Slaby wrote:

> but without hotplug support (pciehp cannot be bound to it). However the
> eeepc-laptop driver expects the wifi on the 1st bus (pci_find_bus(0,
> 1)), so it operates on a NIC on this machine instead of wifi.

Yeah, this really needs to be fixed. We need to shift this code out of 
eeepc-laptop and just have the PCI core handle it - that is, if we get a 
hotplug notification, we need to rescan the slot even if we don't have a 
hotplug driver bound to it. Let me look into that.

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

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

* Re: eeepc: rfkill on 900A defunct
  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
                     ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Matthew Garrett @ 2010-11-24 20:18 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: corentincj, acpi4asus-user, platform-driver-x86, LKML

Hm. As a shorter term fix, can you try this (entirely untested!) 
approach?

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,
-- 
Matthew Garrett | mjg59@srcf.ucam.org

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

* Re: eeepc: rfkill on 900A defunct
  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
  2 siblings, 0 replies; 11+ messages in thread
From: Woody Suwalski @ 2010-11-26 13:01 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Jiri Slaby, corentincj, acpi4asus-user, platform-driver-x86, LKML

Matthew Garrett wrote:
> Hm. As a shorter term fix, can you try this (entirely untested!)
> approach?
>
> 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,
>    
Did a quick test. The 900A seems printing the "Port not found" warning, 
but the ath5k comes down and then up OK.
Mind you, I think they are doing some magic in the BIOS as well, so more 
testing would be nice ;-)
If it works, it may be a good candidate for 2.6.36 as well...

Thanks, Woody


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

* Re: eeepc: rfkill on 900A defunct
  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
  2 siblings, 0 replies; 11+ messages in thread
From: Jiri Slaby @ 2010-12-13 10:19 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: corentincj, acpi4asus-user, platform-driver-x86, LKML

On 11/24/2010 09:18 PM, Matthew Garrett wrote:
> Hm. As a shorter term fix, can you try this (entirely untested!) 
> approach?

Yes, this one works:
https://bugzilla.novell.com/show_bug.cgi?id=595586#c27

> 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,


-- 
js
suse labs

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

* Re: eeepc: rfkill on 900A defunct
  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
  2011-03-08 10:06     ` Jiri Slaby
  2 siblings, 1 reply; 11+ messages in thread
From: Jiri Slaby @ 2011-02-28  9:49 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Jiri Slaby, corentincj, acpi4asus-user, platform-driver-x86, LKML

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

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

* Re: eeepc: rfkill on 900A defunct
  2011-02-28  9:49   ` Jiri Slaby
@ 2011-03-08 10:06     ` Jiri Slaby
  2011-03-08 10:22       ` Corentin Chary
  0 siblings, 1 reply; 11+ messages in thread
From: Jiri Slaby @ 2011-03-08 10:06 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Jiri Slaby, corentincj, acpi4asus-user, platform-driver-x86, LKML

On 02/28/2011 10:49 AM, Jiri Slaby wrote:
> 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?

Ping.

>> 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

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

* Re: eeepc: rfkill on 900A defunct
  2011-03-08 10:06     ` Jiri Slaby
@ 2011-03-08 10:22       ` Corentin Chary
  2011-03-08 10:51         ` Jiri Slaby
  0 siblings, 1 reply; 11+ messages in thread
From: Corentin Chary @ 2011-03-08 10:22 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Jiri Slaby, Jiri Slaby, acpi4asus-user, platform-driver-x86, LKML

On Tue, Mar 8, 2011 at 10:06 AM, Jiri Slaby <jirislaby@gmail.com> wrote:
> On 02/28/2011 10:49 AM, Jiri Slaby wrote:
>> 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?
>
> Ping.

Because this is Matthew's patch, and I have no hardware to test that
patch, I'm not touching it.

Jiri, on what models was this patch tested (only got 701 and 901 here) ?
Matthew, will you merge this patch in your tree ?

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

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

* Re: eeepc: rfkill on 900A defunct
  2011-03-08 10:22       ` Corentin Chary
@ 2011-03-08 10:51         ` Jiri Slaby
  2011-03-09 12:50           ` Woody Suwalski
  0 siblings, 1 reply; 11+ messages in thread
From: Jiri Slaby @ 2011-03-08 10:51 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Matthew Garrett, Jiri Slaby, acpi4asus-user, platform-driver-x86, LKML

On 03/08/2011 11:22 AM, Corentin Chary wrote:
> On Tue, Mar 8, 2011 at 10:06 AM, Jiri Slaby <jirislaby@gmail.com> wrote:
>> On 02/28/2011 10:49 AM, Jiri Slaby wrote:
>>> 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?
>>
>> Ping.
> 
> Because this is Matthew's patch, and I have no hardware to test that
> patch, I'm not touching it.
> 
> Jiri, on what models was this patch tested (only got 701 and 901 here) ?

It was 900A.

thanks,
-- 
js

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

* Re: eeepc: rfkill on 900A defunct
  2011-03-08 10:51         ` Jiri Slaby
@ 2011-03-09 12:50           ` Woody Suwalski
  2011-04-19 13:53             ` [ping] " Jiri Slaby
  0 siblings, 1 reply; 11+ messages in thread
From: Woody Suwalski @ 2011-03-09 12:50 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Corentin Chary, Matthew Garrett, Jiri Slaby, acpi4asus-user,
	platform-driver-x86, LKML

Jiri Slaby wrote:
> On 03/08/2011 11:22 AM, Corentin Chary wrote:
>    
>> On Tue, Mar 8, 2011 at 10:06 AM, Jiri Slaby<jirislaby@gmail.com>  wrote:
>>      
>>> On 02/28/2011 10:49 AM, Jiri Slaby wrote:
>>>        
>>>> 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?
>>>>          
>>> Ping.
>>>        
>> Because this is Matthew's patch, and I have no hardware to test that
>> patch, I'm not touching it.
>>
>> Jiri, on what models was this patch tested (only got 701 and 901 here) ?
>>      
> It was 900A.
>
> thanks,
>    
I have tested it on 900A and it does the trick.
wlan can now be turned off/on (did not notice the problem before Jiri 
posted the patch ;-) ). So it should go in...

Woody


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

* [ping] Re: eeepc: rfkill on 900A defunct
  2011-03-09 12:50           ` Woody Suwalski
@ 2011-04-19 13:53             ` Jiri Slaby
  0 siblings, 0 replies; 11+ messages in thread
From: Jiri Slaby @ 2011-04-19 13:53 UTC (permalink / raw)
  To: Woody Suwalski
  Cc: Corentin Chary, Matthew Garrett, Jiri Slaby, acpi4asus-user,
	platform-driver-x86, LKML

On 03/09/2011 01:50 PM, Woody Suwalski wrote:
> Jiri Slaby wrote:
>> On 03/08/2011 11:22 AM, Corentin Chary wrote:
>>   
>>> On Tue, Mar 8, 2011 at 10:06 AM, Jiri Slaby<jirislaby@gmail.com>  wrote:
>>>     
>>>> On 02/28/2011 10:49 AM, Jiri Slaby wrote:
>>>>       
>>>>> 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?
>>>>>          
>>>> Ping.
>>>>        
>>> Because this is Matthew's patch, and I have no hardware to test that
>>> patch, I'm not touching it.
>>>
>>> Jiri, on what models was this patch tested (only got 701 and 901 here) ?
>>>      
>> It was 900A.
>>
>> thanks,
>>    
> I have tested it on 900A and it does the trick.
> wlan can now be turned off/on (did not notice the problem before Jiri
> posted the patch ;-) ). So it should go in...

Any updates? Matthew?

-- 
js

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

end of thread, other threads:[~2011-04-19 13:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).