From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D1CFC3E8C5 for ; Sun, 29 Nov 2020 11:28:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 302FC207BC for ; Sun, 29 Nov 2020 11:28:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="kADdZ3zb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725984AbgK2L2y (ORCPT ); Sun, 29 Nov 2020 06:28:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:58422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbgK2L2y (ORCPT ); Sun, 29 Nov 2020 06:28:54 -0500 Received: from archlinux (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B26AF2076A; Sun, 29 Nov 2020 11:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606649293; bh=rpr7q24TmcpM70fFs9oFBwjg9mnJlO+gT04e4RvSDDc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kADdZ3zbVOUFF8zPMiFbSdpnHYlZ2qWNRADxoe4wMZfd6cqIWRb4qbwant6M3LucF nnL2PEKphzuCoymJBeG78tQzZXqAnmyf+QG/4wBqp8fP9QCcMOm1ykTAV5c0AWqFHc saLrNba4IJBjUjF4B3KG4/RV1+MUUkDiBmbFsfRU= Date: Sun, 29 Nov 2020 11:28:09 +0000 From: Jonathan Cameron To: Linus Walleij Cc: Andy Shevchenko , linux-iio , Jonathan Cameron , Andy Shevchenko Subject: Re: [PATCH] iio:gyro:mpu3050 Treat otp value as a __le64 and use FIELD_GET() to break up Message-ID: <20201129112809.2e8a267f@archlinux> In-Reply-To: References: <20201128185156.428327-1-jic23@kernel.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Sun, 29 Nov 2020 02:11:01 +0100 Linus Walleij wrote: > On Sun, Nov 29, 2020 at 12:18 AM Andy Shevchenko > wrote: > > On Sun, Nov 29, 2020 at 12:22 AM Linus Walleij wrote: =20 > > > On Sat, Nov 28, 2020 at 7:54 PM Jonathan Cameron w= rote: > > > =20 > > > > From: Jonathan Cameron > > > > > > > > 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 manipulat= ing > > > > it as an __le64 converted to a u64. That lets us just use FIELD_GE= T() > > > > and GENMASK() to extract the values desired. > > > > > > > > Note only build tested. > > > > > > > > Signed-off-by: Jonathan Cameron > > > > Cc: Andy Shevchenko > > > > Cc: Linus Walleij =20 > > > > > > 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 :0:0: > > > ../drivers/iio/gyro/mpu3050-core.c: In function =E2=80=98mpu3050_hw_i= nit=E2=80=99: > > > ../include/linux/bits.h:36:11: warning: right shift count is negative > > > [-Wshift-count-negative] > > > (~UL(0) >> (BITS_PER_LONG - 1 - (h)))) =20 > > > > I think GENMASK_ULL() has to be used. =20 >=20 > 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 >=20 > Yours, > Linus Walleij