> As stated above, I can't immediately see any real advantage to > doing this allocation dynamically. > > +static int adjd_s311_update_scan_mode(struct iio_dev *indio_dev, > > + const unsigned long *scan_mask) > > +{ > > + struct adjd_s311_data *data = iio_priv(indio_dev); > > + data->buffer = krealloc(data->buffer, indio_dev->scan_bytes, > > + GFP_KERNEL); > > + if (!data->buffer) > > + return -ENOMEM; > > + > > + return 0; > > +} one problem is to compute the maximum buffer size; for this driver it is easy: 4*2 + padding + timestamp -- padding turns out to be 0 assuming the padding rule is set in stone; I think IIO core should do that computation iio_compute_scan_bytes() is not directly callable; I'd rather keep this as is regards, p. -- Peter Meerwald +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