[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vdu4HvaTg5ij=DFhwn=y_JCb9ae9L5-iV72Zk-k9CBHuw@mail.gmail.com>
Date: Mon, 27 Apr 2020 16:28:13 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Jishnu Prakash <jprakash@...eaurora.org>
Cc: agross@...nel.org, Bjorn Andersson <bjorn.andersson@...aro.org>,
devicetree <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Matthias Kaehlcke <mka@...omium.org>,
Linus Walleij <linus.walleij@...aro.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
smohanad@...eaurora.org, kgunda@...eaurora.org,
aghayal@...eaurora.org, Jonathan Cameron <jic23@...nel.org>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
linux-arm-msm@...r.kernel.org,
linux-iio <linux-iio@...r.kernel.org>,
linux-arm-msm-owner@...r.kernel.org
Subject: Re: [PATCH V2 3/3] iio: adc: Add support for PMIC7 ADC
On Mon, Apr 27, 2020 at 3:56 PM Jishnu Prakash <jprakash@...eaurora.org> wrote:
> On 4/17/2020 3:51 PM, Andy Shevchenko wrote:
> On Thu, Apr 16, 2020 at 1:48 AM Jishnu Prakash <jprakash@...eaurora.org> wrote:
Stop using HTML. It breaks badly the reply and discussion.
...
> +static const struct adc5_data adc7_data_pmic;
>
> Global variable? Hmm...
>
> adc7_data_pmic is referenced twice before its actual definition (which was added along with corresponding adc5_data struct for PMIC5 ADC), so I have given the initial declaration here.
Maybe you can realize how to avoid global variable at all?
...
> + buf[1] &= 0xff & ~ADC5_USR_FAST_AVG_CTL_SAMPLES_MASK;
>
> What the point of 0xff & part?
>
> This was something you suggested in my first post:
>
> > + buf[1] &= (u8) ~ADC5_USR_FAST_AVG_CTL_SAMPLES_MASK;
>
> Use '0xFF ^ _MASK' instead of casting.
>
> ...
>
> > + buf[3] &= (u8) ~ADC5_USR_HW_SETTLE_DELAY_MASK;
>
> Ditto.
>
> I think "0xff &" works as intended here in place of casting to (u8)...
Does it work without casting? (Note, I suggested slightly different expression)
I.o.w. what the problem casting solves?
> + buf[1] |= prop->avg_samples;
> +
> + /* Select ADC channel */
> + buf[2] = prop->channel;
> +
> + /* Select HW settle delay for channel */
> + buf[3] &= 0xff & ~ADC5_USR_HW_SETTLE_DELAY_MASK;
>
> Ditto.
>
> + buf[3] |= prop->hw_settle_time;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists