platform/kernel/linux-rpi.git
11 years agostaging: comedi: refactor comedi_dev_from_minor()
Ian Abbott [Thu, 4 Apr 2013 13:59:12 +0000 (14:59 +0100)]
staging: comedi: refactor comedi_dev_from_minor()

Refactor `comedi_dev_from_minor()` to call one of two new functions
`comedi_dev_from_board_minor()` (for minor device numbers less than
`COMEDI_NUM_BOARD_MINORS`) or `comedi_dev_from_subdevice_minor()` (for
minor device numbers greater than or equal to `COMEDI_NUM_BOARD_MINORS`,
which are subdevice minor device numbers).

Remove `comedi_file_info_from_minor()` as it is no longer used.

This is a step towards removing `struct comedi_file_info`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: reduce use of struct comedi_file_info
Ian Abbott [Thu, 4 Apr 2013 13:59:11 +0000 (14:59 +0100)]
staging: comedi: reduce use of struct comedi_file_info

Since the parameters of `comedi_read_subdevice()` and
`comedi_write_subdevice()` have changed, there is no longer a need to
keep a local variable `struct comedi_file_info *info` hanging around in
the file operation functions and device attribute access functions.
Remove the variable from those function and replace the call sequence
`info = comedi_file_info_from_minor(minor)`,  `dev =
comedi_dev_from_file_info(info)` with the simpler `dev =
comedi_dev_from_minor(minor)`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: change comedi_read/write_subdevice() parameters
Ian Abbott [Thu, 4 Apr 2013 13:59:10 +0000 (14:59 +0100)]
staging: comedi: change comedi_read/write_subdevice() parameters

`comedi_read_subdevice()` and `comedi_write_subdevice()` currently take
a single parameter pointing to a `struct comedi_file_info`.  I'm trying
to get rid of `struct comedi_file_info` so as part of that plan,
`comedi_read_subdevice()` and `comedi_write_subdevice()` need to change.
Change them to take two parameters: a pointer to a `struct
comedi_device` and a minor device number.  If the minor device number is
a "board" minor device number (`minor < COMEDI_NUM_BOARD_MINORS`) we'll
always return the default read or write subdevice.  If the minor device
number if a "subdevice" minor device number a different read or write
subdevice may be returned.  In that case, use the subdevice minor device
number to look up the information about whether the default read or
write subdevice needs to be overridden.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: use minor device number in attribute functions
Ian Abbott [Thu, 4 Apr 2013 13:59:09 +0000 (14:59 +0100)]
staging: comedi: use minor device number in attribute functions

The comedi device attribute functions such as
`show_max_read_buffer_kb()` call `dev_get_drvdata()` to get a pointer to
a `struct comedi_file_info` from the private driver data field of class
device.  Change them to use the minor device number to look up this
pointer value so they behave more like the file operation functions.
Check the pointer is non-NULL as the entry in the minor device table
could have been set to NULL.  Note that there is still a race condition
in the use of this pointer value after acquiring the mutex which needs
to be dealt with once reference counting has been implemented for comedi
devices.

The calls to `dev_set_drvdata()` from `comedi_alloc_board_minor()` and
`comedi_alloc_subdevice_minor()` are no longer needed so remove them.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: get mutex before subdevice in attribute functions
Ian Abbott [Thu, 4 Apr 2013 13:59:08 +0000 (14:59 +0100)]
staging: comedi: get mutex before subdevice in attribute functions

The comedi device attribute functions such as
`show_read_buffer_kb()` or `show_write_buffer_kb()` call
`comedi_read_subdevice()` or `comedi_write_subdevice()` without
acquiring the comedi device's mutex first, although the functions do
acquire the mutex afterwards.  Change them to acquire the mutex first.
This is consistent with most of the comedi device file operation
functions (apart from `comedi_read()` and `comedi_write()` which
probably need looking at).

Despite the use of the mutex, there are still race conditions as the
`struct comedi_file_info *info` variable value set before acquiring the
mutex could be stale after acquiring the mutex.  This problem will be
dealt with once reference counting has been implemented for the comedi
devices.

This patch also adds local variable `struct comedi_device *dev` to the
functions to reduce the use of the `info` variable a little bit.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rename dev parameter of device attribute functions
Ian Abbott [Thu, 4 Apr 2013 13:59:07 +0000 (14:59 +0100)]
staging: comedi: rename dev parameter of device attribute functions

Most of the comedi core uses the identifier `dev` to point to a `struct
comedi_device`.  The device sysfs attribute functions such as
`show_max_read_buffer_kb()` use the parameter id `dev` to point to a
`struct device`.  Rename the parameter to `csdev` for "class device" for
consistency with the functions that call `device_create()` to create
these class devices (`comedi_alloc_board_minor()` and
`comedi_alloc_subdevice_minor()`).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: remove hardware_device from struct comedi_device_info
Ian Abbott [Thu, 4 Apr 2013 13:59:06 +0000 (14:59 +0100)]
staging: comedi: remove hardware_device from struct comedi_device_info

