aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-logitech-hidpp.c
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2017-03-27 16:59:23 +0200
committerJiri Kosina <jkosina@suse.cz>2017-04-06 14:36:36 +0200
commit680de741e835d56e504997b613895058625291e9 (patch)
tree5bae5f9c5df0a3fb648c34734ec785f8d6add2db /drivers/hid/hid-logitech-hidpp.c
parentHID: logitech-hidpp: Add scope to battery (diff)
downloadlinux-dev-680de741e835d56e504997b613895058625291e9.tar.xz
linux-dev-680de741e835d56e504997b613895058625291e9.zip
HID: logitech-hidpp: make sure we only register one battery per device
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>
Diffstat (limited to 'drivers/hid/hid-logitech-hidpp.c')
-rw-r--r--drivers/hid/hid-logitech-hidpp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 4aaf2378897f..1cda29ec0efd 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -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)