History log of /drivers/staging/iio/accel/sca3000_core.c
Revision Date Author Comments
d7b79519faa926a9d6d1cdebfddea7a58a9951f3 08-Jul-2014 Murilo Opsfelder Araujo <mopsfelder@gmail.com> staging: iio: accel: Add blank lines between declarations and code

This patch adds missing blank lines between declarations and code and
fixes lines starting by spaces, satisfying checkpatch.pl.

Signed-off-by: Murilo Opsfelder Araujo <mopsfelder@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2f29c16889ae71b42aefbe235867d88f8c892548 08-Jul-2014 Murilo Opsfelder Araujo <mopsfelder@gmail.com> staging: iio: accel: sca3000_core.c: Adjust code to fit 80-chars limit

Signed-off-by: Murilo Opsfelder Araujo <mopsfelder@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
bb0090e99b0194c76d2c46327f9d9dc9bba1c590 13-Jan-2014 Peter Meerwald <pmeerw@pmeerw.net> staging:iio:accel:sca3000: Move temperature attribute to channels

differantiate between channels with_temp and without

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
735165a8ee2ba5de723f014f4d6e77f99a51df62 13-Jan-2014 Peter Meerwald <pmeerw@pmeerw.net> staging:iio:accel:sca3000: Channels missing in temp_output case

issues introduced here 25888dc5,
staging:iio:sca3000 extract old event handling and move to poll for events

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
84bb9cdd035ee6ed63371ae926ed225ba51770f2 13-Jan-2014 Peter Meerwald <pmeerw@pmeerw.net> staging:iio:accel:sca3000: Event_attribute_group seems to be missing for _info_with_temp

issue introduced here 6fe8135f:
staging:iio: implement an iio_info structure to take some of the constant elements out of iio_dev

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
5262d8fdd9cdc8ef3ad8e1af8968f079dd81dde5 13-Jan-2014 Peter Meerwald <pmeerw@pmeerw.net> staging:iio:accel:sca3000: Fix format of comments

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
e6869759e06fde902828700a2d7c4a15d34c8d10 13-Jan-2014 Peter Meerwald <pmeerw@pmeerw.net> staging:iio:accel:sca3000: Fix kerneldoc

match function names with kerneldoc

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
cb955852a48c29ef7bd847ce993102e2b58295d4 07-Dec-2013 Lars-Peter Clausen <lars@metafoo.de> iio: Remove support for the legacy event config interface

Now that all drivers have been converted to the new event config interface we
can remove for the legacy event config interface. Also drop the '_new' suffix
for the event config interface callbacks, since those are the only callbacks
now.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
129c3f611a86d077314ab6a0a55ea05a0939db31 07-Oct-2013 Lars-Peter Clausen <lars@metafoo.de> staging:iio:sca3000: Switch to new config interface

Switch the sca3000 driver to the new IIO event config interface as the old one
is going to be removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
e5e26dd5bb740c34c975e2ae059126ba3486a1ce 20-Aug-2013 Jingoo Han <jg1.han@samsung.com> staging: iio: replace strict_strto*() with kstrto*()

The usage of strict_strto*() is not preferred, because
strict_strto*() is obsolete. Thus, kstrto*() should be
used.

Previously, there were only strict_strtol(), strict_strtoul(),
strict_strtoull(), and strict_strtoll(). Thus, when converting
to the variables, only long, unsigned long, unsigned long long,
and long long can be used.

However, kstrto*() provides various functions handling all types
of variables. Therefore, the types of variables can be changed
properly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
0189d93fdf82cd546d5e54c6f4f7c4622c90aa3c 24-Aug-2013 Sachin Kamat <sachin.kamat@linaro.org> staging: iio: sca3000: Use devm_iio_device_alloc

Using devm_iio_device_alloc makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
a8b21c5ccf47ec4e1fffcbc06a52592bb165b582 27-Feb-2013 Jonathan Cameron <jic23@kernel.org> staging:iio:accel:sca3000 move to info_mask_(shared_by_type/separate)

