openwrt/staging/blogic.git
10 years agovme_user: Enable compat_ioctl for mixed environment
Aaron Sierra [Wed, 18 Dec 2013 16:11:09 +0000 (10:11 -0600)]
vme_user: Enable compat_ioctl for mixed environment

Now that the VME userspace API structures compile to a consistent size
in mixed environments (32-bit userspace and 64-bit kernel), enable the
.compat_ioctl to allow ioctls to execute in this environment.

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: bcm: DDRInit: fixed issues w/ commenting.
Gary Rookard [Tue, 17 Dec 2013 22:08:52 +0000 (17:08 -0500)]
Staging: bcm: DDRInit: fixed issues w/ commenting.

removed C99 comments to follow the linux kernel coding style
thus fixing checkpatch errors respectfully.

Signed-off-by: Gary Alan Rookard <garyrookard@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: ion: Avoid using rt_mutexes directly
John Stultz [Wed, 18 Dec 2013 01:04:29 +0000 (17:04 -0800)]
staging: ion: Avoid using rt_mutexes directly

RT_MUTEXES can be configured out of the kernel, causing compile
problems with ION.

To quote Colin:
"rt_mutexes were added with the deferred freeing feature.  Heaps need
to return zeroed memory to userspace, but zeroing the memory on every
allocation was causing performance issues.  We added a SCHED_IDLE
thread to zero memory in the background after freeing, but locking the
heap from the SCHED_IDLE thread might block a high priority allocation
thread for a long time.

The lock is only used to protect the heap's free_list and
free_list_size members, and is not held for any long or sleeping
operations.  Converting to a spinlock should prevent priority
inversion without using the rt_mutex.  I'd also rename it to free_lock
to so it doesn't get used as a general heap lock."

Thus this patch converts the rt_mutex usage to a spinlock and
renames the lock free_lock to be more clear as to its use.

I also had to change a bit of logic in ion_heap_freelist_drain()
to safely avoid list corruption.

Acked-by: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agortl8188eu: remove unused code
Matthias Wirth [Mon, 16 Dec 2013 17:51:50 +0000 (18:51 +0100)]
rtl8188eu: remove unused code

These two macros needed reformatting but as they are not used anywhere we
just removed them.

Signed-off-by: Matthias Wirth <matthias.wirth@gmail.com>
Signed-off-by: Lukas Senger <lukas@fridolin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agortl8188eu: fix coding style
Matthias Wirth [Mon, 16 Dec 2013 17:51:49 +0000 (18:51 +0100)]
rtl8188eu: fix coding style

Signed-off-by: Matthias Wirth <matthias.wirth@gmail.com>
Signed-off-by: Lukas Senger <lukas@fridolin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agortl8188eu: fix whitespace and indentation
Matthias Wirth [Mon, 16 Dec 2013 17:51:48 +0000 (18:51 +0100)]
rtl8188eu: fix whitespace and indentation

Signed-off-by: Matthias Wirth <matthias.wirth@gmail.com>
Signed-off-by: Lukas Senger <lukas@fridolin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: xillybus: Return -EIO if *_iomap fails, instead of 0
Eli Billauer [Tue, 17 Dec 2013 19:36:29 +0000 (21:36 +0200)]
staging: xillybus: Return -EIO if *_iomap fails, instead of 0

This patch replicates the correction made by Wei Yongjun on a second
occurrence of the same bug.

The first correction was in commit 8eec4555511bfa1f8a2e0a2de45c988fd30c3efb.

Bug fixed: The error code was not set, so the error condition wasn't reflected
in the return value.

Reported-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agousbip: Fix sscanf handling
Alan [Wed, 11 Dec 2013 18:32:59 +0000 (18:32 +0000)]
usbip: Fix sscanf handling

Scan only to the length permitted by the buffer

One of a set of sscanf problems noted by Jackie Chang

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agovme_user: Update API to work in mixed environments
Aaron Sierra [Mon, 9 Dec 2013 16:05:40 +0000 (10:05 -0600)]
vme_user: Update API to work in mixed environments

This patch updates the vme_master and vme_slave structures to use
types with well defined size and to prevent the compiler from
inserting padding (between enable and vme_addr for one).

The original vme_master and vme_slave structs would be different
sizes and have different layouts depending on whether they were built
for a 32-bit or 64-bit system.

