linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6 V6] IIO: in kernel (as opposed to userspace) pull consumers
@ 2012-02-15 19:47 Jonathan Cameron
  2012-02-15 19:48 ` [PATCH 1/6] staging:iio:core set the iio_dev.info pointer to null on unregister under lock Jonathan Cameron
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Jonathan Cameron @ 2012-02-15 19:47 UTC (permalink / raw)
  To: linux-iio
  Cc: greg, guenter.roeck, khali, dmitry.torokhov, broonie, alan, arnd,
	linus.walleij, maxime.ripard, thomas.petazzoni, zdevai, w.sang,
	marek.vasut, Jonathan Cameron

Previously IIO: in kernel pull interfaces.

Changes since the RFC V5.  The race condition on exit is avoided by
the introduction of the first patch and related modifications later.
All in kernel consumers ultimately access the IIO devices through
the iio_info structure pointer in the relevant iio_dev structure.
Thus (protected by a mutex) we can set this to null on device removal
and check it in users.  Thus ensuring a clean error is returned if
the provider is removed before the consumer has finished with it.
Right now there is nothing to even make this hard but we can
easily get the module at a later date to cut down on this happening.

Otherwise, I've made the whole thing no longer an option for IIO
as suggested by Linus.

Few cleanups beyond that from testing and appopriate updates to the
documentation.

Any comments?  I'd like to get this out the way so we can move
on to the more 'interesting' case of push interfaces (those that
are interrupt driven).  Patches for that are ready but need cleaning
up and are more invasive that these within IIO itself.

Jonathan

Jonathan Cameron (6):
  staging:iio:core set the iio_dev.info pointer to null on unregister
    under lock.
  staging:iio:core add in kernel interface mapping and getting IIO
    channels.
  staging:iio: move iio data return types into types.h for use by
    inkern
  staging:iio::hwmon interface client driver.
  staging:iio:Documentation in kernel pull description.
  stargate2: example of map configuration for iio to hwmon example.

 arch/arm/mach-pxa/stargate2.c                  |   24 ++
 drivers/staging/iio/Documentation/inkernel.txt |   58 +++++
 drivers/staging/iio/Kconfig                    |    7 +
 drivers/staging/iio/Makefile                   |    4 +-
 drivers/staging/iio/consumer.h                 |   96 ++++++++
 drivers/staging/iio/driver.h                   |   34 +++
 drivers/staging/iio/iio.h                      |    8 +-
 drivers/staging/iio/iio_hwmon.c                |  232 +++++++++++++++++++
 drivers/staging/iio/industrialio-core.c        |    4 +
 drivers/staging/iio/inkern.c                   |  292 ++++++++++++++++++++++++
 drivers/staging/iio/machine.h                  |   24 ++
 drivers/staging/iio/types.h                    |    4 +
 12 files changed, 780 insertions(+), 7 deletions(-)
 create mode 100644 drivers/staging/iio/Documentation/inkernel.txt
 create mode 100644 drivers/staging/iio/consumer.h
 create mode 100644 drivers/staging/iio/driver.h
 create mode 100644 drivers/staging/iio/iio_hwmon.c
 create mode 100644 drivers/staging/iio/inkern.c
 create mode 100644 drivers/staging/iio/machine.h

-- 
1.7.8.4


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [RFC V3 PATCH 0/6] IIO in kernel interfaces
@ 2011-10-20  9:33 Jonathan Cameron
  2011-10-20  9:33 ` [PATCH 6/6] stargate2: example of map configuration for iio to hwmon example Jonathan Cameron
  0 siblings, 1 reply; 16+ messages in thread
From: Jonathan Cameron @ 2011-10-20  9:33 UTC (permalink / raw)
  To: linux-kernel, linux-iio
  Cc: linus.ml.walleij, zdevai, linux, arnd, broonie, gregkh,
	lm-sensors, guenter.roeck, khali, thomas.petazzoni, maxime.ripard,
	Jonathan Cameron

Since V2:

Fixes as per Guenter's comments on the iio_hwmon driver.
Only one that differred slightly from Guenters suggestion
is the value calculation where I reordered things to reduce
the chance of overflow as well as casting to longs.
Thanks Guenter!

Since V1:
Uses the bus's list of devices instead of having a local one.
     (thanks to Lars-Peter).

Added are interfaces for getting all channels mapped to a particular
device.