The `hardware_device` member of `struct comedi_device_info` is only set
to point to a hardware device by the auto-configuration code (specifically
`comedi_alloc_board_minor() with a non-NULL `hardware_device` parameter)
so that it can be found again by the auto-unconfiguration code
(specifically `comedi_release_hardware_device()`).  However, as
`info->device->hw_dev` (where `info` is a pointer to the `struct
comedi_device_info`) is set to the same value as `info->hardware_device`
(by calling `comedi_set_hw_dev()` with the same hardware device pointer)
we can look for that instead, so there is no need for the
`hardware_device` member any more.  Get rid of it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: remove comedi_clear_minor()
Ian Abbott [Thu, 4 Apr 2013 13:59:05 +0000 (14:59 +0100)]
staging: comedi: remove comedi_clear_minor()

`comedi_clear_minor()` calls either `comedi_clear_board_minor()` or
`comedi_clear_subdevice_minor()` depending on its minor device number
parameter.  The one it calls only depends on where it is called from, so
bypass the calls to `comedi_clear_minor()` and remove it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: separate board and subdevice minor tables
Ian Abbott [Thu, 4 Apr 2013 13:59:04 +0000 (14:59 +0100)]
staging: comedi: separate board and subdevice minor tables

The comedi core reserves minor device numbers from 0 to
`COMEDI_NUM_BOARD_MINORS - 1` (0 to 0x30 - 1) for the main comedi
"board" devices and reserves minor device numbers from
`COMEDI_NUM_BOARD_MINORS` to `COMEDI_NUM_MINORS - 1` (0x30 to 0x100 - 1)
for comedi subdevices (or at least those that claim to support
asynchronous comedi commands).  There is an array
`comedi_file_info_table[COMEDI_NUM_MINORS]` used to hold pointers to
information for each board minor device number and subdevice minor
device number that has been allocated (with NULL pointers for those not
allocated), along with a protective lock `comedi_file_info_table_lock`.

Since the ranges of board minor device numbers and subdevice minor
device numbers do not overlap, we can use separate tables and separate
locks for the different types of minor device numbers.  This will allow
us to use different pointer types for the elements of each table in the
future without just using a generic `void *`.  (At the moment, the table
elements point to a `struct comedi_file_info` allocated dynamically for
each allocated board minor device or subdevice minor device, but I plan
to get rid of that data structure.)

Replace `comedi_file_info_table[COMEDI_NUM_MINORS]` with two new arrays
of the same type, `comedi_board_minor_table[COMEDI_NUM_BOARD_MINORS]`
for board minors, and
`comedi_subdevice_minor_table[COMEDI_NUM_SUBDEVICE_MINORS]` for
subdevice minors (where `COMEDI_NUM_SUBDEVICE_MINORS` is
`COMEDI_NUM_MINORS - COMEDI_NUM_BOARD_MINORS`).
`comedi_subdevice_minor_table[]` is indexed by the subdevice minor
number minus `COMEDI_NUM_BOARD_MINORS` since `COMEDI_NUM_BOARD_MINORS`
is the first valid subdevice minor number.

Replace `comedi_file_info_table_lock` with
`comedi_board_minor_table_lock` for board minors and
`comedi_subdevice_minor_table_lock` for subdevice minors.

Refactor `comedi_clear_minor()` to call one of two new functions
`comedi_clear_board_minor()` and `comedi_clear_subdevice_minor()`
depending on the minor device number passed as a parameter.  Similarly,
refactor `comedi_file_info_from_minor()` to call one of two new
functions `comedi_file_info_from_board_minor()` and
`comedi_file_info_from_subdevice_minor()` depending on the minor device
number parameter.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: remove COMEDI_FIRST_SUBDEVICE_MINOR
Ian Abbott [Thu, 4 Apr 2013 13:59:03 +0000 (14:59 +0100)]
staging: comedi: remove COMEDI_FIRST_SUBDEVICE_MINOR

The macro `COMEDI_FIRST_SUBDEVICE_MINOR` just expands to another macro
`COMEDI_NUM_BOARD_MINORS`.  Replace uses of
`COMEDI_FIRST_SUBDEVICE_MINOR` with `COMEDI_NUM_BOARD_MINORS` and get
rid of the former.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: move COMEDI_NUM_MINORS and COMEDI_FIRST_SUBDEVICE_MINOR
Ian Abbott [Thu, 4 Apr 2013 13:59:02 +0000 (14:59 +0100)]
staging: comedi: move COMEDI_NUM_MINORS and COMEDI_FIRST_SUBDEVICE_MINOR

The macro definitions `COMEDI_NUM_MINORS` and
`COMEDI_FIRST_SUBDEVICE_MINOR` are only used in "comedi_fops.c" so move
them to there from "comedidev.h".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: change comedi_file_info_table_lock to mutex
Ian Abbott [Thu, 4 Apr 2013 13:59:01 +0000 (14:59 +0100)]
staging: comedi: change comedi_file_info_table_lock to mutex

The spin-lock `comedi_file_info_table_lock` is used to protect against
simultaneous modification and access of `comedi_file_info_table[]`.
Change it from a spin-lock to a mutex as it is only used in contexts
where sleeping is allowed.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: set hw_dev in comedi_alloc_board_minor()
Ian Abbott [Thu, 4 Apr 2013 13:59:00 +0000 (14:59 +0100)]
staging: comedi: set hw_dev in comedi_alloc_board_minor()

Call `comedi_set_hw_dev()` to set the `hw_dev` member of `struct
comedi_device` in `comedi_alloc_board_minor()` instead of in
`comedi_auto_config()`.  Don't bother to check for an error returned by
`comedi_set_hw_dev()` here; it only fails when changing a non-NULL
pointer to a different non-NULL pointer and since the `struct
comedi_device` has just been allocated and initialized, its `hw_dev`
will be NULL already.  Calling `comedi_set_hw_dev()` with a non-NULL
hardware device pointer increments the kref counter for the hardware
device.

If `comedi_alloc_board_minor()` fails further down the function, we rely
on its call to `comedi_device_cleanup()` to call `comedi_clear_hw_dev()`
(via `comedi_device_detach()` and `cleanup_device()`) to clear `hw_dev`
and decrement its kref counter.  (That's the "beneficial side-effect"
mentioned in the patch that replaced `__comedi_device_detach()`.)

Remove the call to `comedi_set_hw_dev()` from `comedi_auto_config()` as
the call to `comedi_alloc_board_minor()` does it for us.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: move detach out of post-config
Ian Abbott [Thu, 4 Apr 2013 13:58:59 +0000 (14:58 +0100)]
staging: comedi: move detach out of post-config

`comedi_device_postconfig()` calls `comedi_device_detach()` on failure.
Remove that call and make the callers of `comedi_device_postconfig()`
call `comedi_device_detach()` themselves if it returns an error.  This
seems more logical as the callers of `comedi_device_postconfig()` called
`comedi_device_detach()` anyway if they didn't call
`comedi_device_postconfig()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: replace __comedi_device_detach()
Ian Abbott [Thu, 4 Apr 2013 13:58:58 +0000 (14:58 +0100)]
staging: comedi: replace __comedi_device_detach()

`comedi_device_detach()` does nothing if the `struct comedi_device`'s
`attached` member is false, otherwise it calls
`__comedi_device_detach()` to do the real work.
`__comedi_device_detach()` is called from various other functions in
"drivers.c" (`comedi_device_postconfig()`, `comedi_device_attach()`, and
`comedi_auto_config()`) to bypass the check for the `attached` member
being false.

If we make `__comedi_device_detach()` safe to call when the `attached`
member is already false, we can remove the check in
`comedi_device_detach()`, subsume `__comedi_device_detach()` within
`comedi_device_detach()`, and replace all the calls to
`__comedi_device_detach()` with calls to `comedi_device_detach()`.

In fact, it is already safe to call `__comedi_device_detach()` when the
`attached` member is false.  We just need to remove the warning message
it outputs when the `driver` member is NULL.  Then the function becomes
idempotent without outputting spurious warnings.  (It is idempotent
because `dev->driver->detach()` will only be called once at most and the
call to `cleanup_device()` is idempotent itself.)

Combine `comedi_device_detach()` with `__comedi_device_detach()`,
removing the check for the `attached` member being false and removing
the warning about the `driver` member being NULL, and replace all calls
to `__comedi_device_detach()` with calls to the combined
`comedi_device_detach()`.

A beneficial side-effect of the above change is that a call to
`comedi_device_detach()` will always result in a call to
`cleanup_device()` and so always result in a call to
`comedi_clear_hw_dev()`.  We will make use of this beneficial
side-effect in a later patch.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: put module _after_ detach
Ian Abbott [Thu, 4 Apr 2013 13:58:57 +0000 (14:58 +0100)]
staging: comedi: put module _after_ detach

On failure of the call to the low-level comedi device driver's
`->attach()` handler from `__comedi_device_attach()`, reverse the
current ordering of the calls to `module_put()` and
`comedi_device_detach()` because `__comedi_device_detach()` will call
code in the module being put.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: simplify driver module counting
Ian Abbott [Thu, 4 Apr 2013 13:58:56 +0000 (14:58 +0100)]
staging: comedi: simplify driver module counting

For a legacy device attachment with the `COMEDI_DEVCONFIG` ioctl,
`do_devconfig_ioctl()` calls `comedi_device_attach()` to find a matching
device driver and attach the device.  It then tries to increment the
device driver's module count and if that fails it detaches the device.
So on successful attachment of a device by the `COMEDI_DEVCONFIG` ioctl,
the device driver's module count will have been incremented.

`comedi_device_attach()` is called from nowhere else.  It already
increments the device driver's module count temporarily and decrements
it again; if it gets as far as calling `comedi_device_postconfig()` the
module count is decremented within that function.

Simplify the above by removing the decrement of the device driver module
count from `comedi_device_postconfig()`.  If the call to
`comedi_device_postconfig()` succeeds, `comedi_device_attach()` will
return with the module count still incremented, otherwise decrement the
module count before returning the error.  Don't try and increment the
module count in `do_devconfig_ioctl()` after a successful return from
`comedi_device_attach()` as the module count has now already been
incremented.

`comedi_device_postconfig()` is also called by `comedi_auto_config()`
which currently has to increment the device driver's module count
temporarily so that `comedi_device_postconfig()` can decrement it, but
always returns with no overall change to the module count.  Remove all
the module count manipulations from `comedi_device_postconfig()`.  There
is no other reason for `comedi_auto_config()` to increment the device
driver's module count temporarily, since it is only called (indirectly)
from the device driver itself (usually via one of the wrappers
`comedi_pci_auto_config()` or `comedi_usb_auto_config()`).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: avoid forward declarations
Ian Abbott [Thu, 4 Apr 2013 13:58:55 +0000 (14:58 +0100)]
staging: comedi: avoid forward declarations

Move a few functions and variables to avoid a couple of forward
declarations.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: remove manually unconfigured dynamic devices
Ian Abbott [Thu, 4 Apr 2013 13:58:54 +0000 (14:58 +0100)]
staging: comedi: remove manually unconfigured dynamic devices

If a dynamically allocated (non-legacy, and automatically configured)
comedi device has been successfully unconfigured by use of the
`COMEDI_DEVCONFIG` ioctl, then remove the device afterwards.
(Dynamically identified comedi devices are identified by their minor
device number being `comedi_num_legacy_minors` or greater.)  This is
done in `comedi_unlocked_ioctl()` on return from `do_devconfig_ioctl()`.

Note that there is an unlikely race condition with some other thread
that has just called `comedi_file_info_from_minor()` or
`comedi_dev_from_minor()` and is about to use the device, but that race
condition also exists for automatically removed devices and will be
dealt with properly once reference counting of comedi devices has been
implemented.  We do avoid a race condition between automatic removal and
removal by the `COMEDI_DEVCONFIG` ioctl though.

Also add an extra precaution in `do_devconfig_ioctl()` to avoid
configuring a dynamically allocated device since there is a tight
window avoiding the race condition where this could happen and the
device is about to be removed anyway.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: no need to evade comedi_auto_unconfig()
Ian Abbott [Thu, 4 Apr 2013 13:58:53 +0000 (14:58 +0100)]
staging: comedi: no need to evade comedi_auto_unconfig()

When `comedi_unlocked_ioctl()` handled the `COMEDI_DEVCONFIG` ioctl via
a call to `do_devconfig()`, this used to be allowed to attach a legacy
hardware device to any board minor device, and the auto-unconfiguration
code for non-legacy used to search all board minor devices to find the
hardware device being removed.  After calling `do_devconfig()`
successfully, `comedi_unlocked_ioctl()` sets the `hardware_device`
member of the `struct comedi_file_info` to NULL to stop the
auto-unconfiguration code finding it by accident and unconfiguring the
wrong comedi device as a result.

The above is no longer necessary because `do_devconfig()` now only
allows legacy hardware devices to be attached to comedi board minor
device numbers below `comedi_num_legacy_minors` and the
auto-unconfiguration code (particularly
`comedi_release_hardware_device()`) only searches comedi board minor
device numbers greater than or equal to `comedi_num_legacy_minors`, so
there is no overlap.

Remove the now unnecessary setting of `info->hardware_device = NULL` in
`comedi_unlocked_ioctl()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: avoid releasing legacy minors automatically
Ian Abbott [Thu, 4 Apr 2013 13:58:52 +0000 (14:58 +0100)]
staging: comedi: avoid releasing legacy minors automatically

`comedi_alloc_board_minor()` is called for both reserved "legacy"
devices created during module initialization, and for dynamically
created devices (via `comedi_auto_config()`).  All the minor device
numbers from 0 to `comedi_num_legacy_minors - 1` are for legacy devices
and all those from `comedi_num_legacy_minors` to
`COMEDI_NUM_BOARD_MINORS - 1` are for dynamically created devices.

`comedi_release_hardware_device()` is called (via
`comedi_auto_unconfig()`) when a dynamically created device is being
removed.  It needs to search the table of minor device numbers to see
which one is associated with the hardware device.  It currently starts
the search at minor device number 0.  Change it to start from
`comedi_num_legacy_minors` to skip over those belonging to legacy
devices.  Also change `comedi_alloc_board_minor()` to skip the legacy
devices when searching for a free minor device number for the
dynamically created device.  (The validity of the `hardware_device`
parameter is used to distinguish the legacy devices from the dynamically
created ones.)

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: pre-lock mutex on creation of comedi device
Ian Abbott [Thu, 4 Apr 2013 13:58:51 +0000 (14:58 +0100)]
staging: comedi: pre-lock mutex on creation of comedi device

Return from `comedi_alloc_board_minor()` with the mutex of the created
`struct comedi_device` pre-locked.  This allows further initialization
by the caller without the worry of something getting in there first.

`comedi_auto_config()` no longer needs to check if the device is already
"attached" since whatever was trying to attach the device would need to
have locked the mutex first.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: change comedi_alloc_board_minor() to return pointer
Ian Abbott [Thu, 4 Apr 2013 13:58:50 +0000 (14:58 +0100)]
staging: comedi: change comedi_alloc_board_minor() to return pointer

Change `comedi_alloc_board_minor()` to return a pointer to the allocated
`struct comedi_device` instead of a minor device number.  Return an
`ERR_PTR()` value on error instead of a negative error number.  This
saves a call to `comedi_dev_from_minor()` in `comedi_auto_config()`.

Also change it to use a local variable `dev` to hold the pointer to the
`struct comedi_device` instead of using `info->device` all the time.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: make comedi_free_board_minor() static
Ian Abbott [Thu, 4 Apr 2013 13:58:49 +0000 (14:58 +0100)]
staging: comedi: make comedi_free_board_minor() static

`comedi_free_board_minor()` is now only called from the same .c file it
is defined in, so give it static linkage.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: call comedi_release_hardware_device() on error
Ian Abbott [Thu, 4 Apr 2013 13:58:48 +0000 (14:58 +0100)]
staging: comedi: call comedi_release_hardware_device() on error

If `comedi_auto_config()` fails after allocating the minor device, call
`comedi_release_hardware_device()` instead of
`comedi_free_board_minor()` to free the minor device.  That's the same
call that `comedi_auto_unconfig()` uses, and is slightly safer as it
checks the minor device number is still tied to the same hardware
device.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: add comedi_release_hardware_device()
Ian Abbott [Thu, 4 Apr 2013 13:58:47 +0000 (14:58 +0100)]
staging: comedi: add comedi_release_hardware_device()

Add `comedi_release_hardware_device()` as a replacement for the call
sequence `comedi_find_board_minor()`, `comedi_free_board_minor()`.  This
is slightly safer as we can make sure nothing funny happens to the found
`comedi_file_info_table[]` entry in the middle of the sequence.  Change
`comedi_auto_unconfig()` to call the new function instead of the old
sequence.  Remove `comedi_find_board_minor()` as it has no other
callers.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: refactor comedi_free_board_minor()
Ian Abbott [Thu, 4 Apr 2013 13:58:46 +0000 (14:58 +0100)]
staging: comedi: refactor comedi_free_board_minor()

Split out the part of `comedi_free_board_minor()` that clears the
`comedi_file_info_table[]` element into new function
`comedi_clear_minor()`.  Split out the remainder of the original
function into new function `comedi_free_board_file_info()`.

Also re-use a call to `comedi_clear_minor()` in
`comedi_free_subdevice_minor()` instead of doing the same thing inline.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: adjust module count on device cleanup
Ian Abbott [Thu, 4 Apr 2013 13:58:45 +0000 (14:58 +0100)]
staging: comedi: adjust module count on device cleanup

`comedi_device_cleanup()` is called just before freeing a comedi device.
It is possible for the device to still be open in which case the module
reference counts for the core comedi module and possibly the low-level
driver module will remain out of whack because `comedi_close()` will not
find the comedi device and so will not decrement the module counts.

This really needs to be handled better, but for now decrement the module
counts in `comedi_device_cleanup()` according to the number of
outstanding opens.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: remove memset() call from comedi_device_init()
Ian Abbott [Thu, 4 Apr 2013 13:58:44 +0000 (14:58 +0100)]
staging: comedi: remove memset() call from comedi_device_init()

`comedi_device_init()` is only called from one place
(`comedi_alloc_board_minor()`) and the `struct comedi_device` has
already been zeroed out by `kzalloc()`.  Don't bother zeroing it out
again with `memset()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: no need to zero out comedi_file_info_table[]
Ian Abbott [Thu, 4 Apr 2013 13:58:43 +0000 (14:58 +0100)]
staging: comedi: no need to zero out comedi_file_info_table[]

In the comedi core module, `comedi_file_info_table[]` is tentatively
defined in the .bss section, so will already be zeroed out on
initialization.  Don't bother zeroing it out again in the module
initialization function `comedi_init()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: check comedi_auto_config() params
Ian Abbott [Thu, 4 Apr 2013 13:58:42 +0000 (14:58 +0100)]
staging: comedi: check comedi_auto_config() params

Do some minimal error checking of the parameters of
`comedi_auto_config()`.  Just make sure the `hardware_device` and
`driver` parameters are non-NULL.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: dgrp: implement error handling in dgrp_create_class_sysfs_files()
Alexey Khoroshilov [Fri, 5 Apr 2013 21:14:23 +0000 (01:14 +0400)]
staging: dgrp: implement error handling in dgrp_create_class_sysfs_files()

There is no any error handling in dgrp_create_class_sysfs_files().
The patch adds code to check return values and propagate them to dgrp_init_module().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: show product name in `list -l' command
Kurt Kanzenbach [Thu, 4 Apr 2013 14:03:16 +0000 (16:03 +0200)]
staging: usbip: userspace: show product name in `list -l' command

The `usbip list -l' command shows your local usb-devices.
Example:
 $ usbip list -l
 $ Local USB devices
 $ =================
 $ - busid 1-1 (13fe:1d00)
 $         1-1:1.0 -> usb-storage
 $
 $ - busid 1-2 (0409:55aa)
 $         1-2:1.0 -> hub

However this list command doesn't show which device is connected
to this busid. Therefore you have to use another tool e.g. lsusb
to determine that.

This patches adds the possibility to see which device that is.
Example:
 $ usbip list -l
 $ Local USB devices
 $ =================
 $ - busid 1-1 (13fe:1d00)
 $   Kingston Technology Company Inc. : DataTraveler 2.0 1GB/4GB Flash Drive / Patriot Xporter 4GB Flash
 $         1-1:1.0 -> usb-storage
 $
 $ - busid 1-2 (0409:55aa)
 $   NEC Corp. : Hub (0409:55aa)
 $         1-2:1.0 -> hub

If parsable is specified the info will be not printed.

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: unified command line arguments
Kurt Kanzenbach [Thu, 4 Apr 2013 14:03:15 +0000 (16:03 +0200)]
staging: usbip: userspace: unified command line arguments

The command `usbip attach' uses --host for specifing
the remote host, while `usbip list' uses --remote.
This is confusing and this patch adapts this.
In Addition changed the manpage and README accordingly.

Before:
 $ usbip attach --host <host> -b <busid>
 $ usbip list --remote <host>

Now:
 $ usbip attach --remote <host> -b <busid>
 $ usbip list --remote <host>

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: libsrc: cleanup parsing
Kurt Kanzenbach [Thu, 4 Apr 2013 14:03:14 +0000 (16:03 +0200)]
staging: usbip: userspace: libsrc: cleanup parsing

Since the names.c/names.h are taken from another project, some
functions which names.c provides aren't used by usbipd.
This patch fixes:
 - removed useless comments
 - unified debug/error messages by using the macros
   provided by usbip_common.h
 - removed unnused code

The code cleanup includes:
 - remove unused data structures
 - remove code to create them
 - remove code to access them

The file names.c is used to parse the `usb.ids' file. The parser
stores a lot of information about usb devices that is never used.

The `usb.ids' file has several sections. Some variables (like
`lasthut') store the ID of the current section, and those variables
are used to decide which section is currently being parsed (i.e. in
which data structure the current line will be  stored).

We removed the code to read those IDs because they are never used
anyway. We replaced them by the pseudo-ID `1' (instead of reading the
ID from the file) to indicate that the parser is in a section that
can be ignored. If the parser is in such a section, the current line
(which contains sub-items for this section) is discarded.

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: removed unnecessary code
Kurt Kanzenbach [Thu, 4 Apr 2013 14:03:13 +0000 (16:03 +0200)]
staging: usbip: userspace: removed unnecessary code

