power: supply: surface_battery: Fix battery event handling
authorMaximilian Luz <luzmaximilian@gmail.com>
Tue, 4 May 2021 18:48:13 +0000 (20:48 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Thu, 13 May 2021 16:26:07 +0000 (18:26 +0200)
commite633f33d2669cb54db2846f9cde08662d254dbd3
treea386f5a3a5294d679914a4736e1a5f771d491a87
parent6efb943b8616ec53a5e444193dccf1af9ad627b5
power: supply: surface_battery: Fix battery event handling

The battery subsystem of the Surface Aggregator Module EC requires us to
register the battery notifier with instance ID 0. However, battery
events are actually sent with the instance ID corresponding to the
device, which is nonzero. Thus, the strict-matching approach doesn't
work here and will discard events that the driver is expected to handle.

To fix this we have to fall back on notifier matching by target-category
only and have to manually check the instance ID in the notifier
callback.

Fixes: 167f77f7d0b3 ("power: supply: Add battery driver for Surface Aggregator Module")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/surface_battery.c