On x86 it is possible to have a 32-bit userspace and a 64-bit kernel.
In this type of environment, the userspace and kernel vme_user APIs
would disagree and prevent ioctls from executing (based on ioctl
signatures from _IOR and _IOW).

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Acked-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agovme: Convert VME core to register as a subsystem
Aaron Sierra [Mon, 9 Dec 2013 15:54:42 +0000 (09:54 -0600)]
vme: Convert VME core to register as a subsystem

Previously, VME bridge support was treated as any other driver (using
module_init() macro), but if VME bridge and vme_user (staging) drivers
were compiled into the kernel, then vme_user would attempt to register
itself before the VME core support had been loaded. This would result
in a kernel panic.

The load order of these built-in drivers is based on the order in which
drivers/staging/vme and driver/vme are compiled.

This patch changes the VME core driver to use the subsys_initcall()
macro which ensures that it is loaded before all other VME drivers
regardless of the order in which they are compiled.

Tested-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Martyn Welch <martyn.welch@ge.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: fix result of memdup_user for user chanlist
Bernd Porr [Wed, 11 Dec 2013 16:06:15 +0000 (16:06 +0000)]
staging: comedi: fix result of memdup_user for user chanlist

If the channel list is not set in userspace we get an error at
PTR_ERR(async->cmd.chanlist). However, do_become_nonbusy(dev, s) cleans
up this pointer which causes a kernel ooops. Setting the channel list in
async to NULL and checking this in do_become_nonbusy prevents the oops.

[Ian Abbott] Also do the same for the chanlist allocated in
do_cmdtest_ioctl().

Signed-off-by: Bernd Porr <mail@berndporr.me.uk>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: keucr: Fix typo in keucr driver
Masanari Iida [Thu, 12 Dec 2013 13:22:59 +0000 (22:22 +0900)]
staging: keucr: Fix typo in keucr driver

Correct spelling typo in comment and printk.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: clean up CARDbSetMediaChannel.
Malcolm Priestley [Thu, 12 Dec 2013 23:33:08 +0000 (23:33 +0000)]
staging: vt6656: clean up CARDbSetMediaChannel.

White space and commented out code.

Camel case clean up.
pDevice -> priv
uConnectionChannel -> connection_channel

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/comedi: bug fix for module usage count on device removal
Ian Abbott [Wed, 11 Dec 2013 14:51:03 +0000 (14:51 +0000)]
staging/comedi: bug fix for module usage count on device removal

When a dynamically created comedi device is being automatically removed
by a call to `comedi_auto_unconfig()` from the lower level driver,
`comedi_device_cleanup()` is called to perform the detachment from the
lower level driver.  If the comedi device is open at the time,
`dev->use_count` will be the the number of outstanding opens.  The
function currently decrements the the module counts of the "comedi"
module and the low-level driver module by this amount and reduces
`dev->use_count` to zero.  There are various problems with this as the
`release` file operation handler `comedi_close()` also decrements
`dev->use_count` and decrements the module usage counts.  This means
that `dev->use_count` and the module counts can end up negative.

Also, the assumed one-to-one relationship between the file open count
and the low-level module usage count is invalid and can get screwed up.
We only want to stop the low-level module being unloaded while a comedi
device using the module has an open file object.

Also, there is no need to manipulate the module count of the core
"comedi" module at all since the comedi module is the owner of the file
operations structure and the system will not unload the module while
there are open file objects using it.

Correct the bugs and simplify as follows:

1. Get rid of the module count manipulations of the core "comedi" module
(`THIS_MODULE`) altogether.

2. Don't alter `dev->use_count` in `comedi_device_cleanup()` as it
should only be altered by the `open` and `release` file operation
handlers `comedi_open()` and `comedi_close()`.

3. Increment the low-level module count for the following reasons:

  a) In `comedi_open()` if the open count was zero and the comedi device
     is attached to the low-level driver.
  b) When the `COMEDI_DEVCONFIG` ioctl is used to manually attach an
     unattached comedi device to a low-level driver.  The open count
     will be greater than zero at this time.  The actual increment of
     the low-level module count is already done by
     `comedi_device_attach()`.