Since no usbip_name function is used in usbipd, it's not
necessary to parse "usb.ids" file at startup.

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: avoid memory leaks
Stefan Reif [Thu, 4 Apr 2013 14:03:12 +0000 (16:03 +0200)]
staging: usbip: userspace: avoid memory leaks

Call freeaddrinfo when connect/listen fails.
Call usbip_host_driver_close on error.

Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: simplified cleanup function
Kurt Kanzenbach [Thu, 4 Apr 2013 14:03:11 +0000 (16:03 +0200)]
staging: usbip: simplified cleanup function

This patch simplified "stub_device_free" cleanup function:
 - changed return type to void, since the return value is
   not checked anywhere
 - kfree is NULL-safe, so removed if statement
 - deleted debug-message

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: removed unnecessary for loop
Kurt Kanzenbach [Thu, 4 Apr 2013 14:03:10 +0000 (16:03 +0200)]
staging: usbip: removed unnecessary for loop

This for loop is not needed, since STUB_BUSID_OTHER is defined as 0.
In Addition added a comment if STUB_BUSID_OTHER changes sometime.

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: removed unnecessary if-else-statements
Kurt Kanzenbach [Thu, 4 Apr 2013 14:03:09 +0000 (16:03 +0200)]
staging: usbip: removed unnecessary if-else-statements