Hwmon driver is now vaguely complete - hence cc'd hwmon. If people
are happy I'd expect this to ultimately end up in drivers/hmwon.
Right now it is acting as a test driver for these interfaces.

Thanks and all comments welcome. I've added hwmon to the cc list 
this time round.

V1 message:
There are obviously some rough corners in here that will need cleaning up.
For now I've just put this out there to see if anyone radically disagrees
on the direction.  It sits on top the recent rfc to move first bit of IIO
out of staging with a few buglets fixed.  Best bet if anyone wants to
test is to pull from:

https://github.com/jic23/linux-iio/tree/outofstaging

which now also includes these patches.

Intereresting patches are 3 and 4.  5 gives a trivial example of
a driver using this (hwmon driver that only takes first matching channel
and sticks it out as in1_input - breaks all sorts elements of the hwmon
interface spec.)

For now I've gone with Mark Brown's suggestion of a datasheet_name for
finding the channels on the device.  Patch 2 hacks this name into the
max1363 driver.  I'll probably put a version matching on channel number and
type in at a later date.

Here we just have a pull interface.  Push is considerably harder to do
and needs quite a lot more of the IIO infrastructure to be in place
(triggers / buffers etc). Events obviously require IIO event handling
to be there. Hence all of that will have to wait until those elements
have in of themselves been posted for review.

It is pretty clear to me that hwmon interface for starters needs the
ability to say - 'give me all mappings that correspond to me'.

This is what I intend to add next followed by some utility functions
to make it easy to match the hwmon interface.

At that point I'll propose the hwmon driver goes into drivers/hwmon
(subject to the underlying iio stuff merging).

Fun fun fun.  Thanks to Linus an Mark for their input on this.
Hope this is roughly what you guys were looking for.

Also on my list to do is to check this very thoroughly for any
possible race conditions around the removal of the underlying
device.

Jonathan

Jonathan Cameron (6):
  IIO: core: add datasheet_name to chan_spec
  IIO:ADC:max1363 add datasheet_name entries.
  IIO:CORE: put defs needed by inkern and userspace interfaces into
    chan_spec.h
  IIO:CORE add in kernel interface mapping and getting IIO channels.
  IIO:hwmon interface client driver.
  stargate2: example of map configuration for iio to hwmon example.

 arch/arm/mach-pxa/stargate2.c  |   23 ++++
 drivers/Makefile               |    2 +-
 drivers/iio/Kconfig            |    8 +
 drivers/iio/Makefile           |    2 +
 drivers/iio/adc/max1363_core.c |    4 +-
 drivers/iio/iio.c              |  279 +++++++++++++++++++++++++++++++++++++++-
 drivers/iio/iio_hwmon.c        |  227 ++++++++++++++++++++++++++++++++
 drivers/iio/inkern.c           |   21 +++
 include/linux/iio/chan_spec.h  |   46 +++++++
 include/linux/iio/iio.h        |   41 +-----
 include/linux/iio/inkern.h     |   87 +++++++++++++
 11 files changed, 700 insertions(+), 40 deletions(-)
 create mode 100644 drivers/iio/iio_hwmon.c
 create mode 100644 drivers/iio/inkern.c
 create mode 100644 include/linux/iio/chan_spec.h
 create mode 100644 include/linux/iio/inkern.h