4. Decrement the low-level module count for the following reasons:

  a) In `comedi_close()` if the open count was 1 and the comedi device
     is attached to the low-level driver.
  b) In `comedi_device_cleanup()` (called via `comedi_auto_unconfig()`
     --> `comedi_release_hardware_device()` -->
     `comedi_free_board_dev()` when the comedi device is automatically
     unconfigured due to action by the low-level driver) if the device
     was attached (which it should be) and open count was non-zero
     (greater than zero).
  c) When the `COMEDI_DEVCONFIG` ioctl is used to manually detach the
     comedi device from the low-level driver.  The open count will be
     greater than zero at this time.

The open count should never go negative.  Parts 3 and 4 ensure that the
low-level module usage count is incremented on entering the state where
the comedi device is attached to the low-level driver AND the open count
is greater than zero, and is decremented on leaving that state.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging/comedi: keep reference to class device after destroyed
Ian Abbott [Wed, 11 Dec 2013 14:51:02 +0000 (14:51 +0000)]
staging/comedi: keep reference to class device after destroyed

When a dynamically allocated `struct comedi_device` gets automatically
unconfigured by a call to `comedi_auto_unconfig()` from a lower-level
driver's bus removal function (e.g. when a USB device is disconnected),
the class device in `dev->class_dev` (where `dev` points to the `struct
comedi_device`) is destroyed by a call to `device_destroy()` that
matches a previous call to `device_create()`.

However, if the `struct comedi_device` is still associated with an open
file object, the now invalid `dev->class_dev` pointer may still be
passed to `dev_printk()` (via `dev_dbg()` etc.), producing bogus output
or worse.

To fix this, call `get_device()` on the class device if
`device_create()` was successful.  Add a matching call to `put_device()`
in `comedi_dev_kref_release()` when the `struct comedi_device` is freed.
The calls to `dev_dbg()` etc. after the call to `device_destroy()` will
still produce valid output, although the device will have been
unregistered in sysfs.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: TIDSPBRIDGE: Remove UUID helper
Ivaylo Dimitrov [Tue, 10 Dec 2013 22:03:12 +0000 (00:03 +0200)]
Staging: TIDSPBRIDGE: Remove UUID helper

Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't
need to be exported. It can also be made way simpler by using sscanf.

Signed-off-by: Ivaylo Dimitrov <freemangordon@abv.bg>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: Remove unused scStatistic data/functions from driver.
Malcolm Priestley [Wed, 11 Dec 2013 21:23:31 +0000 (21:23 +0000)]
staging: vt6656: Remove unused scStatistic data/functions from driver.

None of these stats reach user. So delete them from driver

mib.c and mib.h becomes dead code as result of this patch.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6656: dead code remove mib.c mic.h from driver.
Malcolm Priestley [Wed, 11 Dec 2013 21:25:38 +0000 (21:25 +0000)]
staging: vt6656: dead code remove mib.c mic.h from driver.

As result of patch
staging: vt6656: Remove unused scStatistic data from driver.

mib.c mic.h is dead code

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: delete non-required instances of include <linux/init.h>
Paul Gortmaker [Tue, 10 Dec 2013 20:23:48 +0000 (15:23 -0500)]
staging: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agoStaging: TIDSPBRIDGE: Fix mmap to map the correct region of physical memory
Steven Luo [Wed, 11 Dec 2013 20:51:56 +0000 (22:51 +0200)]
Staging: TIDSPBRIDGE: Fix mmap to map the correct region of physical memory

Commit 559c71fe5dc3 ("Staging: TIDSPBRIDGE: Use vm_iomap_memory for
mmap-ing instead of remap_pfn_range") had the effect of inadvertently
shifting the start of the physical memory area mapped by
pdata->phys_mempool_base.  Correct this by subtracting that shift before
calling vm_iomap_memory() and adding it back afterwards.

Reported-by: Dheeraj CVR <cvr.dheeraj@gmail.com>
Signed-off-by: Ivaylo Dimitrov <freemangordon@abv.bg>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: et131x: improve code consistency: access struct tx_ring
ZHAO Gang [Sun, 8 Dec 2013 03:01:07 +0000 (11:01 +0800)]
staging: et131x: improve code consistency: access struct tx_ring

Let all the code use a pointer called tx_ring to access struct tx_ring
members.

Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: et131x: improve code consistency: access struct rx_ring
ZHAO Gang [Sun, 8 Dec 2013 03:01:06 +0000 (11:01 +0800)]
staging: et131x: improve code consistency: access struct rx_ring

Let all the code use a pointer called rx_ring to access struct rx_ring
members.

Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: s626: tidy up comedi_lrange table
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:28 +0000 (17:31 -0700)]
staging: comedi: s626: tidy up comedi_lrange table