In each if-else case "return" is called. This is why
these if-else-statements are useless. Removing them
improves understanding and readability.

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: simplified errorhandling
Kurt Kanzenbach [Thu, 4 Apr 2013 14:03:08 +0000 (16:03 +0200)]
staging: usbip: simplified errorhandling

In each errorcase spin_unlock_irq is called and -EINVAL is returned.
To simplify that I created a label called "err" doing that.
On Success count will be returned.

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: simple indent fix
Stefan Reif [Thu, 4 Apr 2013 14:03:07 +0000 (16:03 +0200)]
staging: usbip: simple indent fix

Fix an indent.

Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: remove unnused, broken macro
Stefan Reif [Thu, 4 Apr 2013 14:03:06 +0000 (16:03 +0200)]
staging: usbip: remove unnused, broken macro

Remove broken preprocessor macro "hardware". It is unused and it
references an element (pdev in vhci_hcd) that does not exist.

Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: removed enumeration of comments
Kurt Kanzenbach [Thu, 4 Apr 2013 14:03:05 +0000 (16:03 +0200)]
staging: usbip: removed enumeration of comments

Enumerations for one comment makes no sense.
This is why this should be removed.

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: reformat function pickup_urb_and_free_priv
Stefan Reif [Thu, 4 Apr 2013 14:03:04 +0000 (16:03 +0200)]
staging: usbip: reformat function pickup_urb_and_free_priv