The original info_mask is going away in favour of the broken out versions.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
ad6c46b0c712e0d8fd8a80ee372b30f14a781888 09-Jan-2013 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Use spi_sync_transfer()

Use the new spi_sync_transfer() helper function instead of open-coding it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
e543acf07db78cfc135e45c4ce0ed26ccf774c37 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: iio: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
447d4f29ee3fa62f13c65688bb7b74d5a9a0d767 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: iio: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4ae1c61ff2ba4fea4e4c1a045cb1f34520608789 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: iio: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
67ad4e08dcc772153fda90cc747cfc9e03ab44f6 22-Sep-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio:sca3000: Do not return a error in remove function

In the Linux device driver model the remove callback is not allowed to fail and
the device will be removed regardless of the return value of the remove
callback. So if we abort in the remove function and do not free all resources we
will create a resource leak. Also all kinds of undefined behaviour are expected
to happen since the IIO device is still there while its parent is already gone.

The errors which the driver tries to handle in the remove function are
non-critical, so we can just ignore them and continue to free all resources and
remove the IIO device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
0f8c9620046d698b8a00d38d25dcdc1d2fa23592 02-Sep-2012 Jonathan Cameron <jic23@kernel.org> staging:iio: Update email address for Jonathan Cameron.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
8e8287526844441008df286536a21722277bb487 17-Aug-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Add missing __devinit and __devexit annotations

Autogenerated using the following coccinelle semantic patch:

// <smpl>
@r1@
identifier driver;
identifier fn;
position p;
type T;
@@
T driver = {
.remove =
(
fn@p
|
__devexit_p(fn@p)
)
};

@r2@
identifier r1.fn;
position p != r1.p;
@@
fn@p

@r3@
identifier r1.fn;
position r1.p;
@@
(
__devexit_p(fn@p)
|
-fn@p
+__devexit_p(fn)
)

@depends on !r2@
identifier r1.fn;
@@
static
-int fn
+int __devexit fn
(...) { ... }

@r11@
identifier driver;
identifier fn;
position p;
type T;
@@
T driver = {
.probe = fn@p
};

@r12@
identifier r11.fn;
position p != r11.p;
@@
fn@p

@depends on !r12@
identifier r11.fn;
@@
static
-int fn
+int __devinit fn
(...) { ... }
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
f4e4b9558bc696cc89de460e754d3fecb50b13cb 09-Aug-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Constify static iio_chan_spec arrays

The per driver iio_chan_spec arrays are usually shared between multiple device
instances. So a single device instance may not modify the iio_chan_spec array
since this would also affect the other device instances. To make this restriction
explicit mark the per driver iio_chan_spec arrays as const.

Conversion was done automatically using the following coccinelle semantic patch:

// <smpl>
@disable optional_qualifier@
identifier channels;
@@
static
+const
struct iio_chan_spec channels[] = ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
a91aff1c09fc41a55ccaa115763ff77e36b527d3 02-Jul-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Request threaded-only IRQs with IRQF_ONESHOT

Since commit 1c6c69525b ("genirq: Reject bogus threaded irq requests") threaded
IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise
the request will fail. This patch adds the IRQF_ONESHOT to IIO drivers where it
is missing.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
4b522ce709fd0591969ac9e8cfb52a8e44bac4b0 12-May-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio:accel: Use dev_to_iio_dev()

Replace open-coded instances of getting a iio_dev struct from a device struct
with dev_to_iio_dev().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7cbb753701d11f3c71e8543e1ae0fc0772edac06 26-Apr-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Streamline API function naming

Currently we use two different naming schemes in the IIO API, iio_verb_object
and iio_object_verb. E.g iio_device_register and iio_allocate_device. This
patches renames instances of the later to the former. The patch also renames allocate to
alloc as this seems to be the preferred form throughout the kernel.

In particular the following renames are performed by the patch:
iio_put_device -> iio_device_put
iio_allocate_device -> iio_device_alloc
iio_free_device -> iio_device_free
iio_get_trigger -> iio_trigger_get
iio_put_trigger -> iio_trigger_put
iio_allocate_trigger -> iio_trigger_alloc
iio_free_trigger -> iio_trigger_free