The comedi_lrange tables are fixed length based on the 'length' value
before the array of comedi_krange 'range' values. For aesthetics, remove
the trailing comma from last 'range' value.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adl_pci9111: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:27 +0000 (17:31 -0700)]
staging: comedi: adl_pci9111: tidy up comedi_lrange tables

Tidy up the format of the comedi_lrange table.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1724: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:26 +0000 (17:31 -0700)]
staging: comedi: adv_pci1724: tidy up comedi_lrange tables

Tidy up the format of the comedi_lrange table.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbduxfast: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:25 +0000 (17:31 -0700)]
staging: comedi: usbduxfast: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_at_a2150: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:24 +0000 (17:31 -0700)]
staging: comedi: ni_at_a2150: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Use the BIP_RANGE macro instead of the more generic RANGE macro to
reduce the potential for typos.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: comedi_test: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:23 +0000 (17:31 -0700)]
staging: comedi: comedi_test: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: dyna_pci10xx: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:22 +0000 (17:31 -0700)]
staging: comedi: dyna_pci10xx: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: me4000: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:21 +0000 (17:31 -0700)]
staging: comedi: me4000: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: icp_multi: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:20 +0000 (17:31 -0700)]
staging: comedi: icp_multi: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: aio_aio12_8: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:19 +0000 (17:31 -0700)]
staging: comedi: aio_aio12_8: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:18 +0000 (17:31 -0700)]
staging: comedi: pcl816: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: fl512: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:17 +0000 (17:31 -0700)]
staging: comedi: fl512: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das16m1: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:16 +0000 (17:31 -0700)]
staging: comedi: das16m1: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adq12b: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:15 +0000 (17:31 -0700)]
staging: comedi: adq12b: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: dmm32at: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:14 +0000 (17:31 -0700)]
staging: comedi: dmm32at: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci230: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:13 +0000 (17:31 -0700)]
staging: comedi: amplc_pci230: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_pcimio: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:12 +0000 (17:31 -0700)]
staging: comedi: ni_pcimio: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Use the BIP_RANGE and UNI_RANGE macros instead of the more generic
RANGE macro to reduce possible typo errors.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_pci224: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:11 +0000 (17:31 -0700)]
staging: comedi: amplc_pci224: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adl_pci9118: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:10 +0000 (17:31 -0700)]
staging: comedi: adl_pci9118: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das1800: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:09 +0000 (17:31 -0700)]
staging: comedi: das1800: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Use the BIP_RANGE and UNI_RANGE macros instead of the more generic
RANGE macro to reduce possible typo errors.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: dt282x: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:08 +0000 (17:31 -0700)]
staging: comedi: dt282x: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Use the BIP_RANGE and UNI_RANGE macros instead of the more generic
RANGE macro to reduce possible typo errors.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: dt2811: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:07 +0000 (17:31 -0700)]
staging: comedi: dt2811: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Use the BIP_RANGE and UNI_RANGE macros instead of the more generic
RANGE macro to reduce possible typo errors.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_atmio16d: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:06 +0000 (17:31 -0700)]
staging: comedi: ni_atmio16d: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: cb_pcidas: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:05 +0000 (17:31 -0700)]
staging: comedi: cb_pcidas: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: dt2801: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:04 +0000 (17:31 -0700)]
staging: comedi: dt2801: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Use the BIP_RANGE and UNI_RANGE macros instead of the more generic
RANGE macro to reduce possible typo errors.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: das08: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:03 +0000 (17:31 -0700)]
staging: comedi: das08: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1710: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:02 +0000 (17:31 -0700)]
staging: comedi: adv_pci1710: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:01 +0000 (17:31 -0700)]
staging: comedi: pcl818: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: cb_pcidas64: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:31:00 +0000 (17:31 -0700)]
staging: comedi: cb_pcidas64: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: ni_mio_common: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:30:59 +0000 (17:30 -0700)]
staging: comedi: ni_mio_common: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Use the BIP_RANGE and UNI_RANGE macros instead of the more generic
RANGE macro to reduce possible typo errors.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: tidy up comedi_lrange tables
H Hartley Sweeten [Tue, 10 Dec 2013 00:30:58 +0000 (17:30 -0700)]
staging: comedi: pcl812: tidy up comedi_lrange tables