re-indent funtion "pickup_urb_and_free_priv" to improve readability.

Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: reformat function stub_recv_cmd_unlink()
Kurt Kanzenbach [Thu, 4 Apr 2013 14:03:03 +0000 (16:03 +0200)]
staging: usbip: reformat function stub_recv_cmd_unlink()

Reformat function stub_recv_cmd_unlink() to improve readability.

Signed-off-by: Kurt Kanzenbach <ly80toro@cip.cs.fau.de>
Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: usbip: userspace: libsrc: replace numbers by ascii
Stefan Reif [Thu, 4 Apr 2013 14:03:02 +0000 (16:03 +0200)]
staging: usbip: userspace: libsrc: replace numbers by ascii

replace numbers in code by ascii text constants as suggested
by Dan Carpenter:
http://driverdev.linuxdriverproject.org/pipermail/devel/2013-February/035907.html

Signed-off-by: Stefan Reif <ke42caxa@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: slicoss: information leak in ETHTOOL_GSET
Dan Carpenter [Thu, 4 Apr 2013 06:29:42 +0000 (09:29 +0300)]
staging: slicoss: information leak in ETHTOOL_GSET

There are some fields in "edata" which have not been cleared.  One
example is edata.cmd.  It leaks uninitialized stack information to the
user.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: csr: info leak in unifi_cfg_get_info()
Dan Carpenter [Thu, 4 Apr 2013 06:31:24 +0000 (09:31 +0300)]
staging: csr: info leak in unifi_cfg_get_info()

"cfg_ap_config" has a number of fields which are not cleared before we
copy them to the user.  I've added a memset() at the beginning to set
everything to zero.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: range: introduce some simple mA ranges
H Hartley Sweeten [Wed, 3 Apr 2013 20:40:13 +0000 (13:40 -0700)]
staging: comedi: range: introduce some simple mA ranges

The simple mA ranges 0 to 20, 4 to 20, and 0 to 32 are fairly common.
Introduce them in the comedi core and use them in the drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: usbduxsigma: use comedi provided range_unipolar2_5
H Hartley Sweeten [Wed, 3 Apr 2013 20:39:54 +0000 (13:39 -0700)]
staging: comedi: usbduxsigma: use comedi provided range_unipolar2_5

