Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61b83695 authored by Shaohua Li's avatar Shaohua Li Committed by Len Brown
Browse files

dock: fix for ATA bay in a dock station



an ATA bay can be in a dock and itself can be ejected separately.
This patch handles such eject bay. Found by Holger.

Signed-off-by: default avatarShaohua Li <shaohua.li@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 4be9309d
Loading
Loading
Loading
Loading
+10 −4
Original line number Original line Diff line number Diff line
@@ -609,6 +609,7 @@ register_hotplug_dock_device(acpi_handle handle, struct acpi_dock_ops *ops,
{
{
	struct dock_dependent_device *dd;
	struct dock_dependent_device *dd;
	struct dock_station *dock_station;
	struct dock_station *dock_station;
	int ret = -EINVAL;


	if (!dock_station_count)
	if (!dock_station_count)
		return -ENODEV;
		return -ENODEV;
@@ -618,16 +619,21 @@ register_hotplug_dock_device(acpi_handle handle, struct acpi_dock_ops *ops,
	 * this would include the dock station itself
	 * this would include the dock station itself
	 */
	 */
	list_for_each_entry(dock_station, &dock_stations, sibiling) {
	list_for_each_entry(dock_station, &dock_stations, sibiling) {
		/*
		 * An ATA bay can be in a dock and itself can be ejected
		 * seperately, so there are two 'dock stations' which need the
		 * ops
		 */
		dd = find_dock_dependent_device(dock_station, handle);
		dd = find_dock_dependent_device(dock_station, handle);
		if (dd) {
		if (dd) {
			dd->ops = ops;
			dd->ops = ops;
			dd->context = context;
			dd->context = context;
			dock_add_hotplug_device(dock_station, dd);
			dock_add_hotplug_device(dock_station, dd);
			return 0;
			ret = 0;
		}
		}
	}
	}


	return -EINVAL;
	return ret;
}
}


EXPORT_SYMBOL_GPL(register_hotplug_dock_device);
EXPORT_SYMBOL_GPL(register_hotplug_dock_device);
@@ -1078,8 +1084,8 @@ find_dock(acpi_handle handle, u32 lvl, void *context, void **rv)
static acpi_status
static acpi_status
find_bay(acpi_handle handle, u32 lvl, void *context, void **rv)
find_bay(acpi_handle handle, u32 lvl, void *context, void **rv)
{
{
	/* If bay is in a dock, it's already handled */
	/* If bay is a dock, it's already handled */
	if (is_ejectable_bay(handle) && !is_dock_device(handle))
	if (is_ejectable_bay(handle) && !is_dock(handle))
		dock_add(handle);
		dock_add(handle);
	return AE_OK;
	return AE_OK;
}
}