From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 545791DFD1; Sun, 1 Sep 2024 16:54:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725209674; cv=none; b=s3tbZUEGstUQ7R0X5yKf8nXPAtQ2b1ZSGSMG4Zxv9IUrUTTvTT/2gllCCcM3Zew+4QZ1K9m/Ld66J0mQ4Wc8hq2nK3dgHeEm15AIA7aAl193ICwGKn5s5IjI0V15yy84mqUTSDET5YsSyd1RyXfEL7tgXdWuX9uJJOl+UbLtrwM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725209674; c=relaxed/simple; bh=heviHjN1/TtsO5boUCAv1y2eh6tFlK7KBbE+Aza6TyU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pN36J/TblVLLujuQ6YNPiMUIGFvvV+HHF06jJmS871K9f8Y2RVPF4sxeI0YRMPfIyFiK6My1cgPmerfCihONL672aY15EFzaqPDTfrLA2OAplA5yH71ymTHd4AjtxuGIVcDVBhdl0NC1z/JsrJlXr6X4eyF+X7UUCCp4wUf0e+g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DQxr1BqZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DQxr1BqZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65F30C4CEC3; Sun, 1 Sep 2024 16:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725209673; bh=heviHjN1/TtsO5boUCAv1y2eh6tFlK7KBbE+Aza6TyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQxr1BqZM/Gb+E6mPq5/UMkGEc0srsolcKAJdNFgWTd5pNTt+kSzSsUNlYGqn2K/O nW2S/zGK8W7/gf6zETgzsSeufUGP4pmghKpSW31ntc6Nf3ltFAaAFCe6udMj7VlbnO FjTyMW5R1FlL19CO5eWdl7HMLVCwFT+hUyJz3KOc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jason Gerecke , Jiri Kosina Subject: [PATCH 5.10 110/151] HID: wacom: Defer calculation of resolution until resolution_code is known Date: Sun, 1 Sep 2024 18:17:50 +0200 Message-ID: <20240901160818.245782275@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240901160814.090297276@linuxfoundation.org> References: <20240901160814.090297276@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jason Gerecke commit 1b8f9c1fb464968a5b18d3acc1da8c00bad24fad upstream. The Wacom driver maps the HID_DG_TWIST usage to ABS_Z (rather than ABS_RZ) for historic reasons. When the code to support twist was introduced in commit 50066a042da5 ("HID: wacom: generic: Add support for height, tilt, and twist usages"), we were careful to write it in such a way that it had HID calculate the resolution of the twist axis assuming ABS_RZ instead (so that we would get correct angular behavior). This was broken with the introduction of commit 08a46b4190d3 ("HID: wacom: Set a default resolution for older tablets"), which moved the resolution calculation to occur *before* the adjustment from ABS_Z to ABS_RZ occurred. This commit moves the calculation of resolution after the point that we are finished setting things up for its proper use. Signed-off-by: Jason Gerecke Fixes: 08a46b4190d3 ("HID: wacom: Set a default resolution for older tablets") Cc: stable@vger.kernel.org Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman --- drivers/hid/wacom_wac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1920,12 +1920,14 @@ static void wacom_map_usage(struct input int fmax = field->logical_maximum; unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); int resolution_code = code; - int resolution = hidinput_calc_abs_res(field, resolution_code); + int resolution; if (equivalent_usage == HID_DG_TWIST) { resolution_code = ABS_RZ; } + resolution = hidinput_calc_abs_res(field, resolution_code); + if (equivalent_usage == HID_GD_X) { fmin += features->offset_left; fmax -= features->offset_right;