Remove the private range, range_usbdux_ao_range, in this driver and use
the comedi provided range_unipolar2_5 instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_mio_common: use comedi provided range_bipolar5
H Hartley Sweeten [Wed, 3 Apr 2013 20:39:34 +0000 (13:39 -0700)]
staging: comedi: ni_mio_common: use comedi provided range_bipolar5

Remove the private range, range_ni_S_ai_6143, in this driver and use
the comedi provided range_bipolar5 instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_pcimio: use comedi provided range_bipolar10
H Hartley Sweeten [Wed, 3 Apr 2013 20:39:14 +0000 (13:39 -0700)]
staging: comedi: ni_pcimio: use comedi provided range_bipolar10

Remove the private range, range_ni_M_622x_ao, in this driver and use
the comedi provided range_bipolar10 instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: dt9812: use comedi provided range_unipolar2_5
H Hartley Sweeten [Wed, 3 Apr 2013 20:38:54 +0000 (13:38 -0700)]
staging: comedi: dt9812: use comedi provided range_unipolar2_5

Remove the private ranges, dt9812_2pt5_a{in,out}_range, in this
driver and use the comedi provided range_unipolar2_5 instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: range: introduce range_unipolar2_5
H Hartley Sweeten [Wed, 3 Apr 2013 20:38:26 +0000 (13:38 -0700)]
staging: comedi: range: introduce range_unipolar2_5

Introduce a simple unipolar 0 to 2.5 range, range_unipolar2_5, for
use by the comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: dt9812: use comedi provided range_bipolar10
H Hartley Sweeten [Wed, 3 Apr 2013 20:37:46 +0000 (13:37 -0700)]
staging: comedi: dt9812: use comedi provided range_bipolar10

Remove the private ranges, dt9812_10_a{in,out}_range, in this driver
and use the comedi provided range_bipolar10 instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: das800: use comedi provided range_bipolar5
H Hartley Sweeten [Wed, 3 Apr 2013 20:37:21 +0000 (13:37 -0700)]
staging: comedi: das800: use comedi provided range_bipolar5

Remove the private range, range_das800_ai, in this driver and use
the comedi provided range_bipolar5 instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: das1800: use comedi provided range_bipolar10
H Hartley Sweeten [Wed, 3 Apr 2013 20:36:48 +0000 (13:36 -0700)]
staging: comedi: das1800: use comedi provided range_bipolar10

Remove the private range, range_ao_1, in this driver and use the
comedi provided range_bipolar10 instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: cb_pcidas64: use comedi provided range_bipolar10
H Hartley Sweeten [Wed, 3 Apr 2013 20:36:26 +0000 (13:36 -0700)]
staging: comedi: cb_pcidas64: use comedi provided range_bipolar10

Remove the private range, ao_ranges_60xx, in this driver and use
the comedi provided range_bipolar10 instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: rename thisboard variable
H Hartley Sweeten [Wed, 3 Apr 2013 18:41:09 +0000 (11:41 -0700)]
staging: comedi: rtd520: rename thisboard variable

For aesthetic reasons. rename the local variable 'thisboard' to 'board'
throughout the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: rename CamelCase chanBipolar
H Hartley Sweeten [Wed, 3 Apr 2013 18:40:51 +0000 (11:40 -0700)]
staging: comedi: rtd520: rename CamelCase chanBipolar

Rename the CamelCase private data variable chanBipolar to chan_is_bipolar.
Remove the unnecessary comment about it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: rename CamelCase in rtdConvertChanGain()
H Hartley Sweeten [Wed, 3 Apr 2013 18:40:32 +0000 (11:40 -0700)]
staging: comedi: rtd520: rename CamelCase in rtdConvertChanGain()

Rename the CamelCase function rtdConvertChanGain() as well as the
CamelCase parameters to the function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: rename CamelCase rtdBoard
H Hartley Sweeten [Wed, 3 Apr 2013 18:40:13 +0000 (11:40 -0700)]
staging: comedi: rtd520: rename CamelCase rtdBoard

Rename the CamelCase struct rtdBoard to rtd_boardinfo. Also, rename the
range10Start and rangeUniStart variables in the struct to range_bip10
and range_uni10.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: rename CamelCase aiCount
H Hartley Sweeten [Wed, 3 Apr 2013 18:39:55 +0000 (11:39 -0700)]
staging: comedi: rtd520: rename CamelCase aiCount

Rename this private data variable to ai_count.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: rename CamelCase in rtd_interrupt()
H Hartley Sweeten [Wed, 3 Apr 2013 18:39:35 +0000 (11:39 -0700)]
staging: comedi: rtd520: rename CamelCase in rtd_interrupt()

Rename the CamelCase local variable fifoStatus to fifo_status.

Also rename the goto lables abortTransfer and transferDone to
xfer_abort and xfer_done.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: rename CamelCase fifoLen
H Hartley Sweeten [Wed, 3 Apr 2013 18:39:14 +0000 (11:39 -0700)]
staging: comedi: rtd520: rename CamelCase fifoLen

Rename this private data variable to fifosz.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: rename CamelCase transCount
H Hartley Sweeten [Wed, 3 Apr 2013 18:38:55 +0000 (11:38 -0700)]
staging: comedi: rtd520: rename CamelCase transCount

Rename this private data variable to xfer_count.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: rename CamelCase aoValue
H Hartley Sweeten [Wed, 3 Apr 2013 18:38:37 +0000 (11:38 -0700)]
staging: comedi: rtd520: rename CamelCase aoValue

Rename this private data variable to ao_readback and remove the
unnecessary comments.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: rename CamelCase rtdPrivate
H Hartley Sweeten [Wed, 3 Apr 2013 18:38:16 +0000 (11:38 -0700)]
staging: comedi: rtd520: rename CamelCase rtdPrivate

Rename the private data struct to rtd_private.

Also, remove the unnecessary comment about it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: rtd520: cleanup rtd_dio_insn_config()
H Hartley Sweeten [Wed, 3 Apr 2013 18:37:46 +0000 (11:37 -0700)]
staging: comedi: rtd520: cleanup rtd_dio_insn_config()

Add a local variable to make this function a bit cleaner and
remove the unnecessary comments.

The comedi core expects this function to return the number of
data parameters used. Change the return from '1' to 'insn->n'
to make this more apparent.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zcache: clean TODO list
Wanpeng Li [Wed, 3 Apr 2013 10:16:23 +0000 (18:16 +0800)]
staging: zcache: clean TODO list

