platform/surface: aggregator: Allow notifiers to avoid communication on unregistering
authorMaximilian Luz <luzmaximilian@gmail.com>
Fri, 27 May 2022 02:34:38 +0000 (04:34 +0200)
committerHans de Goede <hdegoede@redhat.com>
Mon, 13 Jun 2022 15:25:07 +0000 (17:25 +0200)
commit5c1e88b98c60e4074796e9a05d3c674479ab1919
tree5d84e6cc2ff592ce7eb5271b07ce87f22a9a5fd5
parentdc0393c76f378f68961587fd4f32de29fb8f0c79
platform/surface: aggregator: Allow notifiers to avoid communication on unregistering

When SSAM client devices have been (physically) hot-removed,
communication attempts with those devices may fail and time out. This
can even extend to event notifiers, due to which timeouts may occur
during device removal, slowing down that process.

Add a parameter to the notifier unregister function that allows skipping
communication with the EC to prevent this. Furthermore, add wrappers for
registering and unregistering notifiers belonging to SSAM client devices
that automatically check if the device has been marked as hot-removed
and communication should be avoided.

Note that non-SSAM client devices can generally not be hot-removed, so
also add a convenience wrapper for those, defaulting to allow
communication.

Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20220527023447.2460025-4-luzmaximilian@gmail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Documentation/driver-api/surface_aggregator/client.rst
drivers/platform/surface/aggregator/controller.c
include/linux/surface_aggregator/controller.h
include/linux/surface_aggregator/device.h