... >> +int iio_sw_buffer_preenable(struct iio_dev *indio_dev) >> +{ >> + struct iio_buffer *buffer = indio_dev->buffer; >> + const struct iio_chan_spec *ch; >> + unsigned bytes = 0; >> + int length, i; >> + dev_dbg(&indio_dev->dev, "%s\n", __func__); >> + >> + /* How much space will the demuxed element take? */ >> + for_each_set_bit(i, buffer->scan_mask, >> + indio_dev->masklength) { >> + ch = iio_find_channel_from_si(indio_dev, i); >> + length = ch->scan_type.storagebits/8; >> + if (bytes % length) >> + bytes += length - bytes % length; > > bytes = ALIGN(bytes, length); would probably make it more obvious what is > going on here. Good idea. Thanks. -- 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