From: David Laight <David.Laight@ACULAB.COM>
To: 'Linus Torvalds' <torvalds@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Felipe Balbi <balbi@kernel.org>,
Jakob Koschel <jakobkoschel@gmail.com>,
Randy Dunlap <rdunlap@infradead.org>,
Ira Weiny <ira.weiny@intel.com>
Subject: RE: [PATCH] USB: gadget: dummy_hcd: switch char * to u8 *
Date: Fri, 21 Oct 2022 22:02:35 +0000 [thread overview]
Message-ID: <8ca8b04cf5ef4e0099a04637df8293ac@AcuMS.aculab.com> (raw)
In-Reply-To: <CAHk-=wggc19mf+WR=eg7h7MfVVNbE1c8b5vcOc6wmDASNTMddg@mail.gmail.com>
From: Linus Torvalds
> Sent: 21 October 2022 18:31
...
> I think you might as well also remove the cast that was always a bit odd:
>
> buf[0] = (u8)dum->devstatus;
...
> I suspect a comment would be more readable than an odd cast that
> doesn't actually change anything (since the assignment does it
> anyway).
I've seen a compiler generate an '& 0xff' for the cast before
storing the low byte.
Don't even think about what that compiler would generated for:
buf[0] = (u8)(dum->devstatus & 0xff);
The code is much easier to read as just an assignment :-)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2022-10-21 22:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 6:44 Greg Kroah-Hartman
2022-10-21 17:30 ` Linus Torvalds
2022-10-21 22:02 ` David Laight [this message]
2022-10-23 15:53 ` Greg Kroah-Hartman
2022-10-23 16:04 ` Greg Kroah-Hartman
2022-10-23 16:46 ` Linus Torvalds
2022-10-23 16:46 ` Alan Stern
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=8ca8b04cf5ef4e0099a04637df8293ac@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=ira.weiny@intel.com \
--cc=jakobkoschel@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®