Cleanup TODO list since support zero-filled pages more efficiently has
already done by this patchset.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zcache: introduce zero-filled page stat count
Wanpeng Li [Wed, 3 Apr 2013 10:16:22 +0000 (18:16 +0800)]
staging: zcache: introduce zero-filled page stat count

Introduce zero-filled page statistics to monitor the number of
zero-filled pages.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zcache: fix static variables defined in debug.h but used in mutiple C files
Wanpeng Li [Wed, 3 Apr 2013 10:16:21 +0000 (18:16 +0800)]
staging: zcache: fix static variables defined in debug.h but used in mutiple C files

After commit 95bdaee214 ("zcache: Move debugfs code out of zcache-main.c file")
be merged, most of knods in zcache debugfs just export zero since these variables
are defined in debug.h but are in use in multiple C files zcache-main.c and debug.c,
in this case variables can't be treated as shared variables.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: imx-drm: Make IPU KMS parse display-timings
Marek Vasut [Wed, 3 Apr 2013 15:36:28 +0000 (12:36 -0300)]
staging: imx-drm: Make IPU KMS parse display-timings

This patch adds support for parsing of the DT display-timings prop
to IPU KMS driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zcache: fix zcache writeback in debugfs
Wanpeng Li [Tue, 2 Apr 2013 02:46:17 +0000 (10:46 +0800)]
staging: zcache: fix zcache writeback in debugfs

commit 9c0ad59ef ("zcache/debug: Use an array to initialize/use debugfs attributes")
use an array to initialize/use debugfs attributes, .name = #x, .val = &zcache_##x.
For zcache writeback, this commit set .name = zcache_outstanding_writeback_pages and
.name = zcache_writtenback_pages seperately, however, corresponding .val =
&zcache_zcache_outstanding_writeback_pages and .val = &zcache_zcache_writtenback_pages,
which are not correct.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zcache: fix pers_pageframes|_max aren't exported in debugfs
Wanpeng Li [Tue, 2 Apr 2013 02:46:16 +0000 (10:46 +0800)]
staging: zcache: fix pers_pageframes|_max aren't exported in debugfs

Before commit 9c0ad59ef ("zcache/debug: Use an array to initialize/use
debugfs attributes"), pers_pageframes|_max are exported in debugfs, but
this commit forgot use array export pers_pageframes|_max. This patch add
pers_pageframes|_max back.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zcache: handle zcache_[eph|pers]_zpages for zero-filled page
Wanpeng Li [Tue, 2 Apr 2013 02:46:15 +0000 (10:46 +0800)]
staging: zcache: handle zcache_[eph|pers]_zpages for zero-filled page

Increment/decrement zcache_[eph|pers]_zpages for zero-filled pages,
the main point of the counters for zpages and pageframes is to be
able to calculate density == zpages/pageframes. A zero-filled page
becomes a zpage that "compresses" to zero bytes and, as a result,
requires zero pageframes for storage. So the zpages counter should
be increased but the pageframes counter should not.

[Dan Magenheimer <dan.magenheimer@oracle.com>: patch description]
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zcache: zero-filled pages awareness
Wanpeng Li [Tue, 2 Apr 2013 02:46:14 +0000 (10:46 +0800)]
staging: zcache: zero-filled pages awareness

Compression of zero-filled pages can unneccessarily cause internal
fragmentation, and thus waste memory. This special case can be
optimized.

This patch captures zero-filled pages, and marks their corresponding
zcache backing page entry as zero-filled. Whenever such zero-filled
page is retrieved, we fill the page frame with zero.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zcache: introduce zero-filled pages handler
Wanpeng Li [Tue, 2 Apr 2013 02:46:13 +0000 (10:46 +0800)]
staging: zcache: introduce zero-filled pages handler

Introduce zero-filled pages handler to capture and handle zero pages.

Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agodrivers: staging: zcache: fix compile warning
Bob Liu [Tue, 2 Apr 2013 02:47:43 +0000 (10:47 +0800)]
drivers: staging: zcache: fix compile warning

Fix below compile warning:
staging/zcache/zcache-main.c: In function ‘zcache_autocreate_pool’:
staging/zcache/zcache-main.c:1393:13: warning: ‘cli’ may be used uninitialized
in this function [-Wuninitialized]

Signed-off-by: Bob Liu <bob.liu@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agodrivers: staging: zcache: fix compile error
Bob Liu [Tue, 2 Apr 2013 02:47:42 +0000 (10:47 +0800)]
drivers: staging: zcache: fix compile error

Because 'ramster_debugfs_init' is not defined if !CONFIG_DEBUG_FS, there is
compile error:

$ make drivers/staging/zcache/
staging/zcache/ramster/ramster.c: In function ‘ramster_init’:
staging/zcache/ramster/ramster.c:981:2: error: implicit declaration of
function ‘ramster_debugfs_init’ [-Werror=implicit-function-declaration]

This patch fix it and reduce some #ifdef CONFIG_DEBUG_FS in .c files the same
way.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Bob Liu <bob.liu@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoMerge tag 'iio-for-3.10c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Tue, 2 Apr 2013 19:37:02 +0000 (12:37 -0700)]
Merge tag 'iio-for-3.10c' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:
Third round of IIO cleanups, graduations and new stuff for the 3.10 cycle.

A small set including 3 things.
1) A short cleanup series for the ak8975.
2) Graduation of ak8975 out of staging.
3) Some additional bits for the at91 adc driver to cover low resolution
   modes, sleep and a little bit of missing documentation.

11 years agoiio: at91_adc: fix missing Sample and Hold time
Jean-Christophe PLAGNIOL-VILLARD [Fri, 29 Mar 2013 14:54:00 +0000 (14:54 +0000)]
iio: at91_adc: fix missing Sample and Hold time

On the at91_adc a minimal Sample and Hold Time is necessary for the ADC to
guarantee the best converted final value between two channels selection.
This time has to be programmed through the bitfield SHTIM in the
Mode Register ADC_MR.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: at91_adc: add sleep mode support
Jean-Christophe PLAGNIOL-VILLARD [Fri, 29 Mar 2013 14:54:00 +0000 (14:54 +0000)]
iio: at91_adc: add sleep mode support

The sleep mode will allow to put the adc in sleep between conversion.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio: at91_adc: add low and high res support
Ludovic Desroches [Fri, 29 Mar 2013 14:54:00 +0000 (14:54 +0000)]
iio: at91_adc: add low and high res support

