From patchwork Tue Jul 25 22:20:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Armstrong Skomra X-Patchwork-Id: 13327308 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1ECC9EB64DD for ; Tue, 25 Jul 2023 22:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232493AbjGYWjk (ORCPT ); Tue, 25 Jul 2023 18:39:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232278AbjGYWj0 (ORCPT ); Tue, 25 Jul 2023 18:39:26 -0400 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 751992D50; Tue, 25 Jul 2023 15:32:45 -0700 (PDT) Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-2680eee423aso1264959a91.2; Tue, 25 Jul 2023 15:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690324229; x=1690929029; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gls0dGaLA0UDpfJAcGvNYCBWQvOuHanMjcOY6FAt6QE=; b=DPc25y3YABgHnz7POnk09Ir7LGBDng496s5QTBgBJgYrU0C8Q7m4GDJeQwTP5mAxn3 suSdCNfYJ7VI5x1u96fBfGx3wFzqum5IKhlm0TrBPBx8RDLcr508e+FeRa5ypp1KXu2G Fnmn1j/Ch8lSNL/R7befU7oaZn6hzQfJgeMU419N2IkxkD/f+PSXea0ayuQn/np1kQ7E /zDNRevzs9n4NXudawLqvPysBr/NlUTbF6rc4KfjQwhNUlSd859bOhHaxTziba6eiaNu m5AC1OQiNyA3QCzqXbbnT7J1MsHx5nk3MeitHM/I5ZctxNU4anX1hnGOC97p2jp5fRc/ Y3tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690324229; x=1690929029; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gls0dGaLA0UDpfJAcGvNYCBWQvOuHanMjcOY6FAt6QE=; b=kFXEKa5YHAuQpqgx75sXGe6LL1QYIgGNsjZzcPxqx3AxT8UMwhzWUNoZvhSnbKBo5R ggnVY4g0cDh13Ad5FGERt5fih5ckiFxis+2oQwJ21zqCyY4lo+Lqw6r+qIxWj/8LYkYK Ct+fKdWkaAr9O+s3acI9VCCaMYFav1Kp8SZY6YLwKmwZJ+gM5q8ZRMyZI0V06zsgl17o ZNCqxZF09gsXx+MRleegLZ2pTcHRp/95B5urd0DJjgcVSVK0g/zG6LGboBhgHdfNiqFN QZXddJJaE5byvtVPruyUczok8a+RQyofRNR3nHdUG8/oeTRxkbima+zl5H67iTMZmAOs Gvpg== X-Gm-Message-State: ABy/qLblGhflMijB7e+eVBXTLt1QIEmWUHY+wanZ7bixOJq+VVggEj/0 BwBVJSib1X7i4PpFkx9HOjiaTsPGGeRYaw== X-Google-Smtp-Source: APBJJlHuaxPzWJY7v5gQBpe3AjZ72pKtzAEHZAr3p1eoGEiTkam2lZNK6W31fFAq49UMZl1OLYfJ1A== X-Received: by 2002:a4a:2401:0:b0:567:154:25dc with SMTP id m1-20020a4a2401000000b00567015425dcmr148297oof.7.1690323639224; Tue, 25 Jul 2023 15:20:39 -0700 (PDT) Received: from localhost.localdomain ([97.115.139.81]) by smtp.gmail.com with ESMTPSA id n19-20020a4ad633000000b00566250a04f6sm5411544oon.18.2023.07.25.15.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 15:20:38 -0700 (PDT) From: Aaron Armstrong Skomra To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, benjamin.tissoires@redhat.com, jikos@kernel.org Cc: pinglinux@gmail.com, skomra@gmail.com, Joshua@Joshua-Dickens.com, jason.gerecke@wacom.com, stable@vger.kernel.org, Aaron Armstrong Skomra Subject: [PATCH Wacom EKR Battery Fixes 1/3] HID: wacom: remove the battery when the EKR is off Date: Tue, 25 Jul 2023 15:20:25 -0700 Message-Id: <20230725222025.123829-1-skomra@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Aaron Armstrong Skomra Currently the EKR battery remains even after we stop getting information from the device. This can lead to a stale battery persisting indefinitely in userspace. The remote sends a heartbeat every 10 seconds. Delete the battery if we miss two heartbeats (after 21 seconds). Restore the battery once we see a heartbeat again. Signed-off-by: Aaron Skomra Signed-off-by: Aaron Armstrong Skomra Reviewed-by: Jason Gerecke Fixes: 9f1015d45f62 ("HID: wacom: EKR: attach the power_supply on first connection") CC: stable@vger.kernel.org --- drivers/hid/wacom.h | 1 + drivers/hid/wacom_sys.c | 25 +++++++++++++++++++++---- drivers/hid/wacom_wac.c | 1 + drivers/hid/wacom_wac.h | 1 + 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/hid/wacom.h b/drivers/hid/wacom.h index 4da50e19808e..166a76c9bcad 100644 --- a/drivers/hid/wacom.h +++ b/drivers/hid/wacom.h @@ -150,6 +150,7 @@ struct wacom_remote { struct input_dev *input; bool registered; struct wacom_battery battery; + ktime_t active_time; } remotes[WACOM_MAX_REMOTES]; }; diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 76e5353aca0c..eb833455abd5 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -2523,6 +2523,18 @@ static void wacom_wireless_work(struct work_struct *work) return; } +static void wacom_remote_destroy_battery(struct wacom *wacom, int index) +{ + struct wacom_remote *remote = wacom->remote; + + if (remote->remotes[index].battery.battery) { + devres_release_group(&wacom->hdev->dev, + &remote->remotes[index].battery.bat_desc); + remote->remotes[index].battery.battery = NULL; + remote->remotes[index].active_time = 0; + } +} + static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) { struct wacom_remote *remote = wacom->remote; @@ -2537,9 +2549,7 @@ static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) remote->remotes[i].registered = false; spin_unlock_irqrestore(&remote->remote_lock, flags); - if (remote->remotes[i].battery.battery) - devres_release_group(&wacom->hdev->dev, - &remote->remotes[i].battery.bat_desc); + wacom_remote_destroy_battery(wacom, i); if (remote->remotes[i].group.name) devres_release_group(&wacom->hdev->dev, @@ -2547,7 +2557,6 @@ static void wacom_remote_destroy_one(struct wacom *wacom, unsigned int index) remote->remotes[i].serial = 0; remote->remotes[i].group.name = NULL; - remote->remotes[i].battery.battery = NULL; wacom->led.groups[i].select = WACOM_STATUS_UNKNOWN; } } @@ -2632,6 +2641,9 @@ static int wacom_remote_attach_battery(struct wacom *wacom, int index) if (remote->remotes[index].battery.battery) return 0; + if (!remote->remotes[index].active_time) + return 0; + if (wacom->led.groups[index].select == WACOM_STATUS_UNKNOWN) return 0; @@ -2647,6 +2659,7 @@ static void wacom_remote_work(struct work_struct *work) { struct wacom *wacom = container_of(work, struct wacom, remote_work); struct wacom_remote *remote = wacom->remote; + ktime_t kt = ktime_get(); struct wacom_remote_data data; unsigned long flags; unsigned int count; @@ -2673,6 +2686,10 @@ static void wacom_remote_work(struct work_struct *work) serial = data.remote[i].serial; if (data.remote[i].connected) { + if (kt - remote->remotes[i].active_time > WACOM_REMOTE_BATTERY_TIMEOUT + && remote->remotes[i].active_time != 0) + wacom_remote_destroy_battery(wacom, i); + if (remote->remotes[i].serial == serial) { wacom_remote_attach_battery(wacom, i); continue; diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 174bf03908d7..6c056f8844e7 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1134,6 +1134,7 @@ static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) if (index < 0 || !remote->remotes[index].registered) goto out; + remote->remotes[i].active_time = ktime_get(); input = remote->remotes[index].input; input_report_key(input, BTN_0, (data[9] & 0x01)); diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index ee21bb260f22..2e7cc5e7a0cb 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -13,6 +13,7 @@ #define WACOM_NAME_MAX 64 #define WACOM_MAX_REMOTES 5 #define WACOM_STATUS_UNKNOWN 255 +#define WACOM_REMOTE_BATTERY_TIMEOUT 21000000000ll /* packet length for individual models */ #define WACOM_PKGLEN_BBFUN 9 From patchwork Tue Jul 25 22:20:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Armstrong Skomra X-Patchwork-Id: 13327307 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C115EB64DD for ; Tue, 25 Jul 2023 22:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229522AbjGYWiZ (ORCPT ); Tue, 25 Jul 2023 18:38:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230396AbjGYWhk (ORCPT ); Tue, 25 Jul 2023 18:37:40 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0B1D5259; Tue, 25 Jul 2023 15:30:17 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-666e5f0d60bso3575436b3a.3; Tue, 25 Jul 2023 15:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690324137; x=1690928937; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zVQovqgIjSqRTIt+DkdpoM6DyIIcDIA/J+K4Pjg9mHw=; b=lOnSIyATWC3N5DkAU9sAKOAtb+XfM4LyUKyCprRmujjHG9wmXSqx0A7k329g88GMsg Jc/J8rDihf4haYHl1xe0QL4CdM7QgdCEsoi0JUHRBxgxDOb770zjsy8/4IElDpaIwlZF EebVeQdm0/+tVBn6i6cMm6HuORR277kflpTz1eFuz2gvP+ioEj4CGrGd8W6Pl2mFFsyx 2u5/a6hZx2GZ2fSzzX0GgtyP8ui2VXZAcIw+qWyV6t6Lzk8BRR8FsEdxlSAB6HmB2i1F yoRKtQ1mkumK6rvmaP+TbP9wT6rjJjNakr8pbmtYlRkxrMyucjbdOesVKl3yel8mM/sI h5eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690324137; x=1690928937; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zVQovqgIjSqRTIt+DkdpoM6DyIIcDIA/J+K4Pjg9mHw=; b=DkmM6CHXTYhYmxs581i/e+Fhu8goCMj6Pgl99tQV9+B4Ke5T87vIea1Wv/KrFZwjTt ZwXzoz4v2huV58rclzFrO2xamzyCCJKjW1tLStk+w8/SMPql1VBYra/dsL9Zc+bEurAJ YHm/R4Nwsc5KnmN9Zi2+F5niPWLx9HuC6B3RLsUnAuwLhHDFX+xNU7YGFBsDPHjAsJAY i4p0RLssy5w3SDMey1sDRtIIPQ0VXAIxufu+l73IErDOdwoEe3yLcVEBenB9ua02x81B DveClue5M9UEmkoWWbLBGJZ+vcn4UkBrVV+UR7v+vsNfAYvUGJ4CjqzQKqtUllNjUpON LPdQ== X-Gm-Message-State: ABy/qLYWdr/Y5yjZa54NDdWiMIrwk8PLpkXq1RaGKJl9Fg75ridFtLKH axMfJ9m+c35yyY3oRAvYdk3v07CjZJsBlQ== X-Google-Smtp-Source: APBJJlH7PxV/ysCWK+hECO2DUlRQqagQe6lTLATCOxltuIerbOy5nVg0V8BsKj7ig3kT9/zvdLTuTQ== X-Received: by 2002:a05:6870:4411:b0:1b3:9e41:de07 with SMTP id u17-20020a056870441100b001b39e41de07mr518746oah.36.1690323663698; Tue, 25 Jul 2023 15:21:03 -0700 (PDT) Received: from localhost.localdomain ([97.115.139.81]) by smtp.gmail.com with ESMTPSA id zh27-20020a0568716b9b00b001b02fa3097dsm5851622oab.42.2023.07.25.15.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 15:21:03 -0700 (PDT) From: Aaron Armstrong Skomra To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, benjamin.tissoires@redhat.com, jikos@kernel.org Cc: pinglinux@gmail.com, skomra@gmail.com, Joshua@Joshua-Dickens.com, jason.gerecke@wacom.com, Aaron Armstrong Skomra Subject: [PATCH Wacom EKR Battery Fixes 2/3] HID: wacom: remove unnecessary 'connected' variable from EKR Date: Tue, 25 Jul 2023 15:20:57 -0700 Message-Id: <20230725222057.123863-1-skomra@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Aaron Armstrong Skomra The 'connected' variable was poorly named, and this has led to some confusion. We can get the same information by checking if a serial number exists in the specified EKR slot. Signed-off-by: Aaron Skomra Signed-off-by: Aaron Armstrong Skomra Reviewed-by: Jason Gerecke --- drivers/hid/wacom_sys.c | 2 +- drivers/hid/wacom_wac.c | 2 -- drivers/hid/wacom_wac.h | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index eb833455abd5..16862f97c46c 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -2684,7 +2684,7 @@ static void wacom_remote_work(struct work_struct *work) for (i = 0; i < WACOM_MAX_REMOTES; i++) { serial = data.remote[i].serial; - if (data.remote[i].connected) { + if (serial) { if (kt - remote->remotes[i].active_time > WACOM_REMOTE_BATTERY_TIMEOUT && remote->remotes[i].active_time != 0) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 6c056f8844e7..c922c1c4c78f 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1209,10 +1209,8 @@ static void wacom_remote_status_irq(struct wacom_wac *wacom_wac, size_t len) for (i = 0; i < WACOM_MAX_REMOTES; i++) { int j = i * 6; int serial = (data[j+6] << 16) + (data[j+5] << 8) + data[j+4]; - bool connected = data[j+2]; remote_data.remote[i].serial = serial; - remote_data.remote[i].connected = connected; } spin_lock_irqsave(&remote->remote_lock, flags); diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index 2e7cc5e7a0cb..a10b19669947 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -331,7 +331,6 @@ struct hid_data { struct wacom_remote_data { struct { u32 serial; - bool connected; } remote[WACOM_MAX_REMOTES]; }; From patchwork Tue Jul 25 22:21:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Armstrong Skomra X-Patchwork-Id: 13327288 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ACFDC001DE for ; Tue, 25 Jul 2023 22:30:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231848AbjGYWag (ORCPT ); Tue, 25 Jul 2023 18:30:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233833AbjGYW3N (ORCPT ); Tue, 25 Jul 2023 18:29:13 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39C9686B1; Tue, 25 Jul 2023 15:22:30 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-6b9aadde448so5373371a34.0; Tue, 25 Jul 2023 15:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690323689; x=1690928489; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=uoqBZACiffS3PvfY6uEqr+KMqSZjH648nxXLpj9jwZw=; b=eNciaTky3iP20Evx3ssQ9TOYRQbxiWbJDceVGk9sIoFkX1rjcRKA4rhamh0RoGCY9y JzmxJ3PXGKGGKRiBP1ClIHoT2YAT8eFqLkUZbCfQO40OtBPyR2ZDetuxwHXuHGhmjxbZ 5WfPLMEJr0iLJB2eiHVTQxt73xdJF1DA0PKYzlhVWZXT/StiTigitF1fMzCtnEHYy3I2 C4oO4Z2G3JpeCP+OWxRtg9hyZHWITECDMmP1dyK1wgtUvtdt2f/OE6u0bzO64TIOa9+t fxZI6skELUns5cibeWPXeAlG2JFktSb5wo/9b8IthT4e8qcafKXVgggJaQl3QiAYKwen S1ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690323689; x=1690928489; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uoqBZACiffS3PvfY6uEqr+KMqSZjH648nxXLpj9jwZw=; b=XlqNDKqAviV40V+CDnSeCRDssNSKx4FNGhCmV0jUgCWKTZ1Xr3eZ3gtBBY+EapBdBT mmewJS1xs3+r2yARj8blyDPl5ODfp/+MGZynt9u8nH0V5YAMAFgY7MfxAH3A1nbc5fb0 IrvPsbsuhRdBBa2Bdtq2fSooY1Ehmy7MHl4bcv0X7wvVPFP64RhbF/hba4vjld99jGtG uF0tTPDnRXc6Meq0eTw6JFAQ9YeWhyqJallpRT61W+NvlpZoK9YJ1o+rVqCZ2T2ywM7w dVU6WoDEpZ+sPSppOIpyfz0DOxFeveZ/ZX+iu/A+79qn/YifOzo2OmEblj8TTepanMg2 7NeQ== X-Gm-Message-State: ABy/qLYix/Em2NnBmYtPdmvRPyC82MndY8aVVDnQr/4AC19BKCXWNPXB b6wSB0BJxBg/+UJNxQShj5mOlQ9Y8DypFA== X-Google-Smtp-Source: APBJJlEVHVNLZflSAeZoJdGcOzKK9N4lBZyokxE0WZfOygjpzE9RCEqcR90yDT8tR9Rcl2ZuAlDpnQ== X-Received: by 2002:a05:6870:e74b:b0:1bb:68ce:382c with SMTP id t11-20020a056870e74b00b001bb68ce382cmr440167oak.8.1690323688770; Tue, 25 Jul 2023 15:21:28 -0700 (PDT) Received: from localhost.localdomain ([97.115.139.81]) by smtp.gmail.com with ESMTPSA id s22-20020a0568301e1600b006b9cbad68a8sm5312608otr.30.2023.07.25.15.21.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jul 2023 15:21:28 -0700 (PDT) From: Aaron Armstrong Skomra To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, benjamin.tissoires@redhat.com, jikos@kernel.org Cc: pinglinux@gmail.com, skomra@gmail.com, Joshua@Joshua-Dickens.com, jason.gerecke@wacom.com, Aaron Armstrong Skomra Subject: [PATCH Wacom EKR Battery Fixes 3/3] HID: wacom: struct name cleanup Date: Tue, 25 Jul 2023 15:21:25 -0700 Message-Id: <20230725222125.123887-1-skomra@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Aaron Armstrong Skomra Help differentiate the two remote related "serial" struct variables by renaming "wacom_remote_data" to "wacom_remote_work_data". Signed-off-by: Aaron Skomra Signed-off-by: Aaron Armstrong Skomra Reviewed-by: Jason Gerecke --- drivers/hid/wacom_sys.c | 19 ++++++++++--------- drivers/hid/wacom_wac.c | 4 ++-- drivers/hid/wacom_wac.h | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 16862f97c46c..3f704b8072e8 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -1997,7 +1997,7 @@ static int wacom_initialize_remotes(struct wacom *wacom) spin_lock_init(&remote->remote_lock); error = kfifo_alloc(&remote->remote_fifo, - 5 * sizeof(struct wacom_remote_data), + 5 * sizeof(struct wacom_remote_work_data), GFP_KERNEL); if (error) { hid_err(wacom->hdev, "failed allocating remote_fifo\n"); @@ -2660,17 +2660,18 @@ static void wacom_remote_work(struct work_struct *work) struct wacom *wacom = container_of(work, struct wacom, remote_work); struct wacom_remote *remote = wacom->remote; ktime_t kt = ktime_get(); - struct wacom_remote_data data; + struct wacom_remote_work_data remote_work_data; unsigned long flags; unsigned int count; - u32 serial; + u32 work_serial; int i; spin_lock_irqsave(&remote->remote_lock, flags); - count = kfifo_out(&remote->remote_fifo, &data, sizeof(data)); + count = kfifo_out(&remote->remote_fifo, &remote_work_data, + sizeof(remote_work_data)); - if (count != sizeof(data)) { + if (count != sizeof(remote_work_data)) { hid_err(wacom->hdev, "workitem triggered without status available\n"); spin_unlock_irqrestore(&remote->remote_lock, flags); @@ -2683,14 +2684,14 @@ static void wacom_remote_work(struct work_struct *work) spin_unlock_irqrestore(&remote->remote_lock, flags); for (i = 0; i < WACOM_MAX_REMOTES; i++) { - serial = data.remote[i].serial; - if (serial) { + work_serial = remote_work_data.remote[i].serial; + if (work_serial) { if (kt - remote->remotes[i].active_time > WACOM_REMOTE_BATTERY_TIMEOUT && remote->remotes[i].active_time != 0) wacom_remote_destroy_battery(wacom, i); - if (remote->remotes[i].serial == serial) { + if (remote->remotes[i].serial == work_serial) { wacom_remote_attach_battery(wacom, i); continue; } @@ -2698,7 +2699,7 @@ static void wacom_remote_work(struct work_struct *work) if (remote->remotes[i].serial) wacom_remote_destroy_one(wacom, i); - wacom_remote_create_one(wacom, serial, i); + wacom_remote_create_one(wacom, work_serial, i); } else if (remote->remotes[i].serial) { wacom_remote_destroy_one(wacom, i); diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index c922c1c4c78f..471db78dbbf0 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1197,14 +1197,14 @@ static void wacom_remote_status_irq(struct wacom_wac *wacom_wac, size_t len) struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); unsigned char *data = wacom_wac->data; struct wacom_remote *remote = wacom->remote; - struct wacom_remote_data remote_data; + struct wacom_remote_work_data remote_data; unsigned long flags; int i, ret; if (data[0] != WACOM_REPORT_DEVICE_LIST) return; - memset(&remote_data, 0, sizeof(struct wacom_remote_data)); + memset(&remote_data, 0, sizeof(struct wacom_remote_work_data)); for (i = 0; i < WACOM_MAX_REMOTES; i++) { int j = i * 6; diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index a10b19669947..57e185f18d53 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -328,7 +328,7 @@ struct hid_data { ktime_t time_delayed; }; -struct wacom_remote_data { +struct wacom_remote_work_data { struct { u32 serial; } remote[WACOM_MAX_REMOTES];