From: Joe Perches <joe@perches.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: checkpatch: comparisons with a constant on the left
Date: Thu, 10 Oct 2019 20:23:47 -0700 [thread overview]
Message-ID: <8720b5d432ca5ba5e128c241efee22674e012af8.camel@perches.com> (raw)
In-Reply-To: <20191011015225.GA27495@jagdpanzerIV>
On Fri, 2019-10-11 at 10:52 +0900, Sergey Senozhatsky wrote:
> Hi Joe,
Hi Sergey.
> I noticed that this code
>
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
>
> triggers checkpatch's warning:
>
> "WARNING: Comparisons should place the constant on
> the right side of the test"
>
> Both LINUX_VERSION_CODE and KERNEL_VERSION are constants, so
> I'm wondering if it's worth it to improve that check a tiny
> bit.
Probably not.
My preference is for people to ignore checkpatch
message bleats when they don't make overall sense.
checkpatch thinks anything that uses a form like
"name(<args...>)" is a function.
> I'm sure you'll have a better idea.
I suggest reversing the test if it really bothers you.
# if KERNEL_VERSION(4.18.0) < LINUX_VERSION_CODE
but then again just using LINUX_VERSION_CODE emits a
warning message, so it's better to remove whatever is
in the block anyway... <smile>
cheers, Joe
next prev parent reply other threads:[~2019-10-11 3:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-11 1:52 Sergey Senozhatsky
2019-10-11 3:23 ` Joe Perches [this message]
2019-10-20 7:30 ` Sergey Senozhatsky
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=8720b5d432ca5ba5e128c241efee22674e012af8.camel@perches.com \
--to=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@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®