From: Jonathan Cameron <jic23@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
linux-iio <linux-iio@vger.kernel.org>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH] iio:gyro:mpu3050 Treat otp value as a __le64 and use FIELD_GET() to break up
Date: Sun, 29 Nov 2020 11:28:09 +0000 [thread overview]
Message-ID: <20201129112809.2e8a267f@archlinux> (raw)
In-Reply-To: <CACRpkdZrSyASctLFfN-8GZRnyfEUPretCXHiD-G+z+cvsDJLww@mail.gmail.com>
On Sun, 29 Nov 2020 02:11:01 +0100
Linus Walleij <linus.walleij@linaro.org> wrote:
> On Sun, Nov 29, 2020 at 12:18 AM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Sun, Nov 29, 2020 at 12:22 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> > > On Sat, Nov 28, 2020 at 7:54 PM Jonathan Cameron <jic23@kernel.org> wrote:
> > >
> > > > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > >
> > > > Inspired by Andy Shevchenko's proposal to use get_unaligned_leXX().
> > > >
> > > > The whole one time programable memory is treated as a single 64bit
> > > > little endian value. Thus we can avoid a lot of messy handling
> > > > of fields overlapping byte boundaries by just loading and manipulating
> > > > it as an __le64 converted to a u64. That lets us just use FIELD_GET()
> > > > and GENMASK() to extract the values desired.
> > > >
> > > > Note only build tested.
> > > >
> > > > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > > > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > > Cc: Linus Walleij <linus.walleij@linaro.org>
> > >
> > > Are there any specific prerequisites? linux-next?
> > >
> > > When I apply this and try to compile for an ARMv7 target I get
> > > a lot of noise and an error:
> > >
> > > In file included from <command-line>:0:0:
> > > ../drivers/iio/gyro/mpu3050-core.c: In function ‘mpu3050_hw_init’:
> > > ../include/linux/bits.h:36:11: warning: right shift count is negative
> > > [-Wshift-count-negative]
> > > (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
> >
> > I think GENMASK_ULL() has to be used.
>
> Oh indeed. It works as long as one just try to test-compile it on a 64bit
> machine of course :D
Doh. That's me being lazy :(
Will flip them all over to GENMASK_ULL and do a 32 bit build test.
I checked that the FIELD_GET would be fine, but forgot to look at
GENMASK.
oops.
Jonathan
>
> Yours,
> Linus Walleij
prev parent reply other threads:[~2020-11-29 11:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-28 18:51 [PATCH] iio:gyro:mpu3050 Treat otp value as a __le64 and use FIELD_GET() to break up Jonathan Cameron
2020-11-28 19:20 ` Linus Walleij
2020-11-28 23:18 ` Andy Shevchenko
2020-11-29 1:11 ` Linus Walleij
2020-11-29 11:28 ` Jonathan Cameron [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=20201129112809.2e8a267f@archlinux \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@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