The conversion was done with the following coccinelle patch with manual fixes to
comments and documentation.

<smpl>
@@
@@
-iio_put_device
+iio_device_put
@@
@@
-iio_allocate_device
+iio_device_alloc
@@
@@
-iio_free_device
+iio_device_free
@@
@@
-iio_get_trigger
+iio_trigger_get
@@
@@
-iio_put_trigger
+iio_trigger_put
@@
@@
-iio_allocate_trigger
+iio_trigger_alloc
@@
@@
-iio_free_trigger
+iio_trigger_free
</smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
06458e277eac2b8761b0a04d3c808d57be281a2e 25-Apr-2012 Jonathan Cameron <jic23@kernel.org> IIO: Move core headers to include/linux/iio

Step 1 in moving the IIO core out of staging.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
31313fc64d51bbd8979997f9d6670cc882c5f963 15-Apr-2012 Jonathan Cameron <jic23@kernel.org> staging:iio:accel Add IIO_CHAN_INFO_RAW entries to all drivers.

Precursor to making value read / write attribute optional.
No processed values in accelerometers.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
691a4ca1b57ab268aaa9472c2f8f6ebc1aca31e9 13-Apr-2012 Jonathan Cameron <jic23@kernel.org> staging:iio:accel:sca3000 unwind use of IIO_CHAN macro.

This macro is being removed to simplify ongoing maintenance
so we need to unwind and remaining users.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f79a9098902635c7a2bcaf3d83fb5ce90c2c961f 05-Dec-2011 Jonathan Cameron <jic23@kernel.org> staging:iio:buffer struct iio_buffer doesn't need an indio_dev pointer.

In all existing cases, the calls are coming from a location where
the indio_dev is already available.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d666c0d490d85d35fe6d6d45ba029cf16046dc82 02-Dec-2011 Andreas Ruprecht <rupran@einserver.de> Staging: iio/accel: Added a range check for val in store_measurement_mode()

In sca3000_store_measurement_mode() we use val to and it with a mask.
This mask is only two bits long (as we are only interested in the
lowest two bits), so a value bigger than 3 was silently ignored so
far.

Now this function will return -EINVAL, if val is bigger than 3.

Signed-off-by: Andreas Ruprecht <rupran@einserver.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
bba42776f5bade198d3bf918689da02acb63dadb 02-Dec-2011 Andreas Ruprecht <rupran@einserver.de> Staging: iio/accel: Changed data type of mask in store_measurement_mode() to u8

In sca3000_store_measurement_mode() we parse a value from a string
buffer via kstrtou8, and store the parsed value into a u8 after
and-ing it with mask.

As we are only interested in the lowest two bits here and mask is
initialized with a fixed value 0x03, mask may as well be a u8.

Signed-off-by: Andreas Ruprecht <rupran@einserver.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3b724ca14565747926c23af1fa1afb1848c3f448 27-Nov-2011 Andreas Ruprecht <rupran@einserver.de> Staging: iio/accel: Changed data type of val in store_measurement_mode to u8

The code in sca3000_store_measurement_mode() uses the variable val to
do bitwise operations with an int mask and or-s it into st->rx[0] which
is an entry in a u8 array (see sca3000.h).

This means up to now values larger than a u8 were silently ignored and
just the lower 8 bits counted into the value that was written into
st->rx[0]. This code will return -ERANGE if the value in buf was too
large to fit into a u8.

Signed-off-by: Andreas Ruprecht <rupran@einserver.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
55e4390cb04e8b0fbae8983c3494c9e24132db1b 16-Nov-2011 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Add missing MODULE_DEVICE_TABLE and MODULE_ALIAS

Quite a few iio drivers provide no MODULE_DEVICE_TABLE or MODULE_ALIAS or only
provide a MODULE_ALIAS while they have support for multiple device ids. This
prevents auto module loading from working correctly.

This patch fixes it by adding the missing MODULE_DEVICE_TABLEs and
MODULE_ALIAS'.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c8a9f8056f40f6201b84fdddb49a1c62630902c5 26-Oct-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:treewide only use shared to decide on interfaces