Tidy up the whitespace in the comedi_lrange tables.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_1032: fix subdevice type/flags bug
H Hartley Sweeten [Mon, 9 Dec 2013 23:06:41 +0000 (16:06 -0700)]
staging: comedi: addi_apci_1032: fix subdevice type/flags bug

The SDF_CMD_READ should be one of the s->subdev_flags not part of
the s->type.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: fix final checkpatch warning
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:24 +0000 (15:31 -0700)]
staging: comedi: pcmmio: fix final checkpatch warning

Fis the last checkpatch.pl warning in this driver:

WARNING: space prohibited between function name and open parenthesis '('
+           comedi_buf_put (s->async, val >> 16)) {

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: tidy up the multi-line comments
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:23 +0000 (15:31 -0700)]
staging: comedi: pcmmio: tidy up the multi-line comments

Tidy up the multi-line comments are the beginning of the file to follow
the CodingStyle.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: update the MODULE_DESCRIPTION
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:22 +0000 (15:31 -0700)]
staging: comedi: pcmmio: update the MODULE_DESCRIPTION

Change the MODULE_DESCRIPTION to something more usefull than the
generic "Comedi low-level driver".

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: return '0' after successful attach
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:21 +0000 (15:31 -0700)]
staging: comedi: pcmmio: return '0' after successful attach

The comedi core expects the (*attach) functions to return < 0 to indicate
an error or >= 0 for success. Change the return to '0' as that is more
typical.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: cleanup the private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:20 +0000 (15:31 -0700)]
staging: comedi: pcmmio: cleanup the private data

Fix the types of some of the private data members. The 'enabled_mask' and
'stop_count' should be unsigned int values. The 'active' and 'continuous'
members are flags, change them to unsigned int bit fields.

Remove the 'sprivs' pointer. This should have been removed when the subdevice
private data was removed.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove unused defines
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:19 +0000 (15:31 -0700)]
staging: comedi: pcmmio: remove unused defines

These defines are not longer used in the driver. Remove them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: tidy up pcmmio_start_intr()
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:18 +0000 (15:31 -0700)]
staging: comedi: pcmmio: tidy up pcmmio_start_intr()

Refactor the function to remove some indent levels.

Use pcmmio_dio_write() to write the polarity and enable paged registers
instead of using the for () loop to write each register in the pages.

The for () loop actually has a bug. It switches the page to the 'enab'
registers for the first port then switches to the 'pol' registers for
all remaining writes. It also was not using the pagelock spinlock to
protect the writes to the page registers. Using the pcmmio_dio_write()
helper ensures that the writes to the paged registers complete correctly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: setup irq routing during (*attach)
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:17 +0000 (15:31 -0700)]
staging: comedi: pcmmio: setup irq routing during (*attach)

To use interrupts the IRQ routing must be configured and interrupts
enabled. Currently both steps are being handled in pcmmio_start_intr().

Move the code that sets the IRQ routing into the attach of the board.
At this point interrupts are still disabled. The enable and polarity
bits just need to be set in pcmmio_start_intr() to enable them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: only hook up async command support if irq is available
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:16 +0000 (15:31 -0700)]
staging: comedi: pcmmio: only hook up async command support if irq is available

Refactor the board attach so that the async commands support is only
hooked up if the irq is actually available.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: tidy up pcmmio_handle_dio_intr()
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:15 +0000 (15:31 -0700)]
staging: comedi: pcmmio: tidy up pcmmio_handle_dio_intr()

Refactor the code to remove some of the indent levels.

Remove 'mytrig', the shift and mask end up making it the same as 'triggered'
anyway.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: factor the trigger handling out of interrupt_pcmmio()
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:14 +0000 (15:31 -0700)]
staging: comedi: pcmmio: factor the trigger handling out of interrupt_pcmmio()

Factor the code that actually handles the digital input triggers out of
the interrupt handler.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: use pcmmio_dio_{read, write}() in interrupt_pcmmio()
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:13 +0000 (15:31 -0700)]
staging: comedi: pcmmio: use pcmmio_dio_{read, write}() in interrupt_pcmmio()