-- 
1.7.7


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [RFC V2 PATCH 0/6] IIO in kernel interfaces
@ 2011-10-19 14:47 Jonathan Cameron
  2011-10-19 14:47 ` [PATCH 6/6] stargate2: example of map configuration for iio to hwmon example Jonathan Cameron
  0 siblings, 1 reply; 16+ messages in thread
From: Jonathan Cameron @ 2011-10-19 14:47 UTC (permalink / raw)
  To: linux-kernel, linux-iio
  Cc: linus.ml.walleij, zdevai, linux, arnd, broonie, gregkh,
	lm-sensors, guenter.roeck, khali, Jonathan Cameron

Dear All,

Since V1:
Uses the bus's list of devices instead of having a local one.
     (thanks to Lars-Peter).

Added are interfaces for getting all channels mapped to a particular
device.

Hwmon driver is now vaguely complete - hence cc'd hwmon. If people
are happy I'd expect this to ultimately end up in drivers/hmwon.
Right now it is acting as a test driver for these interfaces.

Thanks and all comments welcome. I've added hwmon to the cc list 
this time round.

V1 message:
There are obviously some rough corners in here that will need cleaning up.
For now I've just put this out there to see if anyone radically disagrees
on the direction.  It sits on top the recent rfc to move first bit of IIO
out of staging with a few buglets fixed.  Best bet if anyone wants to
test is to pull from:

https://github.com/jic23/linux-iio/tree/outofstaging

which now also includes these patches.

Intereresting patches are 3 and 4.  5 gives a trivial example of
a driver using this (hwmon driver that only takes first matching channel
and sticks it out as in1_input - breaks all sorts elements of the hwmon
interface spec.)

For now I've gone with Mark Brown's suggestion of a datasheet_name for
finding the channels on the device.  Patch 2 hacks this name into the
max1363 driver.  I'll probably put a version matching on channel number and
type in at a later date.

Here we just have a pull interface.  Push is considerably harder to do
and needs quite a lot more of the IIO infrastructure to be in place
(triggers / buffers etc). Events obviously require IIO event handling
to be there. Hence all of that will have to wait until those elements
have in of themselves been posted for review.

It is pretty clear to me that hwmon interface for starters needs the
ability to say - 'give me all mappings that correspond to me'.

This is what I intend to add next followed by some utility functions
to make it easy to match the hwmon interface.

At that point I'll propose the hwmon driver goes into drivers/hwmon
(subject to the underlying iio stuff merging).

Fun fun fun.  Thanks to Linus an Mark for their input on this.
Hope this is roughly what you guys were looking for.

Also on my list to do is to check this very thoroughly for any
possible race conditions around the removal of the underlying
device.

Jonathan

Jonathan Cameron (6):
  IIO: core: add datasheet_name to chan_spec
  IIO:ADC:max1363 add datasheet_name entries.
  IIO:CORE: put defs needed by inkern and userspace interfaces into
    chan_spec.h
  IIO:CORE add in kernel interface mapping and getting IIO channels.
  IIO:hwmon interface client driver.
  stargate2: example of map configuration for iio to hwmon example.

 arch/arm/mach-pxa/stargate2.c  |   23 ++++
 drivers/Makefile               |    2 +-
 drivers/iio/Kconfig            |    8 +
 drivers/iio/Makefile           |    2 +
 drivers/iio/adc/max1363_core.c |    4 +-
 drivers/iio/iio.c              |  279 +++++++++++++++++++++++++++++++++++++++-
 drivers/iio/iio_hwmon.c        |  214 ++++++++++++++++++++++++++++++
 drivers/iio/inkern.c           |   21 +++
 include/linux/iio/chan_spec.h  |   46 +++++++
 include/linux/iio/iio.h        |   41 +-----
 include/linux/iio/inkern.h     |   87 +++++++++++++
 11 files changed, 687 insertions(+), 40 deletions(-)
 create mode 100644 drivers/iio/iio_hwmon.c
 create mode 100644 drivers/iio/inkern.c
 create mode 100644 include/linux/iio/chan_spec.h
 create mode 100644 include/linux/iio/inkern.h

-- 
1.7.7


^ permalink raw reply	[flat|nested] 16+ messages in thread
* [RFC PATCH 0/6] IIO in kernel interfaces.
@ 2011-10-18 15:29 Jonathan Cameron
  2011-10-18 15:29 ` [PATCH 6/6] stargate2: example of map configuration for iio to hwmon example Jonathan Cameron
  0 siblings, 1 reply; 16+ messages in thread
From: Jonathan Cameron @ 2011-10-18 15:29 UTC (permalink / raw)
  To: linux-kernel, linux-iio
  Cc: linus.ml.walleij, zdevai, linux, arnd, broonie, gregkh,
	Jonathan Cameron

There are obviously some rough corners in here that will need cleaning up.
For now I've just put this out there to see if anyone radically disagrees
on the direction.  It sits on top the recent rfc to move first bit of IIO
out of staging with a few buglets fixed.  Best bet if anyone wants to
test is to pull from:

https://github.com/jic23/linux-iio/tree/outofstaging

which now also includes these patches.

Intereresting patches are 3 and 4.  5 gives a trivial example of
a driver using this (hwmon driver that only takes first matching channel
and sticks it out as in1_input - breaks all sorts elements of the hwmon
interface spec.)

For now I've gone with Mark Brown's suggestion of a datasheet_name for
finding the channels on the device.  Patch 2 hacks this name into the
max1363 driver.  I'll probably put a version matching on channel number and
type in at a later date.

