Re: [PATCH 2/3] iio: chemical: vz89x: add support for VZ89TE part

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

 



> >> -static int vz89x_get_resistance_reading(struct vz89x_data *data)
> >> +static int vz89x_get_resistance_reading(struct vz89x_data *data,
> >> +                                     struct iio_chan_spec const *chan,
> >> +                                     int *val)
> >>  {
> >> -     u8 *buf = &data->buffer[VZ89X_VOC_RESISTANCE_IDX];
> >> +     u32 tmp = *((u32 *) ((u8 *) &data->buffer[chan->address]));
> >> +
> >> +     switch (chan->scan_type.endianness) {
> >> +     case IIO_LE:
> >> +             *val = le32_to_cpu(tmp) & GENMASK(23, 0);
> >
> > could use le32_to_cpup() probably
> 
> Except we need to apply the mask anyway...

but you may save the ugly casting

p. 

-- 

Peter Meerwald-Stadler
+43-664-2444418 (mobile)
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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