platform/surface: aggregator: Allow devices to be marked as hot-removed
authorMaximilian Luz <luzmaximilian@gmail.com>
Fri, 27 May 2022 02:34:37 +0000 (04:34 +0200)
committerHans de Goede <hdegoede@redhat.com>
Mon, 13 Jun 2022 15:25:07 +0000 (17:25 +0200)
commitdc0393c76f378f68961587fd4f32de29fb8f0c79
tree76bc05f10cbf6d7480ad6bfc8c890f9a2f654bf8
parent0eb6584068642767baab17c2e4385a6b9c029caa
platform/surface: aggregator: Allow devices to be marked as hot-removed

Some SSAM devices, notably the keyboard cover (keyboard and touchpad) on
the Surface Pro 8, can be hot-removed. When this occurs, communication
with the device may fail and time out. This timeout can unnecessarily
block and slow down device removal and even cause issues when the
devices are detached and re-attached quickly. Thus, communication should
generally be avoided once hot-removal is detected.

While we already remove a device as soon as we detect its (hot-)removal,
the corresponding device driver may still attempt to communicate with
the device during teardown. This is especially critical as communication
failure may also extend to disabling of events, which is typically done
at that stage.

Add a flag to allow marking devices as hot-removed. This can then be
used during client driver teardown to check if any communication
attempts should be avoided.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20220527023447.2460025-3-luzmaximilian@gmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
include/linux/surface_aggregator/device.h