Internally the fact that say scale is shared across channels is
actually of remarkably little interest. Hence lets not store it.
Numerous devices have weird combinations of channels sharing
scale anyway so it is not as though this was really telling
us much. Note however that we do still use the shared sysfs
attrs thus massively reducing the number of attrs in complex
drivers.

Side effect is that certain drivers that were abusing this
(mostly my work) needed to do a few more checks on what the
channel they are being queried on actually is.

This is also helpful for in kernel interfaces where we
just want to query the scale and don't care whether it
is shared with other channels or not.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
924f8a21dd13223cc1493a916c6769cf73e0d45e 26-Oct-2011 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Do not use bitmasks for channel info addresses

Currently the iio framework uses bitmasks for the address field of channel info
attributes. This is for historical reasons and no longer required since it will
only ever query a single info attribute at once. This patch changes the code to
use the non-shifted iio_chan_info_enum values for the info attribute address.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
af5046af1c812839f085030f358a01814666fc80 26-Oct-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: header reorganization

Issue brought up by Lars-Peter Clausen. This is a varient of what
he suggested.

io/iio.h for driver stuff (has to include types.h)
Sub files for the bits drivers may or may not use
iio/sysfs.h
iio/buffer.h (contents of current buffer_generic.h)
(obviously anything offering events will need events.h as well)
iio/types.h for the enums that matter to both
iio_chan_type, iio_modifier
iio/events.h for the event code stuff
IIO_EVENT_CODE and friends. + everything in chrdev.h So this
is the stuff that userspace cares about.
Also include iio_event_type, iio_event_direction

Thus iio drivers include iio.h + as required
events.h
sysfs.h
buffer.h

in kernel users (once that interface is merged) will need inkern.h
which will pull in types.h

Userspace will need just events.h (which pulls in types.h) to get
everything they need to know about. Buffer userspace access doesn't
currently need any core defines. All information about the data
format is passed through sysfs.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ae6ae6fec3f7d6919e0146996df37b665c75f662 16-Nov-2011 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Use module_spi_driver to register SPI driver

Use the newly introduced module_spi_driver macro for registering SPI drivers.
This allows us to remove a few lines of boilerplate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d2fffd6c2fd60fe9ab63ef30758d9d43a5057549 14-Oct-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: fix removal path to allow correct freeing.

Fix a dumb lack of consideration of the effect of combining
the iio_device_unregister and iio_free_device calls into
one. There is no valid place to free some of the sysfs
array elements.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3e2c96eab9278317569e2baf165f71042c927712 12-Oct-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: gpio build dependency fixing

Numerous drivers either had pointless includes of gpio.h
or should have been dependent on GENERIC_GPIO and were not.
Conversion of ads1210 to use array registration triggered
build failures that highlighted all was not well.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2579a0df14b07042f8803a841affdc8bd37132ac 06-Oct-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:accel:sca3000 dev_info to indio_dev renaming.

Again, there is a mix of the two names for the struct iio_dev.
Lets pick one and run with it.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14555b14455f9acbdf0e500ae96140828a970796 21-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: replacing term ring with buffer in the IIO core.

They aren't always ring buffers, so just use buffer for all naming.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3811cd6291bb5a11c8d830831149d6369e7d3b68 21-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: rename ring_generic.h -> buffer_generic.h

Nothing in this file is specific to RING buffers so rename it.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
322c95636739420631e51f3d3f24132dc220762a 14-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:tree wide. abi fixup for in_ out_ prefix introduction.

This patch set should bring all the attributes created outside
of chan_spec registration inline with the new abi.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
330c6c57e6284a755d7e8a031b3c917571ee6dc3 02-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:events - new 64 bit code structure and push out drivers.

This costs us nothing in event storage (as we are carrying a 64 bit
timestamp in the structure) and gives us lots more room to play with.

Also allows for more channels which some parts need.

V2: Cleanup some loose ends (such as the switch with only one option now).

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
bd94c6a8a6d3499e857002b1f445162fba941029 02-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:various move default scan mask setting after ring register or remove