at91 adc offers the choice between two resolutions: low and high.
The low and high resolution values depends on adc IP version, as many IP
properties have been exposed through device tree, these settings have also
been added to the dt bindings.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
11 years agoiio:magnetometer:ak8975 move driver out of staging
Jonathan Cameron [Sun, 24 Mar 2013 16:58:00 +0000 (16:58 +0000)]
iio:magnetometer:ak8975 move driver out of staging

Issues raised in last series to propose this have now been resolved
so there should be no reason this driver cannot graduate from staging.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
11 years agostaging:iio:magnetometer:ak8975 use standard i2c_smbus read functions.
Jonathan Cameron [Sun, 24 Mar 2013 16:58:00 +0000 (16:58 +0000)]
staging:iio:magnetometer:ak8975 use standard i2c_smbus read functions.

Now the mysterious NOSTART flag is gone from the read, we can use the
i2c_smbus_read_byte/word/i2c_block_data functions instead of the
local reimplementation of these standard functions.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
11 years agostaging:iio:magnetometer:ak8975 drop I2C_M_NOSTART flag in read_data
Jonathan Cameron [Sun, 24 Mar 2013 16:58:00 +0000 (16:58 +0000)]
staging:iio:magnetometer:ak8975 drop I2C_M_NOSTART flag in read_data

This flag makes no sense whatsoever where it is.
Documentation/i2c/i2c-protocol states:

  If you set the I2C_M_NOSTART variable for the first partial message,
  we do not generate Addr, but we do generate the startbit S. This will
  probably confuse all other clients on your bus, so don't try this.

This is exactly what is going on here.  Likelihood given that the
driver never checked for this protocol mangling being available is that
it wasn't present on the test boards and hence this flag was simply
ignored.  No indication of why it would be necessary has been found in
the datasheets.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
11 years agostaging:iio:magnetometer:ak8975 drop unused eoc_irq
Jonathan Cameron [Sun, 24 Mar 2013 16:58:00 +0000 (16:58 +0000)]
staging:iio:magnetometer:ak8975 drop unused eoc_irq

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
11 years agostaging: ti-soc-thermal: Add get_trend support
J Keerthy [Mon, 1 Apr 2013 16:04:46 +0000 (12:04 -0400)]
staging: ti-soc-thermal: Add get_trend support

Patch adds get_trend functionality for OMAP Bandgap thermal devices.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal:Introduce ti_bandgap_get_trend function for OMAP5
J Keerthy [Mon, 1 Apr 2013 16:04:45 +0000 (12:04 -0400)]
staging: ti-soc-thermal:Introduce ti_bandgap_get_trend function for OMAP5

The patch adds ti_bandgap_get_trend function. This is specific
to OMAP5 for now it computes the trend from the temp values stored
in the hardware history buffer.

Formula: (T1 - T2) / P.

Where:
                T1: Last read valid temperature.
                T2: Last but one read valid temperature.
                P:  Update Interval.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: Enable HISTORY_BUFFER Feature for OMAP5
J Keerthy [Mon, 1 Apr 2013 16:04:44 +0000 (12:04 -0400)]
staging: ti-soc-thermal: Enable HISTORY_BUFFER Feature for OMAP5

This patch enables the HISTORY_BUFFER eature for OMAP5.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: Introduce HAS_HISTORY_BUFFER feature for bandgap
J Keerthy [Mon, 1 Apr 2013 16:04:43 +0000 (12:04 -0400)]
staging: ti-soc-thermal: Introduce HAS_HISTORY_BUFFER feature for bandgap

The patch introduces HISTORY_BUFFER feature. This is present in OMAP5 bandgap
and it is a hardware history buffer of previously read temperatures.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: Modify update_interval r/w functions to incorporate the...
J Keerthy [Mon, 1 Apr 2013 16:04:42 +0000 (12:04 -0400)]
staging: ti-soc-thermal: Modify update_interval r/w functions to incorporate the OMAP5 feature of COUNTER_DELAY.

Update ti_bandgap_write_update_interval and ti_bandgap_read_update_interval
functions to incorporate the OMAP5 feature of COUNTER_DELAY. The way we
program the delay between two successive temperature conversions
is different for OMAP5 as when compared with OMAP4. Incorporating
the changes required to program the delay for OMAP5.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: Enable COUNTER_DELAY feature for OMAP5
J Keerthy [Mon, 1 Apr 2013 16:04:41 +0000 (12:04 -0400)]
staging: ti-soc-thermal: Enable COUNTER_DELAY feature for OMAP5

Enable COUNTER_DELAY feature for OMAP5.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: Introduce HAS_COUNTER_DELAY feature for bandgap
J Keerthy [Mon, 1 Apr 2013 16:04:40 +0000 (12:04 -0400)]
staging: ti-soc-thermal: Introduce HAS_COUNTER_DELAY feature for bandgap

Introduce HAS_COUNTER_DELAY feature for bandgap.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: Initialise counter_delay field for OMAP5 sensors
J Keerthy [Mon, 1 Apr 2013 16:04:39 +0000 (12:04 -0400)]
staging: ti-soc-thermal: Initialise counter_delay field for OMAP5 sensors

Initialize all 3 temperature sensors of OMAP5 bandgap with the counter delay
mask.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: Add counter_delay_mask field to temp_sensor_registers struct
J Keerthy [Mon, 1 Apr 2013 16:04:38 +0000 (12:04 -0400)]
staging: ti-soc-thermal: Add counter_delay_mask field to temp_sensor_registers struct

Add counter_delay_mask field to temp_sensor_registers structure.

Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: report alert events on OMAP5 devices
Eduardo Valentin [Mon, 1 Apr 2013 16:04:37 +0000 (12:04 -0400)]
staging: ti-soc-thermal: report alert events on OMAP5 devices

OMAP5430 devices have the capability to generate
alert temperature. Thus, whenever a T_ALERT IRQ is served,
the ti-bandgap will call .report_temperature to notify the
thermal framework about thermal zone update request.

This patch allows OMAP5430 devices to notify
the thermal framework about T_ALERT events.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: ti-soc-thermal: report alert events on OMAP4 devices
Eduardo Valentin [Mon, 1 Apr 2013 16:04:36 +0000 (12:04 -0400)]
staging: ti-soc-thermal: report alert events on OMAP4 devices

OMAP4460 and OMAP4470 devices have the capability to generate
alert temperature. Thus, whenever a T_ALERT IRQ is served,
the ti-bandgap will call .report_temperature to notify the
thermal framework about thermal zone update request.

This patch allows OMAP4460 and OMAP4470 devices to notify
the thermal framework about T_ALERT events.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>