mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-renesas-soc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org,
	Yury Norov <yury.norov@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [RFC PATCH 1/2] bitops: add generic parity calculation for u8
Date: Sat, 14 Dec 2024 06:30:11 -0800	[thread overview]
Message-ID: <2e8e63f2-3a1b-4ca4-b095-4a6cbb20ae25@roeck-us.net> (raw)
In-Reply-To: <6fec7aa8-32b4-47de-8fb5-4ab6890c1f46@roeck-us.net>

On 12/14/24 06:19, Guenter Roeck wrote:
> On 12/14/24 00:58, Wolfram Sang wrote:
>> There are multiple open coded implementations for getting the parity of
>> a byte in the kernel, even using different approaches. Take the pretty
>> efficient version from SPD5118 driver and make it generally available by
>> putting it into the bitops header. As long as there is just one parity
>> calculation helper, the creation of a distinct 'parity.h' header was
>> discarded. Also, the usage of hweight8() for architectures having a
>> popcnt instruction is postponed until a use case within hot paths is
>> desired. The motivation for this patch is the frequent use of odd parity
>> in the I3C specification and to simplify drivers there.
>>
>> Changes compared to the original SPD5118 version are the addition of
>> kernel documentation, switching the return type from bool to int, and
>> renaming the argument of the function.
>>
> 
> Curious: Why not bool ?
> 

Never mind. It returns the parity, after all, not "parity is odd".

Thanks,
Guenter


  reply	other threads:[~2024-12-14 14:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-14  8:58 [RFC PATCH 0/2] " Wolfram Sang
2024-12-14  8:58 ` [RFC PATCH 1/2] bitops: " Wolfram Sang
2024-12-14 14:19   ` Guenter Roeck
2024-12-14 14:30     ` Guenter Roeck [this message]
2024-12-14 16:40       ` Wolfram Sang
2024-12-14 15:10   ` Guenter Roeck
2024-12-16  9:49   ` Geert Uytterhoeven
2024-12-17  2:24   ` Yury Norov
2024-12-17  5:57     ` Wolfram Sang
2024-12-17  8:41       ` Wolfram Sang
2024-12-17 13:10         ` Guenter Roeck
2024-12-17  8:15   ` Kuan-Wei Chiu
2024-12-17  8:37     ` Wolfram Sang
2024-12-14  8:58 ` [RFC PATCH 2/2] hwmon: (spd5118) Use generic parity calculation Wolfram Sang
2024-12-14 15:10   ` Guenter Roeck
2024-12-16  9:50   ` Geert Uytterhoeven
2024-12-17  8:16   ` Kuan-Wei Chiu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2e8e63f2-3a1b-4ca4-b095-4a6cbb20ae25@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®