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 770342571AC; Thu, 17 Apr 2025 18:27:05 +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=1744914425; cv=none; b=IccvQ5Un0TVm0kYpwD97qHqmanJYz1ASnIM0FXo47gdgzK9Vtv7EJT8K00Oq41pAZUIcRAcVM33oItgTgyUKDD4SonPKP9PeGqQXxa865h0Iv8LeaoQhgn4i6zpdudmbeYRIAsOuQR29yF68IJgb21f4wMzemrcuhEIdlLlDpEs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744914425; c=relaxed/simple; bh=t1qHJ3NpPGVuVz9DdI4VVa4n6sJGqlu6eBVkFwS7bog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q5x1yct++5FvYSJL7eJejUvor+a6I/d0tHEr5e7Qarw2gGaA5qHDCAa5TmxkWhddNSvMh1WQAPVI9bjS7goX5f0jRAmn4ELuMD/0kvJKaot1Rgjt6r1Pm12/1X+Br1RnAzGXaNnb2alDnXiIMNJBkjAwEk5yeOTSTMo5WmungU4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f7mpZxr7; 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="f7mpZxr7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B5B4C4CEE4; Thu, 17 Apr 2025 18:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744914424; bh=t1qHJ3NpPGVuVz9DdI4VVa4n6sJGqlu6eBVkFwS7bog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f7mpZxr7L+WLij9M/Ws+riYtM+GUmvSjcHZxDh6Mp/6kk3iQCqTyjGEomeeVIdDyC GSB8+mwdlL1oKW3aXc0s6zUaeCKtfYYo/s/8XX4LfREDIEyU3GN+Q2+pLXH1zsXyT5 IvKHny1kJY87Kmot5QezLfQGBRrESDx/WmFLHVxQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Tomasz=20Paku=C5=82a?= , =?UTF-8?q?Micha=C5=82=20Kope=C4=87?= , Paul Dino Jones , =?UTF-8?q?Crist=C3=B3ferson=20Bueno?= , Pablo Cisneros , Jiri Kosina , Sasha Levin Subject: [PATCH 6.13 182/414] HID: pidff: Simplify pidff_rescale_signed Date: Thu, 17 Apr 2025 19:49:00 +0200 Message-ID: <20250417175118.771418526@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250417175111.386381660@linuxfoundation.org> References: <20250417175111.386381660@linuxfoundation.org> User-Agent: quilt/0.68 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tomasz Pakuła [ Upstream commit 4eb9c2ee538b62dc5dcae192297c3a4044b7ade5 ] This function overrelies on ternary operators and makes it hard to parse it mentally. New version makes it very easy to understand. Signed-off-by: Tomasz Pakuła Reviewed-by: Michał Kopeć Reviewed-by: Paul Dino Jones Tested-by: Paul Dino Jones Tested-by: Cristóferson Bueno Tested-by: Pablo Cisneros Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/usbhid/hid-pidff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index a8eaa77e80be3..8083eb7684e5e 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c @@ -230,9 +230,9 @@ static int pidff_rescale(int i, int max, struct hid_field *field) */ static int pidff_rescale_signed(int i, struct hid_field *field) { - return i == 0 ? 0 : i > - 0 ? i * field->logical_maximum / 0x7fff : i * - field->logical_minimum / -0x8000; + if (i > 0) return i * field->logical_maximum / 0x7fff; + if (i < 0) return i * field->logical_minimum / -0x8000; + return 0; } /* -- 2.39.5