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) {
280 static void dock_event(struct dock_station *ds, u32 event, int num)
282 struct device *dev = &ds->dock_device->dev;
299 list_for_each_entry(dd, &ds->dependent_devices, list)
308 * @ds: the dock station
313 static void handle_dock(struct dock_station *ds, int dock)
320 acpi_handle_info(ds->handle, "%s\n", dock ? "docking" : "undocking");
327 status = acpi_evaluate_integer(ds->handle, "_DCK", &arg_list, &value);
329 acpi_handle_err(ds->handle, "Failed to execute _DCK (0x%x)\n",
333 static inline void dock(struct dock_station *ds)
335 handle_dock(ds, 1);
338 static inline void undock(struct dock_station *ds)
340 handle_dock(ds, 0);
343 static inline void begin_dock(struct dock_station *ds)
345 ds->flags |= DOCK_DOCKING;
348 static inline void complete_dock(struct dock_station *ds)
350 ds->flags &= ~(DOCK_DOCKING);
351 ds->last_dock_time = jiffies;
354 static inline void begin_undock(struct dock_station *ds)
356 ds->flags |= DOCK_UNDOCKING;
359 static inline void complete_undock(struct dock_station *ds)
361 ds->flags &= ~(DOCK_UNDOCKING);
366 * @ds: the dock station
372 static int dock_in_progress(struct dock_station *ds)
374 if ((ds->flags & DOCK_DOCKING) ||
375 time_before(jiffies, (ds->last_dock_time + HZ)))
386 static int handle_eject_request(struct dock_station *ds, u32 event)
388 if (dock_in_progress(ds))
398 dock_event(ds, event, UNDOCK_EVENT);
400 hot_remove_dock_devices(ds);
401 undock(ds);
402 acpi_evaluate_lck(ds->handle, 0);
403 acpi_evaluate_ej0(ds->handle);
404 if (dock_present(ds)) {
405 acpi_handle_err(ds->handle, "Unable to undock!\n");
408 complete_undock(ds);
424 struct dock_station *ds = find_dock_station(handle);
427 if (!ds)
435 if ((ds->flags & DOCK_IS_DOCK) && event == ACPI_NOTIFY_DEVICE_CHECK)
450 if (!dock_in_progress(ds) && !acpi_device_enumerated(adev)) {
451 begin_dock(ds);
452 dock(ds);
453 if (!dock_present(ds)) {
455 complete_dock(ds);
458 hotplug_dock_devices(ds, event);
459 complete_dock(ds);
460 dock_event(ds, event, DOCK_EVENT);
461 acpi_evaluate_lck(ds->handle, 1);
465 if (dock_present(ds) || dock_in_progress(ds))
473 begin_undock(ds);
474 if ((immediate_undock && !(ds->flags & DOCK_IS_ATA))
476 handle_eject_request(ds, event);
478 dock_event(ds, event, UNDOCK_EVENT);
587 struct dock_station *dock_station, ds = { NULL, };
597 pdevinfo.data = &ds;
598 pdevinfo.size_data = sizeof(ds);