Use the helper functions to read/write the PCMMIO_PAGE_INT_ID registers. This
allows removing the need to lock/unlock the spinlock 'pagelock' and removes the
need for the for () loop that did the read/write of the 3 paged registers.

Also, remove the need for the 'got1' local variable by just returning 'IRQ_NONE'
if there are not interrupts pending.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: cleanup indent levels in interrupt_pcmmio()
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:12 +0000 (15:31 -0700)]
staging: comedi: pcmmio: cleanup indent levels in interrupt_pcmmio()

Remove the extra indent levels in this function that resulted from
code removed in previous patches.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: use comedi_legacy_detach() for (*detach)
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:11 +0000 (15:31 -0700)]
staging: comedi: pcmmio: use comedi_legacy_detach() for (*detach)

The (*detach) of this driver just calls comedi_legacy_detach(). Use that
directly for the (*detach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove subdevice private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:10 +0000 (15:31 -0700)]
staging: comedi: pcmmio: remove subdevice private data

Only subdevice[2], the dio interrupt subdevice, uses the subdevice private data.
Move the members from struct pcmmio_subdev_private to struct pcmmio_private and
remove the subdevice private data. This also allows removing the allocation and
freeing of devpriv->sprivs.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove 'num_asic_chans' from subdevice private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:09 +0000 (15:31 -0700)]
staging: comedi: pcmmio: remove 'num_asic_chans' from subdevice private data

The 'num_asic_chans' that support interrupts in the interrupt subdevice is
always initialized to '24'. Remove this unneeded information from the subdevice
private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove 'asic_chan' from subdevice private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:08 +0000 (15:31 -0700)]
staging: comedi: pcmmio: remove 'asic_chan' from subdevice private data

The first 'asic_chan' that supports interrupts in the interrupt subdevice is
always initialized to '0'. Remove this unneeded information from the subdevice
private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove 'first_chan' from subdevice private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:07 +0000 (15:31 -0700)]
staging: comedi: pcmmio: remove 'first_chan' from subdevice private data

The 'first_chan' that supports interrupts in the interrupt subdevice is always
initialized to '0'. Remove this unneeded information from the subdevice private
data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove 'asic' member from subdevice private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:06 +0000 (15:31 -0700)]
staging: comedi: pcmmio: remove 'asic' member from subdevice private data

This member of the subdevice private data is always initialized to '0' by
the only subdevice that uses it. Since we only have one asic on the board
it's really not needed. Just remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove unnecessary for () loop and sanity check
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:05 +0000 (15:31 -0700)]
staging: comedi: pcmmio: remove unnecessary for () loop and sanity check

There is only one asic on the board so the for () loop in the interrupt
handler to check multiple asics is not needed.

The sanity check of the 'irq' in the interrupt handler is also not needed.
If it _is_ wrong we have bigger problems in the kernel.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: unwind the digital i/o subdevice init
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:04 +0000 (15:31 -0700)]
staging: comedi: pcmmio: unwind the digital i/o subdevice init

The board supported by this driver only has one asic that provides the
two digital i/o subdevices. The first dio subdevice has 24 channels that
support interrupts. The second dio subdevice also has 24 channels but no
interrupt support.

To make the code clearer and easier to maintain, remove the for () loop
that initialized these subdevices.

Also, correctly initialize the interrupt subdevice. The current code does
not set the SDF_CMD_READ subdev_flag and does not set the dev->read_subdev
pointer in the comedi_device.

Use the dev->read_subdev pointer in the interrupt handler to get the
interrupt subdevice and private data pointer instead of searching for
them. To keep this patch reviewable, the extra indents in interrupt_pcmmio()
will be removed later.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: simplify pcmmio_stop_intr()
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:03 +0000 (15:31 -0700)]
staging: comedi: pcmmio: simplify pcmmio_stop_intr()

This function is only called by the interrupt subdevice so the sanity
check of the 'asic' is not necessary. Remove it.

The 'nports' is always 3 and the 'firstport' is always 0. Remove the
for () loop that clears the registers to disable the interrupts and
just use the pcmmio_dio_write() helper to write to the three page
registers.

This also fixes a bug where the write to the page registers is not
protected with the spinlock.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove 'iobases' from the subdevice private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:02 +0000 (15:31 -0700)]
staging: comedi: pcmmio: remove 'iobases' from the subdevice private data

