Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165226
b: refs/heads/master
c: 07e84aa
h: refs/heads/master
v: v3
  • Loading branch information
Alan Jenkins authored and Len Brown committed Aug 28, 2009
1 parent 570b76e commit b633306
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dcf443b5813074031a45b05ad9c57da98bcae329
refs/heads/master: 07e84aa98f6b3a7278d3267f6f657955ed3eb973
77 changes: 45 additions & 32 deletions trunk/drivers/platform/x86/eeepc-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,37 +667,37 @@ static void eeepc_rfkill_hotplug(void)
struct pci_bus *bus;
bool blocked = eeepc_wlan_rfkill_blocked();

rfkill_set_sw_state(ehotk->wlan_rfkill, blocked);
if (ehotk->wlan_rfkill)
rfkill_set_sw_state(ehotk->wlan_rfkill, blocked);

mutex_lock(&ehotk->hotplug_lock);

if (ehotk->hotplug_slot == NULL)
goto out_unlock;

bus = pci_find_bus(0, 1);
if (!bus) {
pr_warning("Unable to find PCI bus 1?\n");
goto out_unlock;
}

if (!blocked) {
dev = pci_get_slot(bus, 0);
if (dev) {
/* Device already present */
pci_dev_put(dev);
if (ehotk->hotplug_slot) {
bus = pci_find_bus(0, 1);
if (!bus) {
pr_warning("Unable to find PCI bus 1?\n");
goto out_unlock;
}
dev = pci_scan_single_device(bus, 0);
if (dev) {
pci_bus_assign_resources(bus);
if (pci_bus_add_device(dev))
pr_err("Unable to hotplug wifi\n");
}
} else {
dev = pci_get_slot(bus, 0);
if (dev) {
pci_remove_bus_device(dev);
pci_dev_put(dev);

if (!blocked) {
dev = pci_get_slot(bus, 0);
if (dev) {
/* Device already present */
pci_dev_put(dev);
goto out_unlock;
}
dev = pci_scan_single_device(bus, 0);
if (dev) {
pci_bus_assign_resources(bus);
if (pci_bus_add_device(dev))
pr_err("Unable to hotplug wifi\n");
}
} else {
dev = pci_get_slot(bus, 0);
if (dev) {
pci_remove_bus_device(dev);
pci_dev_put(dev);
}
}
}

Expand Down Expand Up @@ -1029,14 +1029,22 @@ static void eeepc_rfkill_exit(void)
{
eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");
if (ehotk->wlan_rfkill)
if (ehotk->wlan_rfkill) {
rfkill_unregister(ehotk->wlan_rfkill);
ehotk->wlan_rfkill = NULL;
}
/*
* Refresh pci hotplug in case the rfkill state was changed after
* eeepc_unregister_rfkill_notifier()
*/
eeepc_rfkill_hotplug();
if (ehotk->hotplug_slot)
pci_hp_deregister(ehotk->hotplug_slot);

if (ehotk->bluetooth_rfkill)
rfkill_unregister(ehotk->bluetooth_rfkill);
if (ehotk->wwan3g_rfkill)
rfkill_unregister(ehotk->wwan3g_rfkill);
if (ehotk->hotplug_slot)
pci_hp_deregister(ehotk->hotplug_slot);
}

static void eeepc_input_exit(void)
Expand Down Expand Up @@ -1104,9 +1112,6 @@ static int eeepc_rfkill_init(struct device *dev)

mutex_init(&ehotk->hotplug_lock);

eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");

result = eeepc_new_rfkill(&ehotk->wlan_rfkill,
"eeepc-wlan", dev,
RFKILL_TYPE_WLAN, CM_ASL_WLAN);
Expand Down Expand Up @@ -1136,6 +1141,14 @@ static int eeepc_rfkill_init(struct device *dev)
if (result == -EBUSY)
result = 0;

eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
/*
* Refresh pci hotplug in case the rfkill state was changed during
* setup.
*/
eeepc_rfkill_hotplug();

exit:
if (result && result != -ENODEV)
eeepc_rfkill_exit();
Expand Down

0 comments on commit b633306

Please sign in to comment.