aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dock.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/dock.c')
-rw-r--r--drivers/acpi/dock.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index dcd73ccb514c..5bfd769fc91f 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -32,8 +32,8 @@
32#include <linux/jiffies.h> 32#include <linux/jiffies.h>
33#include <linux/stddef.h> 33#include <linux/stddef.h>
34#include <linux/acpi.h> 34#include <linux/acpi.h>
35#include <acpi/acpi_bus.h> 35
36#include <acpi/acpi_drivers.h> 36#include "internal.h"
37 37
38#define PREFIX "ACPI: " 38#define PREFIX "ACPI: "
39 39
@@ -323,14 +323,11 @@ static int dock_present(struct dock_station *ds)
323 */ 323 */
324static void dock_create_acpi_device(acpi_handle handle) 324static void dock_create_acpi_device(acpi_handle handle)
325{ 325{
326 struct acpi_device *device; 326 struct acpi_device *device = NULL;
327 int ret; 327 int ret;
328 328
329 if (acpi_bus_get_device(handle, &device)) { 329 acpi_bus_get_device(handle, &device);
330 /* 330 if (!acpi_device_enumerated(device)) {
331 * no device created for this object,
332 * so we should create one.
333 */
334 ret = acpi_bus_scan(handle); 331 ret = acpi_bus_scan(handle);
335 if (ret) 332 if (ret)
336 pr_debug("error adding bus, %x\n", -ret); 333 pr_debug("error adding bus, %x\n", -ret);
@@ -612,7 +609,7 @@ static int handle_eject_request(struct dock_station *ds, u32 event)
612static void dock_notify(struct dock_station *ds, u32 event) 609static void dock_notify(struct dock_station *ds, u32 event)
613{ 610{
614 acpi_handle handle = ds->handle; 611 acpi_handle handle = ds->handle;
615 struct acpi_device *ad; 612 struct acpi_device *adev = NULL;
616 int surprise_removal = 0; 613 int surprise_removal = 0;
617 614
618 /* 615 /*
@@ -635,7 +632,8 @@ static void dock_notify(struct dock_station *ds, u32 event)
635 switch (event) { 632 switch (event) {
636 case ACPI_NOTIFY_BUS_CHECK: 633 case ACPI_NOTIFY_BUS_CHECK:
637 case ACPI_NOTIFY_DEVICE_CHECK: 634 case ACPI_NOTIFY_DEVICE_CHECK:
638 if (!dock_in_progress(ds) && acpi_bus_get_device(handle, &ad)) { 635 acpi_bus_get_device(handle, &adev);
636 if (!dock_in_progress(ds) && !acpi_device_enumerated(adev)) {
639 begin_dock(ds); 637 begin_dock(ds);
640 dock(ds); 638 dock(ds);
641 if (!dock_present(ds)) { 639 if (!dock_present(ds)) {
@@ -715,13 +713,11 @@ static acpi_status __init find_dock_devices(acpi_handle handle, u32 lvl,
715static ssize_t show_docked(struct device *dev, 713static ssize_t show_docked(struct device *dev,
716 struct device_attribute *attr, char *buf) 714 struct device_attribute *attr, char *buf)
717{ 715{
718 struct acpi_device *tmp;
719
720 struct dock_station *dock_station = dev->platform_data; 716 struct dock_station *dock_station = dev->platform_data;
717 struct acpi_device *adev = NULL;
721 718
722 if (!acpi_bus_get_device(dock_station->handle, &tmp)) 719 acpi_bus_get_device(dock_station->handle, &adev);
723 return snprintf(buf, PAGE_SIZE, "1\n"); 720 return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev));
724 return snprintf(buf, PAGE_SIZE, "0\n");
725} 721}
726static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL); 722static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
727 723
@@ -898,9 +894,6 @@ find_dock_and_bay(acpi_handle handle, u32 lvl, void *context, void **rv)
898 894
899void __init acpi_dock_init(void) 895void __init acpi_dock_init(void)
900{ 896{
901 if (acpi_disabled)
902 return;
903
904 /* look for dock stations and bays */ 897 /* look for dock stations and bays */
905 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 898 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
906 ACPI_UINT32_MAX, find_dock_and_bay, NULL, NULL, NULL); 899 ACPI_UINT32_MAX, find_dock_and_bay, NULL, NULL, NULL);