This member of the subdevice private data is not longer used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: simplify pcmmio_dio_insn_bits()
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:01 +0000 (15:31 -0700)]
staging: comedi: pcmmio: simplify pcmmio_dio_insn_bits()

Currently this function uses the subdevice private data to get the
iobase address needed to update the dio output channel state and
read the current state of the input channels. This subdevice private
data is in the process of being removed.

Use the subdevice 'index' to determine the base 'port' needed to
access the correct digital i/o registers. The pcmmio_dio_write()
function can then be used to update the outputs.

Introduce a new helper function, pcmmio_dio_read(), to read the
current state of the input channels.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: simplify pcmmio_dio_insn_config()
H Hartley Sweeten [Mon, 9 Dec 2013 22:31:00 +0000 (15:31 -0700)]
staging: comedi: pcmmio: simplify pcmmio_dio_insn_config()

Currently this function uses the subdevice private data to get the
iobase address needed to update the channel configuration. This
subdevice private data is in the process of being removed.

Use the subdevice 'index' to determine the base 'port' needed to
access the correct digital i/o registers. The pcmmio_dio_write()
function can then be used to update the configuration.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: introduce pcmmio_dio_write()
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:59 +0000 (15:30 -0700)]
staging: comedi: pcmmio: introduce pcmmio_dio_write()

The paged registers in the asic need to be spinlock protected to
ensure that the page is not changed while writing to the registers.

Introduce a helper function to make sure the spinlock is used.

Use the new helper in pcmmio_reset(). This is one of the places where
the spinlock is not used.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: rename 'spinlock' in the private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:58 +0000 (15:30 -0700)]
staging: comedi: pcmmio: rename 'spinlock' in the private data

This spinlock_t is meant to protect the page registers in the asic.
Rename it to make this clear.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove 'subpriv' macro
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:57 +0000 (15:30 -0700)]
staging: comedi: pcmmio: remove 'subpriv' macro

This macro relies on a local variable having a specific name. Remove
the macro and add a local variable where used.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: cleanup the digital i/o register defines
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:56 +0000 (15:30 -0700)]
staging: comedi: pcmmio: cleanup the digital i/o register defines

Redefine the registers used to access the digital i/o so that they
are based on the dev->iobase of the board instead of the 'asic_iobase'
that is stored in the private data.

Remove the then unused 'asic_iobase'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: tidy up init_asics()
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:55 +0000 (15:30 -0700)]
staging: comedi: pcmmio: tidy up init_asics()

Rename this function so it has namespace associated with the driver.

The board supported by this driver only has one WinSystems WS16C48 asic
on it that handles the digital i/o. Remove the unnecessary for () loop
that would reset multiple asics.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove 'asic' parameter from switch_page()
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:54 +0000 (15:30 -0700)]
staging: comedi: pcmmio: remove 'asic' parameter from switch_page()

The board supported by this driver only has one WinSystems WS16C48 asic
on it that handles the digital i/o.

Remove the unnecessary 'asic' parameter that is passed to switch_page().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: there is only one asic
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:53 +0000 (15:30 -0700)]
staging: comedi: pcmmio: there is only one asic

The board supported by this driver only has one WinSystems WS16C48 asic
on it that handles the digital i/o.

Remove the 'asics' struct array in the private data and add members for
the single 'asic_iobase' and the spinlock used by the asic.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove unused members in private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:52 +0000 (15:30 -0700)]
staging: comedi: pcmmio: remove unused members in private data

The 'pol' and 'enab' members in the private data are never used. The
'num' member is set during the attach but never used. Remove them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: tidy up the irq request
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:51 +0000 (15:30 -0700)]
staging: comedi: pcmmio: tidy up the irq request

The for () loop that does the request_irq() in this driver is a bit of
an overkill. The code appears to have been copied from the pcmuio driver
which supports boards with 1 or 2 ASIC devices. The board supported by
this driver only has 1 ASIC.

Simplify the code and store the irq number in the comedi_device. This
allows the core to automatically do the free_irq() when the driver is
detached.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: tidy up the ao subdevice init
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:50 +0000 (15:30 -0700)]
staging: comedi: pcmmio: tidy up the ao subdevice init

Add some whitespace to the analog output subdevice init and reorder the
init to follow the "norm" in comedi drivers.

