linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/18] Introduce and use generic parity16/32/64 helper
@ 2025-03-01 14:23 Kuan-Wei Chiu
  2025-03-01 14:23 ` [PATCH v2 01/18] lib/parity: Add __builtin_parity() fallback implementations Kuan-Wei Chiu
                   ` (17 more replies)
  0 siblings, 18 replies; 32+ messages in thread
From: Kuan-Wei Chiu @ 2025-03-01 14:23 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, x86, jk, joel, eajames,
	andrzej.hajda, neil.armstrong, rfoss, maarten.lankhorst, mripard,
	tzimmermann, airlied, simona, dmitry.torokhov, mchehab, awalls,
	hverkuil, miquel.raynal, richard, vigneshr, louis.peens,
	andrew+netdev, davem, edumazet, pabeni, parthiban.veerasooran,
	arend.vanspriel, johannes, gregkh, jirislaby, yury.norov, akpm
  Cc: hpa, alistair, linux, Laurent.pinchart, jonas, jernej.skrabec,
	kuba, linux-kernel, linux-fsi, dri-devel, linux-input,
	linux-media, linux-mtd, oss-drivers, netdev, linux-wireless,
	brcm80211, brcm80211-dev-list.pdl, linux-serial, bpf, jserv,
	david.laight.linux, andrew.cooper3, Kuan-Wei Chiu, Yu-Chun Lin

Several parts of the kernel contain redundant implementations of parity
calculations for 16/32/64-bit values. Introduces generic
parity16/32/64() helpers in bitops.h, providing a standardized
and optimized implementation.  

Subsequent patches refactor various kernel components to replace
open-coded parity calculations with the new helpers, reducing code
duplication and improving maintainability.

Co-developed-by: Yu-Chun Lin <eleanor15x@gmail.com>
Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---

This patch series is based on next-20250228.

Changes in v2:
- Provide fallback functions for __builtin_parity() when the compiler
  decides not to inline it
- Use __builtin_parity() when no architecture-specific implementation
  is available
- Optimize for constant folding when val is a compile-time constant
- Add a generic parity() macro
- Drop the x86 bootflag conversion patch since it has been merged into
  the tip tree

Kuan-Wei Chiu (18):
  lib/parity: Add __builtin_parity() fallback implementations
  bitops: Optimize parity8() using __builtin_parity()
  bitops: Add parity16(), parity32(), and parity64() helpers
  media: media/test_drivers: Replace open-coded parity calculation with
    parity8()
  media: pci: cx18-av-vbi: Replace open-coded parity calculation with
    parity8()
  media: saa7115: Replace open-coded parity calculation with parity8()
  serial: max3100: Replace open-coded parity calculation with parity8()
  lib/bch: Replace open-coded parity calculation with parity32()
  Input: joystick - Replace open-coded parity calculation with
    parity32()
  net: ethernet: oa_tc6: Replace open-coded parity calculation with
    parity32()
  wifi: brcm80211: Replace open-coded parity calculation with parity32()
  drm/bridge: dw-hdmi: Replace open-coded parity calculation with
    parity32()
  mtd: ssfdc: Replace open-coded parity calculation with parity32()
  fsi: i2cr: Replace open-coded parity calculation with parity32()
  fsi: i2cr: Replace open-coded parity calculation with parity64()
  Input: joystick - Replace open-coded parity calculation with
    parity64()
  nfp: bpf: Replace open-coded parity calculation with parity64()
  bitops: Add parity() macro for automatic type-based selection

 drivers/fsi/fsi-master-i2cr.c                 |  18 +--
 .../drm/bridge/synopsys/dw-hdmi-ahb-audio.c   |   8 +-
 drivers/input/joystick/grip_mp.c              |  17 +--
 drivers/input/joystick/sidewinder.c           |  24 +---
 drivers/media/i2c/saa7115.c                   |  12 +-
 drivers/media/pci/cx18/cx18-av-vbi.c          |  12 +-
 .../media/test-drivers/vivid/vivid-vbi-gen.c  |   8 +-
 drivers/mtd/ssfdc.c                           |  17 +--
 drivers/net/ethernet/netronome/nfp/nfp_asm.c  |   7 +-
 drivers/net/ethernet/oa_tc6.c                 |  19 +--
 .../broadcom/brcm80211/brcmsmac/dma.c         |  16 +--
 drivers/tty/serial/max3100.c                  |   3 +-
 include/linux/bitops.h                        | 115 ++++++++++++++++--
 lib/Makefile                                  |   2 +-
 lib/bch.c                                     |  14 +--
 lib/parity.c                                  |  48 ++++++++
 16 files changed, 185 insertions(+), 155 deletions(-)
 create mode 100644 lib/parity.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2025-03-05 16:20 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-01 14:23 [PATCH v2 00/18] Introduce and use generic parity16/32/64 helper Kuan-Wei Chiu