Here we just have a pull interface.  Push is considerably harder to do
and needs quite a lot more of the IIO infrastructure to be in place
(triggers / buffers etc). Events obviously require IIO event handling
to be there. Hence all of that will have to wait until those elements
have in of themselves been posted for review.

It is pretty clear to me that hwmon interface for starters needs the
ability to say - 'give me all mappings that correspond to me'.

This is what I intend to add next followed by some utility functions
to make it easy to match the hwmon interface.

At that point I'll propose the hwmon driver goes into drivers/hwmon
(subject to the underlying iio stuff merging).

Fun fun fun.  Thanks to Linus an Mark for their input on this.
Hope this is roughly what you guys were looking for.

Also on my list to do is to check this very thoroughly for any
possible race conditions around the removal of the underlying
device.

Jonathan

Jonathan Cameron (6):
  IIO: core: add datasheet_name to chan_spec
  IIO:ADC:max1363 add datasheet_name entries.
  IIO:CORE add global list of registered IIO devices.
  IIO:Core add in kernel interface mapping and getting IIO channels.
  IIO:Temporary example hwmon interface.
  stargate2: example of map configuration for iio to hwmon example.

 arch/arm/mach-pxa/stargate2.c  |   23 ++++++++
 drivers/Makefile               |    2 +-
 drivers/iio/Kconfig            |    7 ++
 drivers/iio/Makefile           |    2 +
 drivers/iio/adc/max1363_core.c |    4 +-
 drivers/iio/iio.c              |  121 ++++++++++++++++++++++++++++++++++++++++
 drivers/iio/iio_hwmon.c        |  104 ++++++++++++++++++++++++++++++++++
 drivers/iio/inkern.c           |   21 +++++++
 include/linux/iio/iio.h        |    9 +++-
 include/linux/iio/inkern.h     |   63 +++++++++++++++++++++
 10 files changed, 353 insertions(+), 3 deletions(-)
 create mode 100644 drivers/iio/iio_hwmon.c
 create mode 100644 drivers/iio/inkern.c
 create mode 100644 include/linux/iio/inkern.h

-- 
1.7.7

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

end of thread, other threads:[~2012-02-25 11:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-15 19:47 [PATCH 0/6 V6] IIO: in kernel (as opposed to userspace) pull consumers Jonathan Cameron
2012-02-15 19:48 ` [PATCH 1/6] staging:iio:core set the iio_dev.info pointer to null on unregister under lock Jonathan Cameron
2012-02-15 19:48 ` [PATCH 2/6] staging:iio:core add in kernel interface mapping and getting IIO channels Jonathan Cameron
2012-02-15 19:48 ` [PATCH 3/6] staging:iio: move iio data return types into types.h for use by inkern Jonathan Cameron
2012-02-15 19:48 ` [PATCH 4/6] staging:iio::hwmon interface client driver Jonathan Cameron
2012-02-15 19:48 ` [PATCH 5/6] staging:iio:Documentation in kernel pull description Jonathan Cameron
2012-02-15 19:48 ` [PATCH 6/6] stargate2: example of map configuration for iio to hwmon example Jonathan Cameron
2012-02-15 21:07   ` Jonathan Cameron
2012-02-24 20:07     ` Greg KH
2012-02-25 11:19       ` Jonathan Cameron
2012-02-15 21:11 ` [PATCH 5.5/6] staging:iio:max1363 enable use with inkernel interfaces Jonathan Cameron
2012-02-15 21:50 ` [PATCH 0/6 V6] IIO: in kernel (as opposed to userspace) pull consumers Linus Walleij
2012-02-24 20:10   ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2011-10-20  9:33 [RFC V3 PATCH 0/6] IIO in kernel interfaces Jonathan Cameron
2011-10-20  9:33 ` [PATCH 6/6] stargate2: example of map configuration for iio to hwmon example Jonathan Cameron
2011-10-19 14:47 [RFC V2 PATCH 0/6] IIO in kernel interfaces Jonathan Cameron
2011-10-19 14:47 ` [PATCH 6/6] stargate2: example of map configuration for iio to hwmon example Jonathan Cameron
2011-10-18 15:29 [RFC PATCH 0/6] IIO in kernel interfaces Jonathan Cameron
2011-10-18 15:29 ` [PATCH 6/6] stargate2: example of map configuration for iio to hwmon example Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).