Remove the init of len_chanlist. This member is only used for subdevices
the support async commands. The core will default the value correctly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: tidy up ao_rinsn()
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:49 +0000 (15:30 -0700)]
staging: comedi: pcmmio: tidy up ao_rinsn()

Rename this function so it has namespace associated with the driver.

Move the 'chan' local variable out of the for () loop. The 'chan' is
constant for the comedi_insn and only needs to be fetched once from
the insn->chanspec.

Also, remove the sanity check of the chan. The comedi core will ensure
that the chan is valid for the subdevice before calling this function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: return error if ao conversion times out
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:48 +0000 (15:30 -0700)]
staging: comedi: pcmmio: return error if ao conversion times out

Rename wait_dac_ready() so it has namespace associated with the
driver.

Fix the function so it returns an errno if the conversion times
out. Propogate this errno if it happens.

Define the analog output status register to remove the magic numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: cleanup ao_winsn()
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:47 +0000 (15:30 -0700)]
staging: comedi: pcmmio: cleanup ao_winsn()

Rename this function to have namespace associated with the driver.

Refactor the function to remove the extra write to the command register
to set the range before writing the DAC value. Since the range is constant
for the entire comedi_insn it only needs to be set once. All writes to the
DAC after that will use the same range.

Define the register map for the analog output registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: remove 'iobase' from subdevice private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:46 +0000 (15:30 -0700)]
staging: comedi: pcmmio: remove 'iobase' from subdevice private data

The 'iobase' is only used to pass the iobase address of the analog output
registers to ao_winsn(). This address is simply dev->iobase + 8.

Use that instead and remove the 'iobase' from the subdevice private data.
This removes a couple more uses of the ugly 'subpriv' macro.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: move ao shadow data to device private data
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:45 +0000 (15:30 -0700)]
staging: comedi: pcmmio: move ao shadow data to device private data

There is only one ai subdevice in this driver so there is no reason
to hold the last sample written to each channel in the subdevice
private data. Move the data into the device private data,

This gets some of the data out of the subdevice private data union
and removes some of the uses of the ugly 'subpriv' macro.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: tidy up the ai subdevice init
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:44 +0000 (15:30 -0700)]
staging: comedi: pcmmio: tidy up the ai subdevice init

Add some whitespace to the ai subdevice init and reorder it a bit
to follow the "norm" in comedi drivers.

Remove the init of s->len_chanlist. This member is only used with
subdevices that support async commands. The core will default the
value correctly..

The ai subdevice only uses the s->private member to pass the iobase
to the analog input registers. It's just a copy of the dev->iobase,
use that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: define the offset to the 2nd ADC device
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:43 +0000 (15:30 -0700)]
staging: comedi: pcmmio: define the offset to the 2nd ADC device

There are two ADC devices on this board. The first one handles ai
channels 0-7 and the second one channels 8-15.

Define the offset that is added to the iobase to access the 2nd
ADC device.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: return error if ai conversion times out
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:42 +0000 (15:30 -0700)]
staging: comedi: pcmmio: return error if ai conversion times out

Rename adc_wait_ready() so it has namespace associated with the
driver.

Fix the function so it returns an errno if the conversion times
out. Propogate this errno if it happens.

Define the analog input status register to remove the magic numbers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: cleanup ai_rinsn()
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:41 +0000 (15:30 -0700)]
staging: comedi: pcmmio: cleanup ai_rinsn()

Rename this function to have namespace associated with the driver.

Refactor the function to remove the extra write to the command register
between each ADC conversion. We only need to do one dummy conversion in
order to flush the serial ADC. After that each command will return the
result of the previous conversion.

Define the register map for the analog input registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: use core helpers to munge bipolar ai data
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:40 +0000 (15:30 -0700)]
staging: comedi: pcmmio: use core helpers to munge bipolar ai data

Use the comedi_range_is_bipolar() and comedi_offset_munge() helpers to
munge the bipolar analog input data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: cleanup comedi_lrange tables
H Hartley Sweeten [Mon, 9 Dec 2013 22:30:39 +0000 (15:30 -0700)]
staging: comedi: pcmmio: cleanup comedi_lrange tables

Use the BIP_RANGE and UNI_RANGE macros where appropriate instead of
the more generic RANGE macro.

Rename the range tables so they have namespace associated with the
driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>