2025-03-01 14:23 ` [PATCH v2 01/18] lib/parity: Add __builtin_parity() fallback implementations Kuan-Wei Chiu
2025-03-02  3:10   ` Yury Norov
2025-03-02  8:20     ` Kuan-Wei Chiu
2025-03-02 16:02       ` Yury Norov
2025-03-02 17:29         ` Kuan-Wei Chiu
2025-03-02 19:09           ` David Laight
2025-03-03  2:47             ` Kuan-Wei Chiu
2025-03-03 12:41               ` David Laight
2025-03-03 15:43               ` Yury Norov
2025-03-03 16:54                 ` Kuan-Wei Chiu
2025-03-03 15:25             ` Yury Norov
2025-03-03 15:15           ` Yury Norov
2025-03-03 19:37             ` David Laight
2025-03-01 14:23 ` [PATCH v2 02/18] bitops: Optimize parity8() using __builtin_parity() Kuan-Wei Chiu
2025-03-01 14:23 ` [PATCH v2 03/18] bitops: Add parity16(), parity32(), and parity64() helpers Kuan-Wei Chiu
2025-03-05 16:20   ` Simon Horman
2025-03-01 14:23 ` [PATCH v2 04/18] media: media/test_drivers: Replace open-coded parity calculation with parity8() Kuan-Wei Chiu
2025-03-01 14:23 ` [PATCH v2 05/18] media: pci: cx18-av-vbi: " Kuan-Wei Chiu
2025-03-01 14:23 ` [PATCH v2 06/18] media: saa7115: " Kuan-Wei Chiu
2025-03-01 14:23 ` [PATCH v2 07/18] serial: max3100: " Kuan-Wei Chiu
2025-03-01 14:23 ` [PATCH v2 08/18] lib/bch: Replace open-coded parity calculation with parity32() Kuan-Wei Chiu
2025-03-01 14:24 ` [PATCH v2 09/18] Input: joystick - " Kuan-Wei Chiu
2025-03-01 14:24 ` [PATCH v2 10/18] net: ethernet: oa_tc6: " Kuan-Wei Chiu
2025-03-01 14:24 ` [PATCH v2 11/18] wifi: brcm80211: " Kuan-Wei Chiu
2025-03-01 14:24 ` [PATCH v2 12/18] drm/bridge: dw-hdmi: " Kuan-Wei Chiu
2025-03-01 14:24 ` [PATCH v2 13/18] mtd: ssfdc: " Kuan-Wei Chiu
2025-03-01 14:24 ` [PATCH v2 14/18] fsi: i2cr: " Kuan-Wei Chiu
2025-03-01 14:24 ` [PATCH v2 15/18] fsi: i2cr: Replace open-coded parity calculation with parity64() Kuan-Wei Chiu
2025-03-01 14:24 ` [PATCH v2 16/18] Input: joystick - " Kuan-Wei Chiu
2025-03-01 14:24 ` [PATCH v2 17/18] nfp: bpf: " Kuan-Wei Chiu
2025-03-01 14:24 ` [PATCH v2 18/18] bitops: Add parity() macro for automatic type-based selection Kuan-Wei Chiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).