Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165225
b: refs/heads/master
c: dcf443b
h: refs/heads/master
i:
  165223: 9bcab3c
v: v3
  • Loading branch information
Alan Jenkins authored and Len Brown committed Aug 28, 2009
1 parent 00bdd36 commit 570b76e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 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: 6d41839e762f8b8b03dbb97fd0d41b244d0bc902
refs/heads/master: dcf443b5813074031a45b05ad9c57da98bcae329
21 changes: 13 additions & 8 deletions trunk/drivers/platform/x86/eeepc-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct eeepc_hotk {
struct rfkill *bluetooth_rfkill;
struct rfkill *wwan3g_rfkill;
struct hotplug_slot *hotplug_slot;
struct work_struct hotplug_work;
struct mutex hotplug_lock;
};

/* The actual device the driver binds to */
Expand Down Expand Up @@ -661,29 +661,31 @@ static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot,
return 0;
}

static void eeepc_hotplug_work(struct work_struct *work)
static void eeepc_rfkill_hotplug(void)
{
struct pci_dev *dev;
struct pci_bus *bus;
bool blocked = eeepc_wlan_rfkill_blocked();

rfkill_set_sw_state(ehotk->wlan_rfkill, blocked);

mutex_lock(&ehotk->hotplug_lock);

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

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

if (!blocked) {
dev = pci_get_slot(bus, 0);
if (dev) {
/* Device already present */
pci_dev_put(dev);
return;
goto out_unlock;
}
dev = pci_scan_single_device(bus, 0);
if (dev) {
Expand All @@ -698,14 +700,17 @@ static void eeepc_hotplug_work(struct work_struct *work)
pci_dev_put(dev);
}
}

out_unlock:
mutex_unlock(&ehotk->hotplug_lock);
}

static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
{
if (event != ACPI_NOTIFY_BUS_CHECK)
return;

schedule_work(&ehotk->hotplug_work);
eeepc_rfkill_hotplug();
}

static void eeepc_hotk_notify(struct acpi_device *device, u32 event)
Expand Down Expand Up @@ -896,7 +901,7 @@ static int eeepc_hotk_resume(struct acpi_device *device)

rfkill_set_sw_state(ehotk->wlan_rfkill, wlan != 1);

schedule_work(&ehotk->hotplug_work);
eeepc_rfkill_hotplug();
}

if (ehotk->bluetooth_rfkill)
Expand Down Expand Up @@ -1097,7 +1102,7 @@ static int eeepc_rfkill_init(struct device *dev)
{
int result = 0;

INIT_WORK(&ehotk->hotplug_work, eeepc_hotplug_work);
mutex_init(&ehotk->hotplug_lock);

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

0 comments on commit 570b76e

Please sign in to comment.