public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
Cc: keescook@chromium.org, edumazet@google.com,
	willemdebruijn.kernel@gmail.com, wad@chromium.org,
	luto@amacapital.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kuba@kernel.org, shuah@kernel.org,
	pabeni@redhat.com, linux-kselftest@vger.kernel.org,
	davem@davemloft.net,
	linux-kernel-mentees@lists.linuxfoundation.org,
	David Laight <David.Laight@aculab.com>
Subject: Re: [PATCH v2 1/2] selftests: Provide local define of min() and max()
Date: Fri, 25 Aug 2023 08:26:22 -0700	[thread overview]
Message-ID: <ZOjIHo2A6HZ8K4Qp@google.com> (raw)
In-Reply-To: <20230824202415.131824-1-mahmoudmatook.mm@gmail.com>

On Fri, Aug 25, 2023, Mahmoud Maatuq wrote:
> to avoid manual calculation of min and max values
> and fix coccinelle warnings such WARNING opportunity for min()/max()
> adding one common definition that could be used in multiple files
> under selftests.
> there are also some defines for min/max scattered locally inside sources
> under selftests.
> this also prepares for cleaning up those redundant defines and include
> kselftest.h instead.
> 
> Signed-off-by: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
> Suggested-by: David Laight <David.Laight@aculab.com>
> ---
> changes in v2:
> redefine min/max in a more strict way to avoid 
> signedness mismatch and multiple evaluation.
> is_signed_type() moved from selftests/kselftest_harness.h 
> to selftests/kselftest.h.
> ---
>  tools/testing/selftests/kselftest.h         | 24 +++++++++++++++++++++

Heh, reminds me of https://xkcd.com/927.

All of these #defines are available in tools/include/linux/kernel.h, and it's
trivially easy for selftests to add all of tools/include to their include path.
I don't see any reason for the selftests framework to define yet another version,
just fix the individual tests.

  parent reply	other threads:[~2023-08-25 15:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 20:24 [PATCH v2 1/2] selftests: Provide local define of min() and max() Mahmoud Maatuq
2023-08-24 20:24 ` [PATCH v2 2/2] selftests/net: replace ternary operator with min()/max() Mahmoud Maatuq
2023-08-24 20:32   ` Willem de Bruijn
2023-08-24 21:13     ` [PATCH v2 2/2] selftests/net: replace ternary operator with min()/max() ^[^[ Mahmoud Matook
2023-08-24 21:22       ` [PATCH v2 2/2] selftests/net: replace ternary operator with min()/max() Willem de Bruijn
2023-08-25  9:32   ` David Laight
2023-08-25 15:26 ` Sean Christopherson [this message]
2023-08-26  9:45   ` [PATCH v2 1/2] selftests: Provide local define of min() and max() Mahmoud Matook
2023-08-28 15:04     ` Sean Christopherson

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=ZOjIHo2A6HZ8K4Qp@google.com \
    --to=seanjc@google.com \
    --cc=David.Laight@aculab.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mahmoudmatook.mm@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=wad@chromium.org \
    --cc=willemdebruijn.kernel@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