All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] staging:iio: character device merge
@ 2011-08-30 11:32 Jonathan Cameron
  2011-08-30 11:32 ` [PATCH 1/7] staging:iio:kfifo buffer - push structure definition down into implementation Jonathan Cameron
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Jonathan Cameron @ 2011-08-30 11:32 UTC (permalink / raw)
  To: greg; +Cc: linux-iio, Jonathan Cameron

Hi Greg,

This is the first of the more interesting sets for IIO this round.
What we have here is another one of the changes Arnd Bergmann suggested.
(we have nearly caught up with everything in his review!)

It merges all of our character devices per hardware device down into one.
That device supports an ioctl (documentation for that dropped for now
as it would touch a doc file that doesn't have any staging related
elements) that is used to request an anonfd for the event interface.

Anyhow, this has been on linux-iio for quite a while and Michael has been
hammering it with his Analog devices parts without problem hence I'm
sending it on to you now.  We need to do some documentation for this
as well and that will follow sometime soon (IIO events were never well
documented in the first place - oops)

Thanks,

Jonathan

Text of pervious posting was:

Hi All,

I thought I'd best give this series one last airing before sending on
to Greg.  Note I'll be dropping the ioctl region patch for now as
there may be issues with reserving that for a staging driver?

Anyhow does what it says on the tin.

Michael, can you give me a tested by on this stuff (guessing you have
been given your iio-blue.git fixes etc).

Thanks,

Jonathan

And the one before that:


This is another of Arnd's suggestions.

Some of the patches here are just pre conversion reworks to make the important
bit easier and some are cleanups of headers etc as a result of things not
being needed any more.

One little change I slipped in here:

devices now have iio:deviceX as their name so that we have something
sensibly named under /dev/

The important patches are 4 and 6.

4 uses Arnd's suggestion of an annon_fd obtained via ioctl on the buffer
chrdev to get a file for easy use for reading events.  This is a very neat
solution that lets us keep the actual event system separate from the data
stream without two chrdevs.

6. Moves the remaining single chrdev so it associated with the iio_dev rather
than the buffer.  This means we now only have two types of device (other than
weird ones like the sysfs trigger management node), triggers and devices.
Given either can exist independently, those two don't make sense to merge.

Anyhow, I'm far from convinced that the allocation / deallocation is now
correct and that there aren't any race conditions on removal od devices.
(then again I'm not convinced there weren't any of those before.)

Note I haven't ammended the nature of either 'chrdev' at all. There
is more to be done there.

Note, this is 3.2 material so no particular rush for comments.
Having said that, please do pull it into local trees and hammer it
nice and hard to see where I messed up.

For reference a minimal test app is:

#include <stdio.h>
/* little dirty test prog */
 #include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdint.h>

struct iio_event_data {
	int	id;
	int64_t	timestamp;
};


int main(int argc, char **argv)
{
	int ret;
	int fp;
	int data;
	int i = 0;
	FILE *evfp;
	struct iio_event_data ev;
	fp = open(argv[1], O_RDONLY);
	ret = ioctl(fp, 0, &data);
	/* So we have the fd (in theory) of the anon file */
	evfp = fdopen(data, "r");

	if (evfp)
		for (i = 0; i < 100; i++) {
			ret = fread( &ev, sizeof(ev), 1, evfp);
			printf("%d %lld\n", ev.id, ev.timestamp);
		}
	return 0;
}

Jonathan

Jonathan Cameron (7):
  staging:iio:kfifo buffer - push structure definition down into
    implementation.
  staging:iio:chrdev.h rationalization.
  staging:iio: remove specific chrdev for event reading. Get fd from
    ioctl on buffer.
  staging:iio: squash chrdev handler remains into users.
  staging:iio: push the main buffer chrdev down to the top level.
  staging:iio: remove now defunct header definitions and add some
    statics
  staging:iio:Documentation sysfs-bus-iio update for chrdev merge.

 drivers/staging/iio/Documentation/generic_buffer.c |   12 +-
 drivers/staging/iio/Documentation/iio_utils.h      |    2 +-
 drivers/staging/iio/Documentation/sysfs-bus-iio    |  573 ++++++++++----------
 drivers/staging/iio/accel/adis16201_core.c         |    6 +-
 drivers/staging/iio/accel/adis16203_core.c         |    6 +-
 drivers/staging/iio/accel/adis16204_core.c         |    6 +-
 drivers/staging/iio/accel/adis16209_core.c         |    6 +-
 drivers/staging/iio/accel/adis16240_core.c         |    6 +-
 drivers/staging/iio/accel/lis3l02dq_core.c         |    6 +-
 drivers/staging/iio/accel/sca3000_core.c           |    7 +-
 drivers/staging/iio/accel/sca3000_ring.c           |   23 +-
 drivers/staging/iio/adc/ad7150.c                   |    1 +
 drivers/staging/iio/adc/ad7192.c                   |    6 +-
 drivers/staging/iio/adc/ad7298_core.c              |    4 +-
 drivers/staging/iio/adc/ad7476_core.c              |    4 +-
 drivers/staging/iio/adc/ad7606_core.c              |    4 +-
 drivers/staging/iio/adc/ad7745.c                   |    1 +
 drivers/staging/iio/adc/ad7793.c                   |    6 +-
 drivers/staging/iio/adc/ad7816.c                   |    1 +
 drivers/staging/iio/adc/ad7887_core.c              |    4 +-
 drivers/staging/iio/adc/ad799x_core.c              |    6 +-
 drivers/staging/iio/adc/adt7310.c                  |    2 +
 drivers/staging/iio/adc/adt7410.c                  |    2 +
 drivers/staging/iio/adc/adt75.c                    |    1 +
 drivers/staging/iio/adc/max1363_core.c             |   10 +-
 drivers/staging/iio/addac/adt7316.c                |    2 +
 drivers/staging/iio/chrdev.h                       |   52 +--
 drivers/staging/iio/dac/ad5504.c                   |    1 +
 drivers/staging/iio/gyro/adis16260_core.c          |    6 +-
 drivers/staging/iio/iio.h                          |    3 +-
 drivers/staging/iio/iio_core.h                     |   39 +-
 drivers/staging/iio/impedance-analyzer/ad5933.c    |    8 +-
 drivers/staging/iio/imu/adis16400_core.c           |    6 +-
 drivers/staging/iio/industrialio-core.c            |  279 ++++++-----
 drivers/staging/iio/industrialio-ring.c            |  220 +++-----
 drivers/staging/iio/kfifo_buf.c                    |   34 +-
 drivers/staging/iio/kfifo_buf.h                    |    8 -
 drivers/staging/iio/meter/ade7758.h                |    5 +-
 drivers/staging/iio/meter/ade7758_core.c           |    6 +-
 drivers/staging/iio/meter/ade7758_ring.c           |    4 +-
 drivers/staging/iio/ring_generic.h                 |   28 +-
 drivers/staging/iio/ring_sw.c                      |   25 +-
 42 files changed, 644 insertions(+), 787 deletions(-)

-- 
1.7.3.4


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 0/7 V2] blue part 5: IIO: Reduce to 1 the number of chrdevs per device.
@ 2011-07-25 13:18 Jonathan Cameron
  2011-07-25 13:18 ` [PATCH 4/7] staging:iio: squash chrdev handler remains into users Jonathan Cameron
  0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Cameron @ 2011-07-25 13:18 UTC (permalink / raw)
  To: linux-iio; +Cc: arnd, Jonathan Cameron

