Lines Matching refs:ds

66  * @ds: Dock station.
71 static int add_dock_dependent_device(struct dock_station *ds,
82 list_add_tail(&dd->list, &ds->dependent_devices);
132 struct dock_station *ds;
134 list_for_each_entry(ds, &dock_stations, sibling)
135 if (ds->handle == handle)
136 return ds;
143 * @ds: the dock station
150 find_dock_dependent_device(struct dock_station *ds, struct acpi_device *adev)
154 list_for_each_entry(dd, &ds->dependent_devices, list)
164 struct dock_station *ds = find_dock_station(dshandle);
166 if (ds && !find_dock_dependent_device(ds, adev))
167 add_dock_dependent_device(ds, adev);
202 * @ds: the dock station
207 static int dock_present(struct dock_station *ds)
212 if (ds) {
213 status = acpi_evaluate_integer(ds->handle, "_STA", NULL, &sta);
222 * @ds: Dock station.
224 static void hot_remove_dock_devices(struct dock_station *ds)
233 list_for_each_entry_reverse(dd, &ds->dependent_devices, list)
237 list_for_each_entry_reverse(dd, &ds->dependent_devices, list)
243 * @ds: the dock station
251 static void hotplug_dock_devices(struct dock_station *ds, u32 event)
256 list_for_each_entry(dd, &ds->dependent_devices, list)
260 list_for_each_entry(dd, &ds->dependent_devices, list)
269 list_for_each_entry(dd, &ds->dependent_devices, list) {
281 static void dock_event(struct dock_station *ds, u32 event, int num)
283 struct device *dev = &ds->dock_device->dev;
300 list_for_each_entry(dd, &ds->dependent_devices, list)
309 * @ds: the dock station
314 static void handle_dock(struct dock_station *ds, int dock)
321 acpi_handle_info(ds->handle, "%s\n", dock ? "docking" : "undocking");
328 status = acpi_evaluate_integer(ds->handle, "_DCK", &arg_list, &value);
330 acpi_handle_err(ds->handle, "Failed to execute _DCK (0x%x)\n",
334 static inline void dock(struct dock_station *ds)
336 handle_dock(ds, 1);
339 static inline void undock(struct dock_station *ds)
341 handle_dock(ds, 0);
344 static inline void begin_dock(struct dock_station *ds)
346 ds->flags |= DOCK_DOCKING;
349 static inline void complete_dock(struct dock_station *ds)
351 ds->flags &= ~(DOCK_DOCKING);
352 ds->last_dock_time = jiffies;
355 static inline void begin_undock(struct dock_station *ds)
357 ds->flags |= DOCK_UNDOCKING;
360 static inline void complete_undock(struct dock_station *ds)
362 ds->flags &= ~(DOCK_UNDOCKING);
367 * @ds: the dock station
373 static int dock_in_progress(struct dock_station *ds)
375 if ((ds->flags & DOCK_DOCKING) ||
376 time_before(jiffies, (ds->last_dock_time + HZ)))
383 * @ds: The dock station to undock.
389 static int handle_eject_request(struct dock_station *ds, u32 event)
391 if (dock_in_progress(ds))
401 dock_event(ds, event, UNDOCK_EVENT);
403 hot_remove_dock_devices(ds);
404 undock(ds);
405 acpi_evaluate_lck(ds->handle, 0);
406 acpi_evaluate_ej0(ds->handle);
407 if (dock_present(ds)) {
408 acpi_handle_err(ds->handle, "Unable to undock!\n");
411 complete_undock(ds);
427 struct dock_station *ds = find_dock_station(handle);
430 if (!ds)
438 if ((ds->flags & DOCK_IS_DOCK) && event == ACPI_NOTIFY_DEVICE_CHECK)
453 if (!dock_in_progress(ds) && !acpi_device_enumerated(adev)) {
454 begin_dock(ds);
455 dock(ds);
456 if (!dock_present(ds)) {
458 complete_dock(ds);
461 hotplug_dock_devices(ds, event);
462 complete_dock(ds);
463 dock_event(ds, event, DOCK_EVENT);
464 acpi_evaluate_lck(ds->handle, 1);
468 if (dock_present(ds) || dock_in_progress(ds))
476 begin_undock(ds);
477 if ((immediate_undock && !(ds->flags & DOCK_IS_ATA))
479 handle_eject_request(ds, event);
481 dock_event(ds, event, UNDOCK_EVENT);
591 struct dock_station *dock_station, ds = { NULL, };
601 pdevinfo.data = &ds;
602 pdevinfo.size_data = sizeof(ds);