mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* IIO ring buffer
@ 2010-02-22  9:03 Barry Song
  0 siblings, 0 replies; only message in thread
From: Barry Song @ 2010-02-22  9:03 UTC (permalink / raw)
  To: jic23, manuel.stahl; +Cc: linux-kernel

Hi Jonathan,
Now users depend on iio ring
events(IIO_EVENT_CODE_RING_50/75/100_FULL) to read data:
                read_size = fread(&dat, 1, sizeof(struct iio_event_data),
                                  fp_ev);
                switch (dat.id) {
                case IIO_EVENT_CODE_RING_100_FULL:
                        toread = RingLength;
                        break;
                case IIO_EVENT_CODE_RING_75_FULL:
                        toread = RingLength*3/4;
                        break;
                case IIO_EVENT_CODE_RING_50_FULL:
                        toread = RingLength/2;
                        break;
                default:
                        printf("Unexpecteded event code\n");
                        continue;
                }
                read_size = read(fp,
                                 data,
                                 toread*size_from_scanmode(NumVals, scan_ts));
                if (read_size == -EAGAIN) {
                        printf("nothing available \n");
                        continue;
                }
And iio ring access node doesn't support blocking io too.  It seems we
lost to let users read data once ring is not empty. And some users
maybe not care about iio ring events at all, but just want to read
data like a input or audio driver. So how about adding the following
support in iio ring:
1. add NOT EMPTY event in IIO event nodes
2. add blocking io support in read function of IIO access nodes
If you agree with that, I can begin to add these and send you a patch.
And a problem I don't know is what you and other people have changed
to Greg's staging tree, and I am not sure what tree the patch should
be againest.

For long term plan, is it possible for ring common level to handle
more common work to avoid code repeating in different drivers?

Thanks
Barry

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-02-22  9:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-22  9:03 IIO ring buffer Barry Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®