Hi All,

(for Arnd, the blue it is just the current IIO dev tree and this
is the middle of a fair number of other bits and bobs)

Also, updated the main documentation file.  Haven't checked the others
yet to see what else needs to change.

Changes since V1:

Basically fix the dumb issue with 'events' naming for the
sysfs directories and Arnds points about correct use of ioctls.

The ioctl docs patch is here, but probably won't merge just yet as
that file explicitly says it doesn't cover staging.  We'll nab the
range with the first round of stuff moving out of staging.

On going discussions about how to handle subdirs in sysfs mean I'll
be holding this one up for now. (Sysfs - export sysfs_create_subdir?
on lkml).

Thanks,

Jonathan

Jonathan Cameron (7):
  staging:iio:chrdev.h rationalization.
  staging:iio: remove specific chrdev for event reading. Get fd from
    ioctl on buffer.
  ioctl region for IIO.
  staging:iio: squash chrdev handler remains into users.
  staging:iio: push the main buffer chrdev down to the top level.
  staging:iio: remove now defunct header definitions and add some
    statics
  staging:iio:Documentation sysfs-bus-iio update for chrdev merge.

 Documentation/ioctl/ioctl-number.txt               |    1 +
 drivers/staging/iio/Documentation/generic_buffer.c |   12 +-
 drivers/staging/iio/Documentation/iio_utils.h      |    2 +-
 drivers/staging/iio/Documentation/sysfs-bus-iio    |  573 ++++++++++----------
 drivers/staging/iio/accel/adis16201_core.c         |    6 +-
 drivers/staging/iio/accel/adis16203_core.c         |    6 +-
 drivers/staging/iio/accel/adis16204_core.c         |    6 +-
 drivers/staging/iio/accel/adis16209_core.c         |    6 +-
 drivers/staging/iio/accel/adis16240_core.c         |    6 +-
 drivers/staging/iio/accel/lis3l02dq_core.c         |    6 +-
 drivers/staging/iio/accel/sca3000_core.c           |    7 +-
 drivers/staging/iio/accel/sca3000_ring.c           |   23 +-
 drivers/staging/iio/adc/ad7150.c                   |    1 +
 drivers/staging/iio/adc/ad7298_core.c              |    4 +-
 drivers/staging/iio/adc/ad7476_core.c              |    4 +-
 drivers/staging/iio/adc/ad7606_core.c              |    4 +-
 drivers/staging/iio/adc/ad7745.c                   |    1 +
 drivers/staging/iio/adc/ad7793.c                   |    6 +-
 drivers/staging/iio/adc/ad7816.c                   |    1 +
 drivers/staging/iio/adc/ad7887_core.c              |    4 +-
 drivers/staging/iio/adc/ad799x_core.c              |    6 +-
 drivers/staging/iio/adc/adt7310.c                  |    2 +
 drivers/staging/iio/adc/adt7410.c                  |    2 +
 drivers/staging/iio/adc/adt75.c                    |    1 +
 drivers/staging/iio/adc/max1363_core.c             |   10 +-
 drivers/staging/iio/addac/adt7316.c                |    2 +
 drivers/staging/iio/chrdev.h                       |   52 +--
 drivers/staging/iio/dac/ad5504.c                   |    1 +
 drivers/staging/iio/gyro/adis16260_core.c          |    6 +-
 drivers/staging/iio/iio.h                          |    3 +-
 drivers/staging/iio/iio_core.h                     |   39 +-
 drivers/staging/iio/imu/adis16400_core.c           |    6 +-
 drivers/staging/iio/industrialio-core.c            |  273 +++++-----
 drivers/staging/iio/industrialio-ring.c            |  220 +++-----
 drivers/staging/iio/kfifo_buf.c                    |   26 +-
 drivers/staging/iio/meter/ade7758.h                |    5 +-
 drivers/staging/iio/meter/ade7758_core.c           |    6 +-
 drivers/staging/iio/meter/ade7758_ring.c           |    4 +-
 drivers/staging/iio/ring_generic.h                 |   28 +-
 drivers/staging/iio/ring_sw.c                      |   25 +-
 40 files changed, 627 insertions(+), 769 deletions(-)

