]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/acpi/dock.c
ACPI: dock: use mutex instead of spinlock
[karo-tx-linux.git] / drivers / acpi / dock.c
index 510a9452429848d20abae91b47a9005aa95c4b8f..c7df2a1ea9d75e7787ec9cd244a41559ddda41f5 100644 (file)
@@ -44,7 +44,7 @@ struct dock_station {
        unsigned long last_dock_time;
        u32 flags;
        spinlock_t dd_lock;
-       spinlock_t hp_lock;
+       struct mutex hp_lock;
        struct list_head dependent_devices;
        struct list_head hotplug_devices;
 };
@@ -58,8 +58,8 @@ struct dock_dependent_device {
 };
 
 #define DOCK_DOCKING   0x00000001
-#define DOCK_EVENT     KOBJ_DOCK
-#define UNDOCK_EVENT   KOBJ_UNDOCK
+#define DOCK_EVENT     3
+#define UNDOCK_EVENT   2
 
 static struct dock_station *dock_station;
 
@@ -114,9 +114,9 @@ static void
 dock_add_hotplug_device(struct dock_station *ds,
                        struct dock_dependent_device *dd)
 {
-       spin_lock(&ds->hp_lock);
+       mutex_lock(&ds->hp_lock);
        list_add_tail(&dd->hotplug_list, &ds->hotplug_devices);
-       spin_unlock(&ds->hp_lock);
+       mutex_unlock(&ds->hp_lock);
 }
 
 /**
@@ -130,9 +130,9 @@ static void
 dock_del_hotplug_device(struct dock_station *ds,
                        struct dock_dependent_device *dd)
 {
-       spin_lock(&ds->hp_lock);
+       mutex_lock(&ds->hp_lock);
        list_del(&dd->hotplug_list);
-       spin_unlock(&ds->hp_lock);
+       mutex_unlock(&ds->hp_lock);
 }
 
 /**
@@ -295,7 +295,7 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event)
 {
        struct dock_dependent_device *dd;
 
-       spin_lock(&ds->hp_lock);
+       mutex_lock(&ds->hp_lock);
 
        /*
         * First call driver specific hotplug functions
@@ -317,16 +317,15 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event)
                else
                        dock_create_acpi_device(dd->handle);
        }
-       spin_unlock(&ds->hp_lock);
+       mutex_unlock(&ds->hp_lock);
 }
 
 static void dock_event(struct dock_station *ds, u32 event, int num)
 {
-       struct acpi_device *device;
-
-       device = dock_create_acpi_device(ds->handle);
-       if (device)
-               kobject_uevent(&device->kobj, num);
+       /*
+        * we don't do events until someone tells me that
+        * they would like to have them.
+        */
 }
 
 /**
@@ -626,7 +625,8 @@ static int dock_add(acpi_handle handle)
        INIT_LIST_HEAD(&dock_station->dependent_devices);
        INIT_LIST_HEAD(&dock_station->hotplug_devices);
        spin_lock_init(&dock_station->dd_lock);
-       spin_lock_init(&dock_station->hp_lock);
+       mutex_init(&dock_station->hp_lock);
+       ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list);
 
        /* Find dependent devices */
        acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,