From: Greg KH <gregkh@linuxfoundation.org>
To: Matt Sickler <Matt.Sickler@daktronics.com>
Cc: Harsh Jain <harshjain32@gmail.com>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] staging:kpc2000:Fix dubious x | !y sparse warning
Date: Thu, 1 Aug 2019 21:29:58 +0200 [thread overview]
Message-ID: <20190801192958.GA24482@kroah.com> (raw)
In-Reply-To: <BYAPR02MB400519AC022AB41054C110FDEEDE0@BYAPR02MB4005.namprd02.prod.outlook.com>
On Thu, Aug 01, 2019 at 07:22:13PM +0000, Matt Sickler wrote:
> >-----Original Message-----
> >From: devel <driverdev-devel-bounces@linuxdriverproject.org> On Behalf Of Greg KH
> >Sent: Thursday, August 01, 2019 11:35 AM
> >To: Harsh Jain <harshjain32@gmail.com>
> >Cc: devel@driverdev.osuosl.org; linux-kernel@vger.kernel.org
> >Subject: Re: [PATCH] staging:kpc2000:Fix dubious x | !y sparse warning
> >
> >On Thu, Aug 01, 2019 at 12:06:06AM +0530, Harsh Jain wrote:
> >> Bitwise OR(|) operation with 0 always yield same result.
> >> It fixes dubious x | !y sparse warning.
> >>
> >> Signed-off-by: Harsh Jain <harshjain32@gmail.com>
> >> ---
> >> drivers/staging/kpc2000/kpc2000_i2c.c | 16 +---------------
> >> 1 file changed, 1 insertion(+), 15 deletions(-)
> >>
> >> diff --git a/drivers/staging/kpc2000/kpc2000_i2c.c b/drivers/staging/kpc2000/kpc2000_i2c.c
> >> index b108da4..5f027d7c 100644
> >> --- a/drivers/staging/kpc2000/kpc2000_i2c.c
> >> +++ b/drivers/staging/kpc2000/kpc2000_i2c.c
> >> @@ -536,29 +536,15 @@ static u32 i801_func(struct i2c_adapter *adapter)
> >>
> >> u32 f =
> >> I2C_FUNC_I2C | /* 0x00000001 (I enabled this one) */
> >> - !I2C_FUNC_10BIT_ADDR | /* 0x00000002 */
> >> - !I2C_FUNC_PROTOCOL_MANGLING | /* 0x00000004 */
> >> ((priv->features & FEATURE_SMBUS_PEC) ? I2C_FUNC_SMBUS_PEC : 0) | /* 0x00000008 */
> >> - !I2C_FUNC_SMBUS_BLOCK_PROC_CALL | /* 0x00008000 */
> >> I2C_FUNC_SMBUS_QUICK | /* 0x00010000 */
> >> - !I2C_FUNC_SMBUS_READ_BYTE | /* 0x00020000 */
> >> - !I2C_FUNC_SMBUS_WRITE_BYTE | /* 0x00040000 */
> >> - !I2C_FUNC_SMBUS_READ_BYTE_DATA | /* 0x00080000 */
> >> - !I2C_FUNC_SMBUS_WRITE_BYTE_DATA | /* 0x00100000 */
> >> - !I2C_FUNC_SMBUS_READ_WORD_DATA | /* 0x00200000 */
> >> - !I2C_FUNC_SMBUS_WRITE_WORD_DATA | /* 0x00400000 */
> >> - !I2C_FUNC_SMBUS_PROC_CALL | /* 0x00800000 */
> >> - !I2C_FUNC_SMBUS_READ_BLOCK_DATA | /* 0x01000000 */
> >> - !I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | /* 0x02000000 */
> >
> >This is ok, it is showing you that these bits are explicitly being not
> >set. Which is good, now you can go through the list and see that all
> >are accounted for.
> >
> >So I think this should stay as-is, thanks.
>
> I was going to say the same thing, but I didn't know what the kernel style guideline was.
> Would Linus prefer this style or would commenting them out be preferred?
> Seems like the sparse warnings means the current style is not acceptable?
>
Sparse is just warning that you really are not doing anything here, in
case you think you are, as it's a common pattern for bugs.
So all should be fine, don't worry about it for now.
thanks,
greg k-h
prev parent reply other threads:[~2019-08-01 19:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-31 18:36 [PATCH] staging:kpc2000:Fix dubious x | !y sparse warning Harsh Jain
2019-08-01 16:34 ` Greg KH
2019-08-01 19:22 ` Matt Sickler
2019-08-01 19:29 ` Greg KH [this message]
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=20190801192958.GA24482@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Matt.Sickler@daktronics.com \
--cc=devel@driverdev.osuosl.org \
--cc=harshjain32@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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