-- 
1.7.3.4


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-08-30 11:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-30 11:32 [PATCH 0/7] staging:iio: character device merge Jonathan Cameron
2011-08-30 11:32 ` [PATCH 1/7] staging:iio:kfifo buffer - push structure definition down into implementation Jonathan Cameron
2011-08-30 11:32 ` [PATCH 2/7] staging:iio:chrdev.h rationalization Jonathan Cameron
2011-08-30 11:32 ` [PATCH 3/7] staging:iio: remove specific chrdev for event reading. Get fd from ioctl on buffer Jonathan Cameron
2011-08-30 11:32 ` [PATCH 4/7] staging:iio: squash chrdev handler remains into users Jonathan Cameron
2011-08-30 11:32 ` [PATCH 5/7] staging:iio: push the main buffer chrdev down to the top level Jonathan Cameron
2011-08-30 11:32 ` [PATCH 6/7] staging:iio: remove now defunct header definitions and add some statics Jonathan Cameron
2011-08-30 11:32 ` [PATCH 7/7] staging:iio:Documentation sysfs-bus-iio update for chrdev merge Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2011-07-25 13:18 [PATCH 0/7 V2] blue part 5: IIO: Reduce to 1 the number of chrdevs per device Jonathan Cameron
2011-07-25 13:18 ` [PATCH 4/7] staging:iio: squash chrdev handler remains into users Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.