1
0
Fork 0
Commit Graph

21 Commits (b523bb75098b1ed4dd98cb651b7b71e5b8c4f533)

Author SHA1 Message Date
Jingoo Han e5e26dd5bb 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>
2013-09-08 15:16:07 +01:00
Lars-Peter Clausen 1e9663c62b iio:trigger: Introduce iio_tigger_{set,get}_drvdata
Introduce iio_tigger_{set,get}_drvdata which allows to attach driver specific
data to a trigger. The functions wrap access to the triggers private_data field
and all current users are updated to use iio_tigger_{set,get}_drvdata instead of
directly accessing the private_data field. This is the first step towards
removing the private_data field from the iio_trigger struct.

The following coccinelle script has been used to update the drivers:
<smpl>
@@
struct iio_trigger *trigger;
expression priv;
@@
-trigger->private_data = priv
+iio_trigger_set_drv_data(trigger, priv)

@@
struct iio_trigger *trigger;
@@
-trigger->private_data
+iio_trigger_get_drv_data(trigger)
</smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-03-25 21:06:09 +00:00
Bill Pemberton e543acf07d 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>
2012-11-21 15:02:23 -08:00
Bill Pemberton 447d4f29ee 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>
2012-11-21 14:59:37 -08:00
Bill Pemberton 4ae1c61ff2 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>
2012-11-21 14:31:41 -08:00
Jonathan Cameron 0f8c962004 staging:iio: Update email address for Jonathan Cameron.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-09-03 20:26:46 +01:00
Lars-Peter Clausen 8e82875268 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>
2012-08-27 18:58:11 +01:00
Lars-Peter Clausen 4bf8172772 staging:iio:trigger: Use to_iio_trigger() instead of dev_get_drvdata()
Use to_iio_trigger(dev) instead of dev_get_drvdata(dev). Both will return the
trigger which belongs to the device, but the the first on is a bit more
lightweight. Also this will eventually free up the drvdata pointer of the device
for driver specific data.

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>
2012-06-22 21:08:10 -07:00
Lars-Peter Clausen 7cbb753701 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>
2012-04-29 21:23:49 -04:00
Jonathan Cameron 06458e277e 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>
2012-04-25 11:01:43 -07:00
Michael Hennerich 5f953732ac staging: iio: Convert platform_drivers to use module_platform_driver
No functional changes.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-02 16:35:39 -08:00
Jonathan Cameron c0fdbe149c staging:iio: iio_trigger contains defunct owner field. Remove it.
This field moved into the trigger_ops structure a while back, but somehow
never quite got cleared up.  This clears the last few drivers to set it
(nothing uses it) and gets rid of it entirely.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-16 10:56:26 -08:00
Jonathan Cameron d29f73db79 staging:iio:triggers introduce iio_trigger_ops to take const bits out of iio_trig_structure.
Right now this results in increased code, but I still think it is worth doing to avoid
replication across instances of drivers etc and move as much stuff as possible to constant.
Ops structure is optional for the occasional driver that uses none of it (currently
only the ad7793).

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 13:31:06 -07:00
Jonathan Cameron 59c85e82c2 staging:iio:trigger handle name attr in core, remove old alloc and register any control_attrs via struct device
As the majority of triggers don't actually have any other control_attrs lets use the fact
that struct device has a groups element when we do need to have these attributes registered.
A vargs function is used to cut down on lots of building strings in every single driver
just in order to pass them into the allocate.

Also iio_allocate_trigger_named -> iio_allocate_trigger as there is no
unamed version any more, so that is now just confusing.

Blackfin tested and fixed by Michael Hennerich.

V2: Elements from Michael Hennerich's patches for the ade7758

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-19 16:15:02 -07:00
Jonathan Cameron 9dbfb6f14a staging: iio: Make use of the convenient IIO_TRIGGER_NAME_ATTR macro
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-09-04 21:19:01 -07:00
Jonathan Cameron 7b2c33b11e staging: iio: remove timestamp field from trigger and pass instead through pollfuncs
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-07-22 11:38:28 -07:00
Jonathan Cameron 3c9bbf58b2 staging: iio: Use kasprintf to allocate and fill trig->name
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-07-22 11:38:27 -07:00
Greg Kroah-Hartman d1d8abdb05 Staging: iio: trigger: fix up some global variables
These should be static.

Cc: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-11 11:36:10 -07:00
Tejun Heo 5a0e3ad6af 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>
2010-03-30 22:02:32 +09:00
Randy Dunlap 2fdec57610 Staging: iio: fix duplicate dev_attr_name
device attr's should be static, otherwise duplicate identifiers are
created:

drivers/staging/iio/trigger/iio-trig-gpio.o:(.data+0x1c): multiple definition of `dev_attr_name'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:26 -07:00
Jonathan Cameron 7f3a1fb998 Staging: IIO: Periodic timer based trigger
The original posting of this driver led to a discussion in
which it was commented that a better system was needed
for dealing with the many possible periodic interrupt
sources available on some SoCs.  Unfortunately that is
a big task and as far as I know, no-one has taken it
on as yet.  So in the meantime this driver is still
in here.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:25 -07:00