The scan mask will be dynamically assigned in register, so don't
use it before that.

In adis16260 I've moved it as I know this driver has userspace code.
Same for sca3000 where it is cost free due to hardware buffer.
Can do that for the others, but in theory userspace code should always
have been checking these and setting them appropriately anyway!

V2: Clear default mask out of adis16400 as reported by Michael

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Reported-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c009f7e42617bd52b61a35de621cd1deda08042b 30-Aug-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:buffering cleanup ring_buffer_register_ex naming.

Now the old method is long gone, lets get rid of the _ex and whilst
here remove the unused id parameter.

Trivial mechanical change, but will break any out of tree drivers
using this.

V2: rebase
V3: rebase

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5aa9618896e0ba49b444731f9fafa7f7c18a13ab 30-Aug-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: remove broken support for multiple event interfaces.

We don't have a use case for these. Two drivers appeared to use them
but both report all events on the first.

V2: Remove now irrelevant comment.
V3: Include fixup for adc/ad7280a.c

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1aa042783251c27a93e31929c24647729db326d4 30-Aug-2011 Jonathan Cameron <jic23@cam.ac.uk> staging: iio: push the main buffer chrdev down to the top level.

Sorry all, this one is very invasive, though the driver changes are
just trivial interface fixes. Not all done yet.

V2 - bring the sca3000 with us.
V3 - fix ade7758 bugs in conversion.
V4 - add ad5933

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
8e7d967244a8eebcdadb048efc5e66849ec0a6b6 30-Aug-2011 Jonathan Cameron <jic23@cam.ac.uk> staging: iio: remove specific chrdev for event reading. Get fd from ioctl on buffer.

Change suggested by Arnd Bergmann.

No real reason to have two chrdevs per device. This step merges them into one.
Currently this means that events will only work on devices with buffers. THat will
be remedied shortly.

V2: set name for event attribute groups. Otherwise they all sorts of fun occurs on
dynamic channel event attribute creation.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
99c978529a40132a6f7a5f136b4362b56fc88d8c 03-Jul-2011 Paul Gortmaker <paul.gortmaker@windriver.com> staging: Add module.h to drivers/staging users

Lots of people expect module.h to just "be there" without
any #include effort. But we are crushing that. So fix those
files in staging relying on implicit module.h presence.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c4b14d99bbc93c9fa03b5934a07e95594efe7a93 12-Aug-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:events: use IIO_<TYPE> and IIO_MOD_<> instead of IIO_EV_CLASS_<TYPE> etc

The original definitions were duplicated to reduce tree churn during introduction of chan_spec
registration. Now there is no point in maintaining the two sets of definitions.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
355e25c1de7c87e3629cdcb11c2f95719b5ed807 12-Aug-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:sysfs cleanout header for unused definitions.

Also push one down into the only driver that actually uses it.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5b847ccbf52844a6a6ce95af45c0fd9f9e187c46 12-Aug-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:accel: usused header removals.

Missing from the iio_chan_spec conversion patches.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
03bda05d9ced3a80b2265d9da611c6670840abc7 29-Jun-2011 Dan Carpenter <error27@gmail.com> Staging: iio: some uninitialized variable bugs

There were some uninitialized variable warnings in iio. Two of
these came from the recent changes to how the private data was
allocated in 83f0422dc6a16 "staging:iio:accel:sca3000: allocate
state in iio_dev and use iio_priv to access."

drivers/staging/iio/accel/sca3000_core.c: In function 'sca3000_probe':
drivers/staging/iio/accel/sca3000_core.c:1137:9: warning: 'st' may be used uninitialized in this function
drivers/staging/iio/adc/ad7291.c: In function 'ad7291_probe':
drivers/staging/iio/adc/ad7291.c:805:15: warning: 'chip' may be used uninitialized in this function
drivers/staging/iio/dac/ad5624r_spi.c: In function 'ad5624r_probe':
drivers/staging/iio/dac/ad5624r_spi.c:228:24: warning: 'st' may be used uninitialized in this function

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
83f0422dc6a16ffa03d284b8dcce1344a91f79df 27-Jun-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:accel:sca3000: allocate state in iio_dev and use iio_priv to access.

