lkml.org 
[lkml]   [2020]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH V2 3/3] iio: adc: Add support for PMIC7 ADC
On Mon, Apr 27, 2020 at 3:56 PM Jishnu Prakash <jprakash@codeaurora.org> wrote:
> On 4/17/2020 3:51 PM, Andy Shevchenko wrote:
> On Thu, Apr 16, 2020 at 1:48 AM Jishnu Prakash <jprakash@codeaurora.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

\
 
 \ /
  Last update: 2020-04-27 15:28    [W:0.091 / U:73.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site