[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aa6a8817-2ae9-5768-093b-b9f8577597c5@codeaurora.org>
Date: Wed, 13 May 2020 14:50:06 +0530
From: Jishnu Prakash <jprakash@...eaurora.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>
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
Hi Andy,
On 4/27/2020 6:58 PM, Andy Shevchenko wrote:
> 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?
There is a way to remove this, I'll make this change with some other
changes in the fifth patch of my latest post.
>
> ...
>
>> + 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?
I checked this part again. It looks like casting is not strictly
required here, I'll remove it in my latest post.
>
>> + 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;
>
Powered by blists - more mailing lists