Mechanical change.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
6fe8135fccd66aedcc55ded70824342587fd2499 18-May-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: implement an iio_info structure to take some of the constant elements out of iio_dev.

This was suggested by Arnd Bergmann, Other elements may well
move in here in future, but it definitely makes sense for these.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
845bd12ac78f92ba8905f45de7e17a4a8b3cef40 18-May-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: use the new central name attribute creation code

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
aaf370db7dad574e166f64cd9ad4129f12198145 18-May-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: Remove legacy event handling.

This requires all drivers using the channel registration code and
events to change in one go.

V3: remove unwanted irq enable from event handler.
V2: rebase related fixes to move to new IIO_CHAN macro. All trivial.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
25888dc51163a566f8c8f18a84c100851d12738c 18-May-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:sca3000 extract old event handling and move to poll for events from buffer

Fairly substantial rewrite as the code had bitrotted.
A rethink is needed for how to handle variable types in the new chan_spec world.

This patch restores sca3000 buffer usage to a working state.
V3: Rebase fixups.
V2: Move to new version of IIO_CHAN macro

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
6f7c8ee585e9db54cb29af1bdb93f29837824933 15-Apr-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: Add ability to allocate private data space to iio_allocate_device

Suggested by Arnd Bergmann. Note this will break ALL drivers that
are out of mainline. The fix is trivial change of
iio_allocate_device() -> iio_allocate_device(0)
Sorry if this causes issues for any one!

V2: Include new drivers in the update

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fc5d0e42545a74ccfb50ac8c769eb79cc8e6d6db 08-Oct-2010 Jonathan Cameron <jic23@cam.ac.uk> staging: iio: sca3000 event attribute name updates

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
de9fe32afcef9f84925cfb3e93074843df1d185b 08-Oct-2010 Jonathan Cameron <jic23@cam.ac.uk> staging: iio: sca3000 move to new event code scheme and add combined orientations

The combined orientations allow handling of typical motion and free fall
detectors to be handled as threshold events just applied to a number of
axes via boolean operations. So freefall is when x, y and z magnitudes
are all below a threshold for a particular period. Motion detectors
are typically whether x or y or z are above a particular value.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
51a0a5b02132f880ff2d2bd7dbbe73b2dfd708a4 31-Aug-2010 Manuel Stahl <manuel.stahl@iis.fraunhofer.de> staging: iio sync drivers with current ABI

Signed-off-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c608cb012e150d5c24b400ea89000105134bd564 23-May-2010 Mike Frysinger <vapier@gentoo.org> Staging: iio: kill off spurious semicolons

A bunch of IIO files contain spurious semicolons after function
definitions and case statements and if statements. Guess people
really like this thing, but kill them anyways so they'll stop
spreading via copy & paste with new drivers.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
26de7208281fd21606201ab3314f60e517d6c56f 04-May-2010 Jonathan Cameron <jic23@cam.ac.uk> Staging: iio: accelerometers trivial checkpatch related fixes

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
758d988ce089ac7345bc03a9116b5ebf10dbfa9e 04-May-2010 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: Remove naming via IDR's where no longer necessary under new abi.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
f3fb001191a38a81bbc3cb363af2c279609ecc7c 04-May-2010 Jonathan Cameron <jic23@cam.ac.uk> iio:staging:accelerometers move towards the new abi

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
bbc9a9916bc1cd997f3bf303e7930d5f3c804d37 14-Nov-2009 André Goddard Rosa <andre.goddard@gmail.com> Staging: fix assorted typos all over the place

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
574fb258d63658e4564c32c1940068a3bad666a0 18-Aug-2009 Jonathan Cameron <jic23@cam.ac.uk> Staging: IIO: VTI sca3000 series accelerometer driver (spi)

Example of how a device with a hardware ring buffer is
handled within IIO.

Changes since V2:
* Moved to new registration functions giving much cleaner
interface.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>