From patchwork Sun Feb 23 16:42:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13987129 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F83CC021B3 for ; Sun, 23 Feb 2025 16:43:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EACCF10E055; Sun, 23 Feb 2025 16:43:46 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XL2xbm+V"; dkim-atps=neutral Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2D1610E055 for ; Sun, 23 Feb 2025 16:43:45 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2fc042c9290so5702427a91.0 for ; Sun, 23 Feb 2025 08:43:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740329025; x=1740933825; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r0Ho2aCKNYfg5T/o22fFzxZ+UyjSx6Fm0wn6W8o8Gr8=; b=XL2xbm+VDwc+B4ldZadJzzeshIWG71YfoYWUJ6/9BKV3uLCgtMhWjIj3xmeDJHYXVs EvwOwbA1V01lBtOKb4IEvuX15Q4EYXpm6pca7yxHIuq2zgHhtRXkeAjwv3Kpyg5cQOY/ mE0+Dp72ttO2r8PnMtC+MKmpjqOR8eBaQ2fpvP8d7gmNJK+hi6STWvjxJ0kzfh4xMjQ7 1m/s59lEpTYjA4IFTdL+GLVcMbU8yuRI1BOurXr6eQ699yoIlgdAhcGRMLM9kU2s+75l ChlEnwykv4c5N/4O6C3ePMABPAT2Rkk/0Z3eUGlhGw735bMBn89gohFcta7NVcYAZeuG R4kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740329025; x=1740933825; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r0Ho2aCKNYfg5T/o22fFzxZ+UyjSx6Fm0wn6W8o8Gr8=; b=v0oVSpD1fy6B/J9tj0vj93G9SRaq+piUsATRyPgjPYk56AWapZIa/YF2gviRHRIznF gt6LLs8Fr8cuCJC08DHbFIDajAvRGKj/9H181HaglBQCRwssSU63NGak8rfYiOoubOkD KryzBCmpaTX9K/DPocQbgUbUS8sUriIqmSaPGnhvbZNp54BO8M/BIeD9UoCSDdqqikcT Rz9fBthjahg712ictCAklIZeU9B4RbRWe6mMOXhVZmT/kRnLH5VGTbkbAIxgzYCFGg4c WCQWFBcl7EJcxYR+8NSRuGQWd9nKTO1AyTFJPZpYbB2xDNaUSDPra0cUbtR+3mYbHD+y vWQQ== X-Forwarded-Encrypted: i=1; AJvYcCUQlqfYqjt4/W0tt9HGeArf75wUjkRnLdrrIzcQrvz/lTbE252wN9kGdOMc1mtmisopYzUiBaaVspU=@lists.freedesktop.org X-Gm-Message-State: AOJu0YyAOCxBWjV1W/rGKni9ZzR6u+Hr+BbmSXkGfMlG3eXDcZVhjDf0 0xUfICHjkXzekoCIcYlEDlNtRvyhQyBHfu+W+hjBdFrVH9k7l6wC X-Gm-Gg: ASbGncvbenuVWZIf2mkvwkTWsrH7OKzxJZVjzZ0xEgf0cqXSMDjDOpeQ+d0iCX1kUbs csHuFQEFTubl7hgu6C2tS2i8KmvkrS1zh4Pl8jKADBs3I3zgQIWnAc/VTvlqAqx5dGndoyA14wC l4IhWDvyuT0TInqfZLBNcTBOPLbLkazR0FLht/vOTjeP9btyJMmWC27xKUHSIJwKcsCtQgwgKl/ orCG/A7paJAKc7evBHNsxfNVwfb9IHGuinaVCzod+sFkCnt59zgmOdJ5z8mYtVjtOY9gGu5/8/I H68dG0bi5Ns/bqyeSvP+K5IrOFLkfZuUEzPsJiK7Lbu20JEjsp/a0OpO X-Google-Smtp-Source: AGHT+IGVq/VDL8yFNkkrNqMmhpwnPeH21AgiBV1Ypn8QzIpzc6gLajBMUvDiltb0IdO3Sbiytrzwqg== X-Received: by 2002:a17:90b:2e0d:b0:2f2:ab09:c256 with SMTP id 98e67ed59e1d1-2fce7b07205mr19070739a91.33.1740329025494; Sun, 23 Feb 2025 08:43:45 -0800 (PST) Received: from visitorckw-System-Product-Name.. ([140.113.216.168]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fceb09f6e0sm4935080a91.44.2025.02.23.08.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2025 08:43:45 -0800 (PST) From: Kuan-Wei Chiu To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, jk@ozlabs.org, joel@jms.id.au, eajames@linux.ibm.com, andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, dmitry.torokhov@gmail.com, mchehab@kernel.org, awalls@md.metrocast.net, hverkuil@xs4all.nl, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, louis.peens@corigine.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, parthiban.veerasooran@microchip.com, arend.vanspriel@broadcom.com, johannes@sipsolutions.net, gregkh@linuxfoundation.org, jirislaby@kernel.org, yury.norov@gmail.com, akpm@linux-foundation.org Cc: hpa@zytor.com, alistair@popple.id.au, linux@rasmusvillemoes.dk, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-fsi@lists.ozlabs.org, dri-devel@lists.freedesktop.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org, linux-mtd@lists.infradead.org, oss-drivers@corigine.com, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com, linux-serial@vger.kernel.org, bpf@vger.kernel.org, jserv@ccns.ncku.edu.tw, Kuan-Wei Chiu , Yu-Chun Lin Subject: [PATCH 05/17] media: pci: cx18-av-vbi: Replace open-coded parity calculation with parity8() Date: Mon, 24 Feb 2025 00:42:05 +0800 Message-Id: <20250223164217.2139331-6-visitorckw@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250223164217.2139331-1-visitorckw@gmail.com> References: <20250223164217.2139331-1-visitorckw@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Refactor parity calculations to use the standard parity8() helper. This change eliminates redundant implementations and improves code efficiency. Co-developed-by: Yu-Chun Lin Signed-off-by: Yu-Chun Lin Signed-off-by: Kuan-Wei Chiu --- drivers/media/pci/cx18/cx18-av-vbi.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-av-vbi.c b/drivers/media/pci/cx18/cx18-av-vbi.c index 65281d40c681..1a113aad9cd4 100644 --- a/drivers/media/pci/cx18/cx18-av-vbi.c +++ b/drivers/media/pci/cx18/cx18-av-vbi.c @@ -8,6 +8,7 @@ */ +#include #include "cx18-driver.h" /* @@ -56,15 +57,6 @@ struct vbi_anc_data { /* u8 fill[]; Variable number of fill bytes */ }; -static int odd_parity(u8 c) -{ - c ^= (c >> 4); - c ^= (c >> 2); - c ^= (c >> 1); - - return c & 1; -} - static int decode_vps(u8 *dst, u8 *p) { static const u8 biphase_tbl[] = { @@ -278,7 +270,7 @@ int cx18_av_decode_vbi_line(struct v4l2_subdev *sd, break; case 6: sdid = V4L2_SLICED_CAPTION_525; - err = !odd_parity(p[0]) || !odd_parity(p[1]); + err = !parity8(p[0]) || !parity8(p[1]); break; case 9: sdid = V4L2_SLICED_VPS; From patchwork Sun Feb 23 16:42:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13987130 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0A56C021B2 for ; Sun, 23 Feb 2025 16:44:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 661AC10E05A; Sun, 23 Feb 2025 16:44:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="el5ymoDF"; dkim-atps=neutral Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id 95A7310E05A for ; Sun, 23 Feb 2025 16:44:31 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-220d601886fso53248965ad.1 for ; Sun, 23 Feb 2025 08:44:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740329071; x=1740933871; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U4Bkihj4DGACHQctYAnhtp6nEz1RGAPDBfirVsTzUzk=; b=el5ymoDFRELkI5LqS3GxRO9eBrqMfw+Ti2qkBPhlMxTGbuHwpNAWry7s0cJVqW1e3h 8IzRRI3RESFV65Gfq6BdUIfVULN/SpGaobS0UtVq4nNw9eu2LQlFwRnMI+JPNaxkiEnS CQWXL/7hijjY3UPfnG+MC8YsRbjx8oeEY3ZIBTU9xg2Arcx7oQXtSM3n9EV4ONo8/IvS 2topLNorjUzyzzPVOExHlgZ4GzGm/TpsCUx7Wk1rY2m92LqkhP+I75dzTuQZwrpVk2+V Je4H7v+ukFhEScVeCi3LlQvR2yO6WV4I/2WpaUAuPPGb/eQFmyFRVF4Ov0GUksTJ4rCh urIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740329071; x=1740933871; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U4Bkihj4DGACHQctYAnhtp6nEz1RGAPDBfirVsTzUzk=; b=GN0jfVRfDYykFpGCGUuj9HyCPBiffRT7Ls+oJMKPTEi4+CK3HHHK08uW34a38sWmPT d9GBs+gL+FzKX+t5pyBhJd5G9dkG6wkNFHMUsgbZnm7tCCSw2BDoWgBs76X4NJ4ygw/W bx0BRWWSBYWOqWvDnWufTZz8LNTm/GZ+I1Kv5QQkevld0m2yK2NrOKPyUMcOTBjfaBkq ZrnTQj+BlPxFe55WM+edG3dJvai0Th1fFRO2cU1No2+ThX11ieaCXpNyvdCaVhg+p9h1 +6xQeIi/POW4793yIJaJOoKGYo2PZ0EzmVBDG6bxsUsSdoDXU2IP0b1fFVogJLE2872e J9og== X-Forwarded-Encrypted: i=1; AJvYcCWBPWzNmSTT7xmqte74GoIVP1CMptPSVwahZrHDxcYkb4kyIt9xa/ZFW0JhNeBGfo7yww4YVtLMZFM=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yzbh2KmIbGTqPXgdOfWdTqH6hSlb8RiDiyh4jEDzzzU0C0nq7v6 w/xNlREfOkgJMjMO40Wf6l3VwiCiyxf51UA2DtvN7PoAsB2NenUR X-Gm-Gg: ASbGnctdd6CM+UA16WyN7+jInqrhsQ93l3MkBbMZ8zBKEWlor9nE7fu0w70kRCNIArV M+cSqvvuennYjpJxvkOwTZAI3ITAQYZFBBUvqC1wcroGBWMTE4Gx5ibmfqC+WT+aBQI5W9vs8Ej byPEuKfh6zlKlRvgYfjswGaRZi8tiDwoWgB0Fu/ouSd2UgOguSZIK0aCEAPGTku8peix7R/9apW aiGIQF9a06OquH+HqZQjyZlm38vvjeWhBY/BW4tv8qFxqGRBnuYH4iV5eBR+AQKSsFDCicVtJT4 4DBAumV+20q4DGHtATF+DSyyS2dN3N327uATn1FC1MPeJ3RiJKo7dkIP X-Google-Smtp-Source: AGHT+IFqMPtN+gPmr77Z5+UXqcepcxQO5H8AaDoUEcywHGCumZ53dM6PMFmuD7xMrlzO6YmaaybKmg== X-Received: by 2002:a17:903:2286:b0:220:cd9f:a186 with SMTP id d9443c01a7336-2219fdc2dfcmr186405365ad.0.1740329071014; Sun, 23 Feb 2025 08:44:31 -0800 (PST) Received: from visitorckw-System-Product-Name.. ([140.113.216.168]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fceb09f6e0sm4935080a91.44.2025.02.23.08.44.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2025 08:44:30 -0800 (PST) From: Kuan-Wei Chiu To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, jk@ozlabs.org, joel@jms.id.au, eajames@linux.ibm.com, andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, dmitry.torokhov@gmail.com, mchehab@kernel.org, awalls@md.metrocast.net, hverkuil@xs4all.nl, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, louis.peens@corigine.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, parthiban.veerasooran@microchip.com, arend.vanspriel@broadcom.com, johannes@sipsolutions.net, gregkh@linuxfoundation.org, jirislaby@kernel.org, yury.norov@gmail.com, akpm@linux-foundation.org Cc: hpa@zytor.com, alistair@popple.id.au, linux@rasmusvillemoes.dk, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-fsi@lists.ozlabs.org, dri-devel@lists.freedesktop.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org, linux-mtd@lists.infradead.org, oss-drivers@corigine.com, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com, linux-serial@vger.kernel.org, bpf@vger.kernel.org, jserv@ccns.ncku.edu.tw, Kuan-Wei Chiu , Yu-Chun Lin Subject: [PATCH 09/17] Input: joystick - Replace open-coded parity calculation with parity32() Date: Mon, 24 Feb 2025 00:42:09 +0800 Message-Id: <20250223164217.2139331-10-visitorckw@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250223164217.2139331-1-visitorckw@gmail.com> References: <20250223164217.2139331-1-visitorckw@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Refactor parity calculations to use the standard parity32() helper. This change eliminates redundant implementations and improves code efficiency. Co-developed-by: Yu-Chun Lin Signed-off-by: Yu-Chun Lin Signed-off-by: Kuan-Wei Chiu --- drivers/input/joystick/grip_mp.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c index 5eadb5a3ca37..897ce13753dc 100644 --- a/drivers/input/joystick/grip_mp.c +++ b/drivers/input/joystick/grip_mp.c @@ -18,6 +18,7 @@ #include #include #include +#include #define DRIVER_DESC "Gravis Grip Multiport driver" @@ -112,20 +113,6 @@ static const int axis_map[] = { 5, 9, 1, 5, 6, 10, 2, 6, 4, 8, 0, 4, 5, 9, 1, 5 static int register_slot(int i, struct grip_mp *grip); -/* - * Returns whether an odd or even number of bits are on in pkt. - */ - -static int bit_parity(u32 pkt) -{ - int x = pkt ^ (pkt >> 16); - x ^= x >> 8; - x ^= x >> 4; - x ^= x >> 2; - x ^= x >> 1; - return x & 1; -} - /* * Poll gameport; return true if all bits set in 'onbits' are on and * all bits set in 'offbits' are off. @@ -236,7 +223,7 @@ static int mp_io(struct gameport* gameport, int sendflags, int sendcode, u32 *pa pkt = (pkt >> 2) | 0xf0000000; } - if (bit_parity(pkt) == 1) + if (parity32(pkt) == 1) return IO_RESET; /* Acknowledge packet receipt */ From patchwork Sun Feb 23 16:42:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13987131 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D97BC021B2 for ; Sun, 23 Feb 2025 16:44:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A26D10E071; Sun, 23 Feb 2025 16:44:55 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aO2nzj6K"; dkim-atps=neutral Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 16B8810E071 for ; Sun, 23 Feb 2025 16:44:54 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-2fc291f7ddbso5850802a91.1 for ; Sun, 23 Feb 2025 08:44:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740329093; x=1740933893; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0/rM0c8KAofiqOH9E+BbTStqrJdKUl6Z4Ta9tU7voiA=; b=aO2nzj6KFMhHjfKheGWJTyTMqhZ4QM/cf65DMz/Gi79ol5sNjZCG6dOQz57RxogywL QITPX6BX/7U1ZaSuOmQNvrONq57+GfN0BVqxZVeKQhNQ51VP3xVVQ1v1kRZhll3nwTWw mTlGMBJsMlPrZVu/35w7Nip4s17imPEcfS8VPvY8oEDpyyzRwDy6KTnf1psS2b9Hqj2N zsyC8ZF4ZjBh8ouJm6gjf7/wETyMsIlR971iuJhHhLx5XYCITnj2+xx1nWdo0saId42z udQnOkdOYUG/NjnhwIWxNUK8BJKSKhZ7qscsxPTIyhwYee9aj28h3cogJ2vk2QQQa1Xe Rupw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740329093; x=1740933893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0/rM0c8KAofiqOH9E+BbTStqrJdKUl6Z4Ta9tU7voiA=; b=uMv/F1Gbm3bFThOQ2bY5vLzkJbGdbzBnX8d4Wc928//Ir7iJ+02EQCOB6AQrOailqb RTTO8xVIwFmAy5QUQt1Rsyep0rmhs0J9YfuTigS+v3gL+PcPatvyHksKqmwfRVhsuJj7 4BoDdiY32ASpJHILwaSkSw5Vp+GI4IVbXJejnZ27eZQGrK9oYbpk+2wgIkaRfWWBVwit j3xk08iw+1wbcZZCoLAFLjMVLEFECQJABt2je/iNp9gdnnKp4Cptt+9PxG7zptashMMZ VPw35Y7u4uqXB8JR9yGyMoPCJHVZqMQHwtGc2K/uBGETMF7KCzAwy+XlL5QqQuWZAcqg VNMg== X-Forwarded-Encrypted: i=1; AJvYcCVBrkcz9V4fkTX5xuL60aKz2Z4BdSrd5VOquzgY8sJ4VExULjfpuVWHihGoNshA+MDINpWN+wkV0/8=@lists.freedesktop.org X-Gm-Message-State: AOJu0YznwRYU59Otwj11Ll7RrGDNFu4RY9JxeiYMnWHGEBsk62JA4u3w XIwjb4s8khDLdHQSqTNF2DpcHiubntB8LF/iXAwKNDMASid+sLIx X-Gm-Gg: ASbGncu18gIgMhBJQw03iErEXAWha4f2QQ0N7SbIjpdlo+gsLsi60fbgvDP08B7tttH jfbXdwvQnA+VRQtJUpb1nzxPXYL0R9FKERAoimHl6IXSWq1jQjgpV8Uoshm77p7VzcUs3K1JPvn hzfCtYgt5yM9j0MticzCr43K9yFgMTN/mhzM/PFRrPWa3SE+hIKAL0LRPWtdv/C05T/JxnewdEL k86GOC/JC8HdeJ0hky9kHcF6vj9TYr69cViARtn55TkJOueL2GACTFl831gN1YHK5PZBqApMgcO +NP/VCKJYwf6mOlWLp8dNBJ4CoQx/iTOmEafKZX1Ge7DciMDsMNK9D1c X-Google-Smtp-Source: AGHT+IFyGSvrJM271swgjLlCi2TwHZU6y12ME2N9/TuoQb9IugR13IQRKyCWyxRNE+S6ruhpAiUUqQ== X-Received: by 2002:a17:90b:2b8f:b0:2ea:3f34:f194 with SMTP id 98e67ed59e1d1-2fce78aab09mr18428370a91.10.1740329093592; Sun, 23 Feb 2025 08:44:53 -0800 (PST) Received: from visitorckw-System-Product-Name.. ([140.113.216.168]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fceb09f6e0sm4935080a91.44.2025.02.23.08.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2025 08:44:53 -0800 (PST) From: Kuan-Wei Chiu To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, jk@ozlabs.org, joel@jms.id.au, eajames@linux.ibm.com, andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, dmitry.torokhov@gmail.com, mchehab@kernel.org, awalls@md.metrocast.net, hverkuil@xs4all.nl, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, louis.peens@corigine.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, parthiban.veerasooran@microchip.com, arend.vanspriel@broadcom.com, johannes@sipsolutions.net, gregkh@linuxfoundation.org, jirislaby@kernel.org, yury.norov@gmail.com, akpm@linux-foundation.org Cc: hpa@zytor.com, alistair@popple.id.au, linux@rasmusvillemoes.dk, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-fsi@lists.ozlabs.org, dri-devel@lists.freedesktop.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org, linux-mtd@lists.infradead.org, oss-drivers@corigine.com, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com, linux-serial@vger.kernel.org, bpf@vger.kernel.org, jserv@ccns.ncku.edu.tw, Kuan-Wei Chiu , Yu-Chun Lin Subject: [PATCH 11/17] wifi: brcm80211: Replace open-coded parity calculation with parity32() Date: Mon, 24 Feb 2025 00:42:11 +0800 Message-Id: <20250223164217.2139331-12-visitorckw@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250223164217.2139331-1-visitorckw@gmail.com> References: <20250223164217.2139331-1-visitorckw@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Refactor parity calculations to use the standard parity32() helper. This change eliminates redundant implementations and improves code efficiency. Co-developed-by: Yu-Chun Lin Signed-off-by: Yu-Chun Lin Signed-off-by: Kuan-Wei Chiu --- .../wireless/broadcom/brcm80211/brcmsmac/dma.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c index 80c35027787a..d1a1ecd97d42 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -283,21 +284,6 @@ struct dma_info { bool aligndesc_4k; }; -/* Check for odd number of 1's */ -static u32 parity32(__le32 data) -{ - /* no swap needed for counting 1's */ - u32 par_data = *(u32 *)&data; - - par_data ^= par_data >> 16; - par_data ^= par_data >> 8; - par_data ^= par_data >> 4; - par_data ^= par_data >> 2; - par_data ^= par_data >> 1; - - return par_data & 1; -} - static bool dma64_dd_parity(struct dma64desc *dd) { return parity32(dd->addrlow ^ dd->addrhigh ^ dd->ctrl1 ^ dd->ctrl2); From patchwork Sun Feb 23 16:42:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuan-Wei Chiu X-Patchwork-Id: 13987132 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27F01C021B3 for ; Sun, 23 Feb 2025 16:46:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8FE2710E09E; Sun, 23 Feb 2025 16:45:59 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Uhpv28+7"; dkim-atps=neutral Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8849610E09E for ; Sun, 23 Feb 2025 16:45:58 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-2fa48404207so7516116a91.1 for ; Sun, 23 Feb 2025 08:45:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740329158; x=1740933958; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nzBrmzWckDIJwY51QBb0mQJ5Dqo6Ldx+jMH0V0Ck8/w=; b=Uhpv28+7t4cQOaqRfEer2hW2ItYDkHd592wG0vYIFngBHpF+oWJhdxeit7KKqDQY20 imS5Yd0HtJ/+ptr1d6LSNlhMAruqHTS6G20Zyq5Fjr5E2AOqOHxw8Fo8L/wb+aqveqtF NRzc6gDXy2Dh/ILWsGHTCnCX3Ts0UDahOfgl6yo3IAvP52zV/e74tB4Zbaumov7wDmNL 9lRrCdXDS4yAKgkv056u4Qhrttp1KuuQTeoeIrNltS9O05moCkVkBrjSfsVM/MmAhYlV dY1PL1HZO1qP9JCqclI4b8vsdc3INfKRW9hiZQUEBIYDXsuIOjap6trqpH655fJhVyQJ udgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740329158; x=1740933958; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nzBrmzWckDIJwY51QBb0mQJ5Dqo6Ldx+jMH0V0Ck8/w=; b=N6m2R8bs5QBfIbjyrJzo+3vyESLGZ4MvstRJitZ2NHAi73rTY7FmrCQF8EzMU4iO7w getmNbGryU3Th4YYnGUKsLLG01L4OJQsm1xTajZ2TZi8hA50/tyzDXTalpbJO/bGBukM jrKGTQRjuGf/TADmepQsVYnX1ubofatPeKP32wizb1m2pEIm7zaQhVaTRBYsKxO7edop E0fBbhLp7/5dNnRAa4xip9aDZiuDvU3FDI+JmvO/aozEN00W4j6zhxuSxuPAag/xotpx CRTs6vT9VYWeqnuUCmqt8DhiaeLCqslFwb1xpXJ3g+jYYdSwIuf7qOx3MPLm+MkAcdpV 77vQ== X-Forwarded-Encrypted: i=1; AJvYcCUWDNZVUVCshdss8t+4WbW5rssd0Jn+8i4H0TBu69IKDoqMNAeUueDkNyO6AJu1CsE0TvpKNrJbp0Q=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yz9T08uIxbqtacBgYdYeJ8V915fpcGfzgpgPKlM3WVjkyp/MYjP 8lTpg6w2DxfM6+FYTsV3KbUcyr0R73ht4k6Aee72SkL6JLd/bg5z X-Gm-Gg: ASbGncu+cdCjn2hAJYLj18hv+3opKqUR91ffIOoqZ1coMsQo/dPNOF6Kl3S3HRXDBXM lLfhEhCQmmNpkcj1RdLx9+lnZ88BDpCH9vsXAxWGi+vqJQJwdd5e1akrAH2X0V09BaBwzBZTZqi wSi+mD6x2srKz+5fEqOfigxbxEo3TGerkz6a9xazzkv5ZCRK2F1hWX68FdCXuGxwR6zRJf1mdq6 wNGRKbrF9KfNUwtwuqo4/ljug7Sny7T+6X+n8EtkqMFXFnEFv+Wy6ZDMWOW4/Bi36GfhW5Zqm8X DXPqt8XRUI28V9MMVPhIh7CbLx81aILd1spiFKoXSZekGZuQJjwWBGhV X-Google-Smtp-Source: AGHT+IF16AG7QV3yDJH/B6gDeFm18hoNJMWrJMQH/o1eQGkDQfNTajRN2mVaQtR8BSlGLJjsCZspog== X-Received: by 2002:a17:90b:2e44:b0:2f5:63a:44f9 with SMTP id 98e67ed59e1d1-2fce7b0acaamr15082851a91.23.1740329158110; Sun, 23 Feb 2025 08:45:58 -0800 (PST) Received: from visitorckw-System-Product-Name.. ([140.113.216.168]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fceb09f6e0sm4935080a91.44.2025.02.23.08.45.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2025 08:45:57 -0800 (PST) From: Kuan-Wei Chiu To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, jk@ozlabs.org, joel@jms.id.au, eajames@linux.ibm.com, andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, dmitry.torokhov@gmail.com, mchehab@kernel.org, awalls@md.metrocast.net, hverkuil@xs4all.nl, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, louis.peens@corigine.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, parthiban.veerasooran@microchip.com, arend.vanspriel@broadcom.com, johannes@sipsolutions.net, gregkh@linuxfoundation.org, jirislaby@kernel.org, yury.norov@gmail.com, akpm@linux-foundation.org Cc: hpa@zytor.com, alistair@popple.id.au, linux@rasmusvillemoes.dk, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-fsi@lists.ozlabs.org, dri-devel@lists.freedesktop.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org, linux-mtd@lists.infradead.org, oss-drivers@corigine.com, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com, linux-serial@vger.kernel.org, bpf@vger.kernel.org, jserv@ccns.ncku.edu.tw, Kuan-Wei Chiu , Yu-Chun Lin Subject: [PATCH 17/17] nfp: bpf: Replace open-coded parity calculation with parity64() Date: Mon, 24 Feb 2025 00:42:17 +0800 Message-Id: <20250223164217.2139331-18-visitorckw@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250223164217.2139331-1-visitorckw@gmail.com> References: <20250223164217.2139331-1-visitorckw@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Refactor parity calculations to use the standard parity64() helper. This change eliminates redundant implementations and improves code efficiency. Co-developed-by: Yu-Chun Lin Signed-off-by: Yu-Chun Lin Signed-off-by: Kuan-Wei Chiu --- drivers/net/ethernet/netronome/nfp/nfp_asm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_asm.c b/drivers/net/ethernet/netronome/nfp/nfp_asm.c index 154399c5453f..3646f84a6e8c 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_asm.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_asm.c @@ -295,11 +295,6 @@ static const u64 nfp_ustore_ecc_polynomials[NFP_USTORE_ECC_POLY_WORDS] = { 0x0daf69a46910ULL, }; -static bool parity(u64 value) -{ - return hweight64(value) & 1; -} - int nfp_ustore_check_valid_no_ecc(u64 insn) { if (insn & ~GENMASK_ULL(NFP_USTORE_OP_BITS, 0)) @@ -314,7 +309,7 @@ u64 nfp_ustore_calc_ecc_insn(u64 insn) int i; for (i = 0; i < NFP_USTORE_ECC_POLY_WORDS; i++) - ecc |= parity(nfp_ustore_ecc_polynomials[i] & insn) << i; + ecc |= parity64(nfp_ustore_ecc_polynomials[i] & insn) << i; return insn | (u64)ecc << NFP_USTORE_OP_BITS; }