Commit graph

8559 commits

Author SHA1 Message Date
Ingo Molnar 174cd4b1e5 sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h>
Fix up affected files that include this signal functionality via sched.h.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-03-02 08:42:32 +01:00
Linus Torvalds caa5942897 staging/iio driver patches for 4.11-rc1
Here is the big staging and iio driver patchsets for 4.11-rc1.
 
 We almost broke even this time around, with only a few thousand lines
 added overall, as we removed the old and obsolete i4l code, but added
 some new drivers for the RPi platform, as well as adding some new IIO
 drivers.
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWK2j/w8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymZ1ACdFR4o6xYrWEizmao4a/u+lUZE1aIAnRmcGcIc
 J+leO1n9bE5iadQvKYUW
 =sKVA
 -----END PGP SIGNATURE-----

Merge tag 'staging-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/iio driver updates from Greg KH:
 "Here is the big staging and iio driver patchsets for 4.11-rc1.

  We almost broke even this time around, with only a few thousand lines
  added overall, as we removed the old and obsolete i4l code, but added
  some new drivers for the RPi platform, as well as adding some new IIO
  drivers.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (669 commits)
  Staging: vc04_services: Fix the "space prohibited" code style errors
  Staging: vc04_services: Fix the "wrong indent" code style errors
  staging: octeon: Use net_device_stats from struct net_device
  Staging: rtl8192u: ieee80211: ieee80211.h - style fix
  Staging: rtl8192u: ieee80211: ieee80211_tx.c - style fix
  Staging: rtl8192u: ieee80211: rtl819x_BAProc.c - style fix
  Staging: rtl8192u: ieee80211: ieee80211_module.c - style fix
  Staging: rtl8192u: ieee80211: rtl819x_TSProc.c - style fix
  Staging: rtl8192u: r8192U.h - style fix
  Staging: rtl8192u: r8192U_core.c - style fix
  Staging: rtl8192u: r819xU_cmdpkt.c - style fix
  staging: rtl8192u: blank lines aren't necessary before a close brace '}'
  staging: rtl8192u: Adding space after enum and struct definition
  staging: rtl8192u: Adding space after struct definition
  Staging: ks7010: Add required and preferred spaces around operators
  Staging: ks7010: ks*: Remove redundant blank lines
  Staging: ks7010: ks*: Add missing blank lines after declarations
  staging: visorbus, replace init_timer with setup_timer
  staging: vt6656: rxtx.c Removed multiple dereferencing
  staging: vt6656: Alignment match open parenthesis
  ...
2017-02-22 12:14:01 -08:00
Cheah Kok Cheong 9ff7400bd3 Staging: comedi: drivers: comedi_test: Add auto-configuration capability
Currently this module needs to be manually configured by COMEDI
userspace tool before the test waveform can be read by a COMEDI
compatible application.

This patch adds auto-configuration capability and makes it the default
loading option. This is achieved by creating a device during init
to stand in for a real hardware device. This allows comedi_auto_config()
to perform auto-configuration. With this patch, the test waveform can
be read by a COMEDI compatible application without needing manual
configuration.

Previous behaviour is still selectable via module loading parameter.
Module loading without passing any parameter will default to
auto-configuration with the same default waveform amplitude and
period values. For auto-configuration, different amplitude and
period values can be set via module loading parameters.

Tested on Xubuntu 16.04 using Xoscope ver: 2.0 which is available
in the Ubuntu repository. Xoscope is a COMEDI compatible digital
oscilloscope application. For manual configuration, only module
loading/unloading is tested.

Here are the truncated dmesg output.
[sudo modprobe comedi_test]

comedi_test: 1000000 microvolt, 100000 microsecond waveform attached
driver 'comedi_test' has successfully auto-configured 'comedi_test'.

[sudo modprobe comedi_test amplitude=2500000 period=150000]

comedi_test: 2500000 microvolt, 150000 microsecond waveform attached
driver 'comedi_test' has successfully auto-configured 'comedi_test'.

[sudo modprobe comedi_test noauto=1]

comedi_test: module is from the staging directory, the quality is unknown,
you have been warned.

For those without an actual hardware, the comedi_test module
is as close as one can get to test the COMEDI system.
Having both auto and manual configuration capability will broaden
the test function of this module.
Hopefully this will make it easier for people to check out the
COMEDI system and contribute to its development.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-16 10:14:45 -08:00
Artur Lorincz e3f75db14d staging: comedi: fixed multiple line dereference
Fixed multiple line dereference for &cmd->scan_begin_arg.

