From: Michal Nazarewicz <mina86@mina86.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>,
Mark Brown <broonie@kernel.org>,
linux-spi@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: tegra: avoid unsigned->signed->unsigned promotion
Date: Mon, 02 Dec 2013 14:05:35 +0100 [thread overview]
Message-ID: <xa1tli038ktc.fsf@mina86.com> (raw)
In-Reply-To: <20131129214313.GA18036@mithrandir>
[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]
> On Fri, Nov 29, 2013 at 06:12:44PM +0100, Michal Nazarewicz wrote:
>> u8 type, which is unsigned, is promoted to int, which is singned, when
>> doing a binary shift. Then, on 64-bit machines, it is further promoted
>> to unsigned long which may lead to more significant half of the value
>> to be all ones. To avoid this, explicitly promote to an unsigned type.
On Fri, Nov 29 2013, Thierry Reding wrote:
> But I don't think there's a real issue here. Even on 64-bit platforms,
> writel() will only write 32-bit registers, and therefore discard the
> upper 32 bits.
>
> I think in general perhaps a more proper fix would be to use only u32
> instead of unsigned long for these cases, since then the problem goes
> away. u32 is also the type of the value used by writel() so it makes
> perfect sense to use it.
Yes, you're absolutely right. I dunno why I missed the fact it's used
in writel only. I'll prepare a new patch soon(ish).
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michał “mina86” Nazarewicz (o o)
ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo--
[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]
next prev parent reply other threads:[~2013-12-02 13:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 17:12 [PATCH] spi: tegra: avoid unsigned->signed->unsigned promotion Michal Nazarewicz
2013-11-29 21:43 ` Thierry Reding
2013-12-02 13:05 ` Michal Nazarewicz [this message]
2013-12-08 15:35 ` [PATCH 0/3] spi: tegra: use u32 for 32-bit register values Michal Nazarewicz
2013-12-08 15:35 ` [PATCH 1/3] spi: tegra114: " Michal Nazarewicz
2013-12-08 15:35 ` [PATCH 2/3] spi: tegra20-slink: " Michal Nazarewicz
2013-12-08 15:35 ` [PATCH 3/3] spi: tegra20-sflash: " Michal Nazarewicz
2013-12-09 18:00 ` [PATCH 0/3] spi: tegra: " Stephen Warren
2013-12-09 18:14 ` Mark Brown
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=xa1tli038ktc.fsf@mina86.com \
--to=mina86@mina86.com \
--cc=broonie@kernel.org \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@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