HID: logitech-hidpp: make sure we only register one battery per device
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Mon, 27 Mar 2017 14:59:23 +0000 (16:59 +0200)
committerJiri Kosina <jkosina@suse.cz>
Thu, 6 Apr 2017 12:36:36 +0000 (14:36 +0200)
Simple check to add, huge improvement :)

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Tested-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-logitech-hidpp.c

index 4aaf2378897f21759615898549e9e04d8eb287da..1cda29ec0efdfb2f6c50a280acd5b9b288318f8b 100644 (file)
@@ -828,6 +828,9 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
 {
        int ret;
 
+       if (hidpp->battery.ps)
+               return 0;
+
        if (hidpp->protocol_major >= 2) {
                ret = hidpp20_initialize_battery(hidpp);
                if (ret == 0)