···4545{4646 struct iio_poll_func *pf = p;4747 struct iio_dev *indio_dev = pf->indio_dev;4848+ int i = 0, j;4849 u16 *data;49505051 data = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);5152 if (!data)5253 goto done;53545454- if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) {5555- /*5656- * Three common options here:5757- * hardware scans: certain combinations of channels make5858- * up a fast read. The capture will consist of all of them.5959- * Hence we just call the grab data function and fill the6060- * buffer without processing.6161- * software scans: can be considered to be random access6262- * so efficient reading is just a case of minimal bus6363- * transactions.6464- * software culled hardware scans:6565- * occasionally a driver may process the nearest hardware6666- * scan to avoid storing elements that are not desired. This6767- * is the fiddliest option by far.6868- * Here let's pretend we have random access. And the values are6969- * in the constant table fakedata.7070- */7171- int i, j;7272-7373- for (i = 0, j = 0;7474- i < bitmap_weight(indio_dev->active_scan_mask,7575- indio_dev->masklength);7676- i++, j++) {7777- j = find_next_bit(indio_dev->active_scan_mask,7878- indio_dev->masklength, j);7979- /* random access read from the 'device' */8080- data[i] = fakedata[j];8181- }8282- }5555+ /*5656+ * Three common options here:5757+ * hardware scans:5858+ * certain combinations of channels make up a fast read. The capture5959+ * will consist of all of them. Hence we just call the grab data6060+ * function and fill the buffer without processing.6161+ * software scans:6262+ * can be considered to be random access so efficient reading is just6363+ * a case of minimal bus transactions.6464+ * software culled hardware scans:6565+ * occasionally a driver may process the nearest hardware scan to avoid6666+ * storing elements that are not desired. This is the fiddliest option6767+ * by far.6868+ * Here let's pretend we have random access. And the values are in the6969+ * constant table fakedata.7070+ */7171+ for_each_set_bit(j, indio_dev->active_scan_mask, indio_dev->masklength)7272+ data[i++] = fakedata[j];83738474 iio_push_to_buffers_with_timestamp(indio_dev, data,8575 iio_get_time_ns(indio_dev));