aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dock.c
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2008-08-27 22:06:16 -0400
committerLen Brown <len.brown@intel.com>2008-09-23 23:23:00 -0400
commit1253f7aabfebc51446dbec5c8895c5c8846dfe06 (patch)
treedd365b884581931ab01473307d519d277cbffaa4 /drivers/acpi/dock.c
parentf730ae1838635a02aa60834762c61566911d004c (diff)
dock: introduce .uevent for devices in dock, eg libata
dock's uevent reported itself, not ata. It might be difficult to find an ata device just according to a dock. This patch introduces docking ops for each device in a dock. when docking, dock driver can send device specific uevent. This should help dock station too (not just bay) Signed-off-by: Shaohua Li <shaohua.li@intel.com> Acked-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/dock.c')
-rw-r--r--drivers/acpi/dock.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index f19f643fb362..ac7dfefcb50b 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -75,7 +75,7 @@ struct dock_dependent_device {
75 struct list_head list; 75 struct list_head list;
76 struct list_head hotplug_list; 76 struct list_head hotplug_list;
77 acpi_handle handle; 77 acpi_handle handle;
78 acpi_notify_handler handler; 78 struct acpi_dock_ops *ops;
79 void *context; 79 void *context;
80}; 80};
81 81
@@ -385,8 +385,8 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event)
385 * First call driver specific hotplug functions 385 * First call driver specific hotplug functions
386 */ 386 */
387 list_for_each_entry(dd, &ds->hotplug_devices, hotplug_list) { 387 list_for_each_entry(dd, &ds->hotplug_devices, hotplug_list) {
388 if (dd->handler) 388 if (dd->ops && dd->ops->handler)
389 dd->handler(dd->handle, event, dd->context); 389 dd->ops->handler(dd->handle, event, dd->context);
390 } 390 }
391 391
392 /* 392 /*
@@ -409,6 +409,7 @@ static void dock_event(struct dock_station *ds, u32 event, int num)
409 struct device *dev = &ds->dock_device->dev; 409 struct device *dev = &ds->dock_device->dev;
410 char event_string[13]; 410 char event_string[13];
411 char *envp[] = { event_string, NULL }; 411 char *envp[] = { event_string, NULL };
412 struct dock_dependent_device *dd;
412 413
413 if (num == UNDOCK_EVENT) 414 if (num == UNDOCK_EVENT)
414 sprintf(event_string, "EVENT=undock"); 415 sprintf(event_string, "EVENT=undock");
@@ -419,7 +420,14 @@ static void dock_event(struct dock_station *ds, u32 event, int num)
419 * Indicate that the status of the dock station has 420 * Indicate that the status of the dock station has
420 * changed. 421 * changed.
421 */ 422 */
422 kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); 423 if (num == DOCK_EVENT)
424 kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
425
426 list_for_each_entry(dd, &ds->hotplug_devices, hotplug_list)
427 if (dd->ops && dd->ops->uevent)
428 dd->ops->uevent(dd->handle, event, dd->context);
429 if (num != DOCK_EVENT)
430 kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
423} 431}
424 432
425/** 433/**
@@ -588,7 +596,7 @@ EXPORT_SYMBOL_GPL(unregister_dock_notifier);
588/** 596/**
589 * register_hotplug_dock_device - register a hotplug function 597 * register_hotplug_dock_device - register a hotplug function
590 * @handle: the handle of the device 598 * @handle: the handle of the device
591 * @handler: the acpi_notifier_handler to call after docking 599 * @ops: handlers to call after docking
592 * @context: device specific data 600 * @context: device specific data
593 * 601 *
594 * If a driver would like to perform a hotplug operation after a dock 602 * If a driver would like to perform a hotplug operation after a dock
@@ -596,7 +604,7 @@ EXPORT_SYMBOL_GPL(unregister_dock_notifier);
596 * the dock driver after _DCK is executed. 604 * the dock driver after _DCK is executed.
597 */ 605 */
598int 606int
599register_hotplug_dock_device(acpi_handle handle, acpi_notify_handler handler, 607register_hotplug_dock_device(acpi_handle handle, struct acpi_dock_ops *ops,
600 void *context) 608 void *context)
601{ 609{
602 struct dock_dependent_device *dd; 610 struct dock_dependent_device *dd;
@@ -612,7 +620,7 @@ register_hotplug_dock_device(acpi_handle handle, acpi_notify_handler handler,
612 list_for_each_entry(dock_station, &dock_stations, sibiling) { 620 list_for_each_entry(dock_station, &dock_stations, sibiling) {
613 dd = find_dock_dependent_device(dock_station, handle); 621 dd = find_dock_dependent_device(dock_station, handle);
614 if (dd) { 622 if (dd) {
615 dd->handler = handler; 623 dd->ops = ops;
616 dd->context = context; 624 dd->context = context;
617 dock_add_hotplug_device(dock_station, dd); 625 dock_add_hotplug_device(dock_station, dd);
618 return 0; 626 return 0;