On Tue, Aug 23, 2016 at 9:23 PM, Peter Meerwald-Stadler <pmeerw@xxxxxxxxxx> wrote: > >> >> -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 > Ah right but wouldn't for big endian case still require it?..... > 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