summaryrefslogtreecommitdiff
path: root/drivers/iio/accel
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2020-11-29 21:44:59 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-12-03 22:40:29 +0300
commit26aec6e1b714f954b22bc7ad3239b6c0e917c90f (patch)
tree98b2d72174f32338501443248458403e64ede7d8 /drivers/iio/accel
parent1e405bc2512f80a903ddd6ba8740cee885238d7f (diff)
downloadlinux-26aec6e1b714f954b22bc7ad3239b6c0e917c90f.tar.xz
iio:gyro:mpu3050 Treat otp value as a __le64 and use FIELD_GET() to break up
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. We need to use GENMASK_ULL and %llX formatters to account for the larger types used in computing the various fields. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20201128185156.428327-1-jic23@kernel.org Link: https://lore.kernel.org/r/20201129184459.647538-1-jic23@kernel.org
Diffstat (limited to 'drivers/iio/accel')
0 files changed, 0 insertions, 0 deletions