Signed-off-by: Artur Lorincz <larturus@yahoo.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-14 10:17:06 -08:00
Artur Lorincz fa4508ddc3 staging: comedi: made comedi_lrange struct constant
Added the const type qualifier to the comedi_lrange structure.

Signed-off-by: Artur Lorincz <larturus@yahoo.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-14 10:17:06 -08:00
Karthik Nayak 2c9c5f5a73 staging: comedi: ni_pcimio: remove unused variable 'serial_number'
The struct 'ni_private' holds the variable 'serial_number' which post
assignment is never used. Remove the variable and code pertaining to
obtaining its value.

As a side note, this also fixes the following sparse error:
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect type in assignment (different base types)
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    expected restricted __be32 [usertype] serial_number
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:    got unsigned int

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-14 09:08:30 -08:00
Saber Rezvani e1ea433d6e staging: comedi: dyna_pci10xx: usleep_range is preferred over udelay
Fix the checkpatch.pl issue:
CHECK: usleep_range is preferred over udelay

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-14 09:08:30 -08:00
Saber Rezvani df6ff8a1ee staging: comedi: s626: usleep_range is preferred over udelay
Fix the checkpatch.pl issue:
CHECK: usleep_range is preferred over udelay

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-14 09:08:30 -08:00
Saber Rezvani 020883e5e5 staging: comedi: ni_pcidio.c: Spaces preferred around operators
Fix the checkpatch.pl issue:
CHECK: spaces preferred around that '|' (ctx:VxV)

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-14 09:08:30 -08:00
Saber Rezvani 16cc73893f staging: comedi: ni_pcidio: blank line issues
Fix the checkpatch.pl issue:
CHECK: Please use a blank line after function/struct/union/enum
declarations

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-14 09:08:30 -08:00
Saber Rezvani bc9e43ad50 staging: comedi: dmm32at: usleep_range is preferred over udelay
Fix the checkpatch.pl issue:
CHECK: usleep_range is preferred over udelay

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-12 13:22:08 +01:00
Saber Rezvani 4f280a69e9 staging: comedi: dt2801: usleep_range is preferred over udelay
Fix the checkpatch.pl issue:
CHECK: usleep_range is preferred over udelay

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-12 13:22:08 +01:00
Saber Rezvani 9fbe9b06e7 staging: comedi: dt2814: usleep_range is preferred over udelay
Fix the checkpatch.pl issue:
CHECK: usleep_range is preferred over udelay

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-12 13:22:08 +01:00
Saber Rezvani 1b2d7f1981 staging: comedi: dt2815: usleep_range is preferred over udelay
Fix the checkpatch.pl issue:
CHECK: usleep_range is preferred over udelay

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-12 13:22:08 +01:00
Saber Rezvani 8bd05c98b2 staging: comedi: ni_at_a2150: usleep_range is preferred over udelay
Fix the checkpatch.pl issue:
CHECK: usleep_range is preferred over udelay

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-12 13:22:08 +01:00
Ian Abbott 910f404afc staging: comedi: ni_pcimio: Support more PXI cards
Add support for NI PXI-6220, PXI-6221, PXI-6229, PXI-6250, PXI-6254,
PXI-6259, PXIe-6259, PXI-6280, PXI-6284, and PXI-6289 boards, treating
them the same as the correspondingly numbered PCI and PCIe boards (apart
from having different Comedi board name strings).  The same has
previously been done for other PXI boards supported by the driver.

The PCI device IDs for the newly supported boards come from the
"nixswv.inf" file in National Instrument's Windows drivers.

Also, sort `ni_pcimio_pci_table[]` by PCI device ID.  It is mostly
sorted already, so only the entries for PXI-6251 and PXIe-6251 need
moving.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 10:49:50 +01:00
Ian Abbott 0d0ad8298d staging: comedi: ni_660x: Support PCI-6224
Add support for the NI PCI-6224 board, assuming it behaves like the NI
PXI-6224 board at the register level.

The PCI device ID comes from the "nitiowv.inf" file in National
Instrument's Windows drivers.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 10:49:50 +01:00
Peter Zijlstra 2c935bc572 locking/atomic, kref: Add kref_read()
Since we need to change the implementation, stop exposing internals.

Provide kref_read() to read the current reference count; typically
used for debug messages.

Kills two anti-patterns:

	atomic_read(&kref->refcount)
	kref->refcount.counter

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-01-14 11:37:18 +01:00
Cheah Kok Cheong 5dc6f89da1 Staging: comedi: comedi_fops: Remove unused stat.h header
Unused after commit 6e30293976 ("staging: comedi: comedi_fops:
coding style fixes") - Fixed coding style in comedi_fops.c
Symbolic to octal permission.

Anyway it's included in module.h

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:38:32 +01:00
Cheah Kok Cheong 38d14bdbe7 Staging: comedi: comedi_fops: Remove unused vmalloc.h header
Unused after commit d18431325b ("staging: comedi:
deprecate loading firmware with comedi_config").

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:38:32 +01:00
Cheah Kok Cheong 7bfe956c78 Staging: comedi: comedi_fops: Remove redundant init.h header
After commit 0fd972a7d9 ("module: relocate module_init
from init.h to module.h"), including module.h will do and
init.h is also thrown in.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:38:32 +01:00
Cheah Kok Cheong 79adc3577e Staging: comedi: comedi_fops: Remove unused kmod.h header
Unused after commit f30f2c2d41 ("staging: comedi:
remove check for CONFIG_KMOD").

Anyway it's included in module.h

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-10 17:38:32 +01:00
Ian Abbott aa72f35ea6 staging: comedi: daqboard2000: use pci_id_table 'driver_data'
The driver's COMEDI "auto-attach" handler `db2k_auto_attach()` calls
`db2k_find_boardinfo()` to find an element of our board information
array `db2k_boardtypes[]` that matches the probed PCI device.  The
driver's PCI device table matches several boards in the DaqBoard/2000
series that match a single PCI vendor and device ID combination.
`db2k_find_boardinfo()` uses the probed PCI device's subvendor and
subdevice IDs to find the matching board information, returning `NULL`
for no match.

Change the driver's PCI device table `db2k_pci_table[]` to match
supported PCI vendor, device, subvendor and subdevice IDs, and set the
`.driver_data` member of each element to the index of the matching
element of `db2k_boardtypes[]`.  That index gets passed through to the
COMEDI auto-attach handler `db2k_auto_attach()`.  Use it to index
directly into `db2k_boardtypes[]` instead of calling
`db2k_find_boardinfo()` to find the match.
Use array index designators in the initializer of `db2k_boardtypes[]`.
Use enumerated constants defined by new type `enum db2k_boardids` to
name the board type indices.

The `id` member of `struct db2k_boardtype` is no longer used, so remove
it.  Also remove the subdevice ID macros `DB2K_SUBSYSTEM_IDS2` and
`DB2K_SUBSYSTEM_IDS4` as the subdevice IDs are now specified as numbers
in the PCI device table.  Remove `db2k_find_boardinfo()` as it is no
longer used.

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>
2017-01-10 17:38:32 +01:00
Ian Abbott 41ab27de8f staging: comedi: daqboard2000: change COMEDI device names
The COMEDI device name strings are currently set to "ids2" for the
DaqBoard/2000, and to "ids4" for the DaqBoard/2001.  Change them to
"daqboard2000" and "daqboard2001" respectively.  (The COMEDI driver name
string is also "daqboard2000".)

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>
2017-01-10 17:38:32 +01:00
Ian Abbott ca685dc914 staging: comedi: daqboard2000: support 4 AO channels
The driver supports DaqBoard/2000 and DaqBoard/2001. DaqBoard/2000 has 2
AO channels, but DaqBoard/2001 has 4 AO channels.  The driver currently
only supports 2 AO channels, but supporting 4 channels is just a case of
setting the `n_chan` member of the COMEDI subdevice to 4 instead of 2.

Add a new boolean flag member `has_2_ao` to `struct db2k_boardtype` to
be set to `true` if the board only has 2 AO channels.  Set this to
`true` in the element of `db2k_boardtypes[]` that corresponds to the
DaqBoard/2000.  Use it in `db2k_auto_attach()` to initialize the number
of AO channels to 2 or 4, as appropriate.

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>
2017-01-10 17:38:32 +01:00
Ian Abbott 54e22bbf11 staging: comedi: daqboard2000: use designated initializers
Replace the undesignated initializers for each element of
`db2k_boardtypes[]` with an equivalent designated initializer for ease
of future maintenance.

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>
2017-01-10 17:38:32 +01:00
Ian Abbott 852d3f917a staging: comedi: daqboard2000: use shorter, consistent prefix
Use a consistent prefix of `db2k_` or `DB2K_` for identifiers.  The
existing prefixes `DAQBOARD2000_` and `daqboard2000_` are a bit on the
lengthy side.

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>
2017-01-10 17:38:32 +01:00
Ian Abbott 1c5a6eab8b staging: comedi: daqboard2000: remove unused 'card' member
The `card` member of `struct daqboard2000_private` and the enumerated
constant `card_daqboard_2000` are not used.  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>
2017-01-10 17:38:32 +01:00
Ian Abbott fba4e898b9 staging: comedi: daqboard2000: check CPLD status before writing firmware data
According to an old GPL'ed driver at
<ftp://ftp.mccdaq.com/downloads/iotech_software/DaqBoard_1000_2000_Series/Linux_driver_kernelv2.4.x/>,
The CPLD status register can be checked to make sure that it is ready to
accept the next 16-bit word of FPGA firmware data, but that doesn't work
on older versions of the CPLD, where a simple delay should be used
between successive writes.  The current version of the Comedi driver
just uses a delay between successive writes.  Change it to check for the
newer CPLD in the `daqboard2000_load_firmware()`, and change the
firmware word writing function `daqboard2000_write_cpld()` to wait for
the status bit (`DB2K_CPLD_STATUS_TXREADY`, previously called
`DB2K_CPLD_TXDONE`) to be set for newer CPLD, or just delay for older CPLD.
Return an error if it times out waiting for the status bit.

The wait for the `DB2K_CPLD_STATUS_TXREADY` status bit to be set is
performed by new function `daqboard2000_wait_cpld_txready()`, which
returns 0 if the status bit is set within 100 microseconds, or
`-ETIMEDOUT` if not.

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>
2017-01-10 17:38:32 +01:00
Ian Abbott f8d7b3b2f9 staging: comedi: daqboard2000: check result of FPGA programming
According to an old, GPL'ed Linux driver at
<ftp://ftp.mccdaq.com/downloads/iotech_software/DaqBoard_1000_2000_Series/Linux_driver_kernelv2.4.x/>,
after programming the FPGA, the General Purpose Input (USERI) of the PLX
PCI-9080 should go high shortly after a valid FPGA bitstream has been
loaded.  Add a new function `daqboard2000_wait_fpga_programmed()` to
wait for that, performing up to 200 checks over a 20 ms period (this is
loosely based on `pollFPGADone()` in the above-mentioned old driver).
Return 0 if the FPGA appears to have loaded successfully, or
`-ETIMEDOUT` if it runs out of checks.  Call it from the firmware
loading callback `daqboard2000_load_firmware()` after writing the
firmware to the FPGA to check it is programmed successfully.

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>
2017-01-10 17:38:32 +01:00
Ian Abbott 7680a22729 staging: comedi: daqboard2000: change daqboard2000_write_cpld() return value
`daqboard2000_write_cpld()` currently returns 1 on success, or 0 on
failure.  Change it to return 0 on success, or `-EIO` on failure.

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>
2017-01-10 17:38:32 +01:00
Ian Abbott 90bc9cb34b staging: comedi: daqboard2000: replace daqboard2000_poll_cpld()
`daqboard2000_poll_cpld()` waits for a specified status bit in the CPLD
status register to be set, giving up after 50 tries over a period of
about 5 milliseconds.  It returns 1 if the status bit is set, otherwise
0.  It is only ever called to check the "INIT" status bit.  Replace it
with new function `daqboard2000_wait_cpld_init()`, which returns 0 if
the "INIT" status bit becomes set within 50 tries, or `-ETIMEDOUT` if
not set within 50 tries.  The firmware loading callback
`daqboard2000_load_firmware()` may return the error result from
`daqboard2000_wait_cpld_init()` if it has used up all its firmware
loading attempts and that was the last error.

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>
2017-01-10 17:38:32 +01:00
Ian Abbott 7cff0b776a staging: comedi: daqboard2000: check firmware length
Firmware files for DAQBoard/2000 have a header, which is skipped,
followed by a sequence of FPGA configuration bytes to be programmed in
pairs.  The FPGA configuration bytes start with the sequence 0xff, 0x20.

Make the firmware loading callback function
`daqboard2000_load_firmware()` return an error `-EINVAL` if the FPGA
start sequence is not found, or the remaining length is not a multiple
of 2.

The firmware loading callback tries to program the FPGA up to 3 times
until it succeeds or it has tried too many times.  Currently, it
searches for the FPGA start sequence in the firmware data each time
through the retry loop.  Change it to adjust the start position and
length before entering the loop.

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>
2017-01-10 17:38:32 +01:00
Ian Abbott 3bc3a82390 staging: comedi: daqboard2000: use type 'u16' for CPLD data and status
The CPLD status and data registers used to load firmware are 16 bits
wide.  Use the type `u16` to represent data and status values instead of
`int`.

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>
2017-01-10 17:38:32 +01:00
Ian Abbott 1736bcf3c5 staging: comedi: daqboard2000: define macros for CPLD registers
The Daqboard/2000 uses a write-only data register and a read-only status
register in a pre-programmed CPLD device to program the main firmware on
the board.  Both registers are at offset 0x1000 from PCI BAR 2.  Define
macros for the register offsets.  Rename the existing macros for the
status register values for consistency.  (Two status bits are defined,
but the driver code only seems to use one of 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>
2017-01-10 17:38:32 +01:00
Ian Abbott 1d7f14dd92 staging: comedi: daqboard2000: use macros from "plx9080.h"
The Daqboard/2000 uses a PLX PCI-9080 chip to interface with the PCI
bus.  The "daqboard2000" driver uses the PCI-9080 "CNTRL" register to
perform various tasks, but defines its own macros for the register
values.  Use the macros from "plx9080.h" instead.  The various functions
that change the CNTRL register just wiggle individual bits up and down,
but they ignore the current register value - the old macros defined the
full value to be written to the register.  Change them to read and
modify the register value.

Also remove a read of the CNTRL register in `daqboard2000_auto_attach()`
where the value is just thrown away, as it seems to serve no purpose
there (such as flushing PCI writes).

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>
2017-01-10 17:38:32 +01:00
Cheah Kok Cheong 2e4b5cd641 Staging: comedi: proc: Warn if unable to create proc entry
The proc entry is not essential for the comedi system as
evident by the support for !CONFIG_PROC_FS. So for failure
to create, just warn and continue loading.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:30:21 +01:00
Cheah Kok Cheong 6bd68e29b6 Staging: comedi: proc: Add module owner
Since this is a loadable kernel module, add module ownership
to follow LKM semantics.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:30:21 +01:00
Cheah Kok Cheong ec0bff06bb Staging: comedi: proc: Add __init prefix
Add __init prefix so that symbol will be discarded after
module loading.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:30:21 +01:00
Cheah Kok Cheong 5f52f319cd Staging: comedi: proc: Change file permission to read only
As there's no write operation, change to read only.
Was inadvertantly switched to 0644 in commit 1f817b86d5
("comedi: Don't use create_proc_read_entry()").

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:30:21 +01:00
Cheah Kok Cheong bf279ece37 Staging: comedi: comedi_fops: Avoid orphaned proc entry
Move comedi_proc_init to the end to avoid orphaned proc entry
if module loading failed.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:30:21 +01:00
Cheah Kok Cheong 3358a0ca21 Staging: comedi: comedidev.h: Drop old style zero-length array
According to Documentation/Changes, the minimum gcc version required
to compile the kernel is 3.2 (this is probably outdated too).

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:29:06 +01:00
Saber Rezvani 3c4a2d9e25 staging: comedi: ni_670x: using the BIT(x) macro
Fix the checkpatch.pl issue:
CHECK: Prefer using the BIT macro
replacing bit shifting on 1 with the BIT(x) macro.

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:29:06 +01:00
Saber Rezvani 8f2ee91256 staging: comedi: ni_at_ao: using the BIT(x) macro
Fix the checkpatch.pl issue:
CHECK: Prefer using the BIT macro
replacing bit shifting on 1 with the BIT(x) macro.

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:29:06 +01:00
Saber Rezvani db30e33f4a staging: comedi: cb_pcidas64: use preferred kernel type u32
Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u32' over 'uint32_t'

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:29:06 +01:00
Saber Rezvani 9e23afed35 staging: comedi: cb_pcidas64: use preferred kernel type u16
Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u16' over 'uint16_t'

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:29:06 +01:00
Saber Rezvani 7afd6d2179 staging: comedi: cb_pcidas64: use preferred kernel type u8
Fix the checkpatch.pl issue:
CHECK: Prefer kernel type 'u8' over 'uint8_t'

Signed-off-by: Saber Rezvani <irsaber@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03 15:29:06 +01:00
Ian Abbott 9fe3b628e6 staging: comedi: comedidev.h: add identifiers to function parameters
Fix checkpatch.pl warnings of the form "function definition argument
'foo' should also have an identifier name".

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>
2017-01-03 15:27:55 +01:00
Ian Abbott 1016d5a6c2 staging: comedi: comedi_usb.h: add identifiers to function parameters
Fix checkpatch.pl warnings of the form "function definition argument
'foo' should also have an identifier name".

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>
2017-01-03 15:27:55 +01:00
Ian Abbott 514871ef43 staging: comedi: comedi_pcmcia.[ch]: add identifiers to function parameters
Fix checkpatch.pl warnings of the form "function definition argument
'foo' should also have an identifier name".

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>
2017-01-03 15:27:55 +01:00