Re: [PATCH V2 3/3] iio: adc: Add support for PMIC7 ADC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andy,

On 4/27/2020 6:58 PM, Andy Shevchenko wrote:
On Mon, Apr 27, 2020 at 3:56 PM Jishnu Prakash <jprakash@xxxxxxxxxxxxxx> wrote:
On 4/17/2020 3:51 PM, Andy Shevchenko wrote:
On Thu, Apr 16, 2020 at 1:48 AM Jishnu Prakash <jprakash@xxxxxxxxxxxxxx> 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;




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux