Commit graph

8848 commits

Author SHA1 Message Date
Pratik Jain
988f4a3b6a Staging: comedi: drivers: ni_atmio.c: fixed multi-line derefernce issue
Fixed coding style issue.

Signed-off-by: Pratik Jain <pratik.jain0509@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-19 19:43:24 +01:00
Greg Kroah-Hartman
73709e1af5 Merge 4.16-rc6 into staging-next
We want the staging fixes in here as well to handle merge/test issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-19 06:47:01 +01:00
Colin Ian King
b8461ff774 staging: comedi: adl_pci6208: remove redundant initialization of 'val'
Variable 'val' is initialized with a value that is never read, it is
updated with a new value again after intitialization. Remove the
redundant initialization and move the declaration and assignment into
the scope of the for-loop.

Cleans up clang warning:
drivers/staging/comedi/drivers/adl_pci6208.c:61:15: warning: Value
stored to 'val' during its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 12:57:06 +01:00
Frank Mori Hess
a42ae59051 staging: comedi: fix comedi_nsamples_left.
A rounding error was causing comedi_nsamples_left to
return the wrong value when nsamples was not a multiple
of the scan length.

Cc: <stable@vger.kernel.org> # v4.4+
Signed-off-by: Frank Mori Hess <fmh6jj@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 07:21:10 -08:00
Arushi Singhal
471c3615e5 staging: comedi: Replace "dont" with "don't
Replace "dont" with "don't".
"Dont" is not same as "Do not" or "Don't".

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:01:10 -08:00
Eisha Chen-yen-su
38614ed802 staging: comedi: Use '"%s:", __func__' instead of function name
Replace all occurrences of functions' names in strings by a reference
to __func__, to improve robustness. Problem found with checkpatch.

Signed-off-by: Eisha Chen-yen-su <chenyensu0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 14:53:05 +01:00
Eisha Chen-yen-su
4f7b006ff1 staging: comedi: Remove a "tracing" call
Remove a "tracing" call as it is not needed anymore
because there is an in-kernel function for that.

Signed-off-by: Eisha Chen-yen-su <chenyensu0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 14:53:05 +01:00
Eisha Chen-yen-su
c318bb0835 staging: comedi: Use '"%s:", __func__' instead of function name
Replace an occurrence of the function name in a string by a reference
to __func__, to improve robustness. Problem found with checkpatch.

Signed-off-by: Eisha Chen-yen-su <chenyensu0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-19 17:57:43 +01:00
Eisha Chen-yen-su
b32b2cacd9 staging: comedi: Add a missing space
Add a missing space so that the * is properly aligned with
the rest of the block comment. Problem found with checkpatch.

Signed-off-by: Eisha Chen-yen-su <chenyensu0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-19 17:57:43 +01:00
Eisha Chen-yen-su
cc62f8164e staging: comedi: Remove a newline inside a dereference
Remove a new line inside a dereference so that it is not on
multiple lines.
And avoid making the line go over 80 columns by moving the whole
dma_alloc_coherent() call back 4 columns. Problem found with
checkpatch.

Signed-off-by: Eisha Chen-yen-su <chenyensu0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-19 17:57:43 +01:00
Linus Torvalds
a9a08845e9 vfs: do bulk POLL* -> EPOLL* replacement
This is the mindless scripted replacement of kernel use of POLL*
variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
        L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
        for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
    done

with de-mangling cleanups yet to come.

NOTE! On almost all architectures, the EPOLL* constants have the same
values as the POLL* constants do.  But they keyword here is "almost".
For various bad reasons they aren't the same, and epoll() doesn't
actually work quite correctly in some cases due to this on Sparc et al.

The next patch from Al will sort out the final differences, and we
should be all done.

Scripted-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-02-11 14:34:03 -08:00
Linus Torvalds
5d8515bc23 Staging/IIO patches for 4.16-rc1
Here is the big Staging and IIO driver patches for 4.16-rc1.
 
 There is the normal amount of new IIO drivers added, like all releases.
 
 The networking IPX and the ncpfs filesystem are moved into the staging
 tree, as they are on their way out of the kernel due to lack of use
 anymore.
 
 The visorbus subsystem finall has started moving out of the staging tree
 to the "real" part of the kernel, and the most and fsl-mc codebases are
 almost ready to move out, that will probably happen for 4.17-rc1 if all
 goes well.
 
 Other than that, there is a bunch of license header cleanups in the
 tree, along with the normal amount of coding style churn that we all
 know and love for this codebase.  I also got frustrated at the
 Meltdown/Spectre mess and took it out on the dgnc tty driver, deleting
 huge chunks of it that were never even being used.
 
 Full details of everything is in the shortlog.
 
 All of these patches have been in linux-next for a while with no
 reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWnLxoA8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yk4vgCgjeMlwhtar65DIticIRj626EFxiQAnjGmH8Kd
 d9Xz2Piq8X47uSsC/6AE
 =xxMT
 -----END PGP SIGNATURE-----

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

Pull staging/IIO updates from Greg KH:
 "Here is the big Staging and IIO driver patches for 4.16-rc1.

  There is the normal amount of new IIO drivers added, like all
  releases.

  The networking IPX and the ncpfs filesystem are moved into the staging
  tree, as they are on their way out of the kernel due to lack of use
  anymore.

  The visorbus subsystem finall has started moving out of the staging
  tree to the "real" part of the kernel, and the most and fsl-mc
  codebases are almost ready to move out, that will probably happen for
  4.17-rc1 if all goes well.

  Other than that, there is a bunch of license header cleanups in the
  tree, along with the normal amount of coding style churn that we all
  know and love for this codebase. I also got frustrated at the
  Meltdown/Spectre mess and took it out on the dgnc tty driver, deleting
  huge chunks of it that were never even being used.

  Full details of everything is in the shortlog.

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

* tag 'staging-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (627 commits)
  staging: rtlwifi: remove redundant initialization of 'cfg_cmd'
  staging: rtl8723bs: remove a couple of redundant initializations
  staging: comedi: reformat lines to 80 chars or less
  staging: lustre: separate a connection destroy from free struct kib_conn
  Staging: rtl8723bs: Use !x instead of NULL comparison
  Staging: rtl8723bs: Remove dead code
  Staging: rtl8723bs: Change names to conform to the kernel code
  staging: ccree: Fix missing blank line after declaration
  staging: rtl8188eu: remove redundant initialization of 'pwrcfgcmd'
  staging: rtlwifi: remove unused RTLHALMAC_ST and RTLPHYDM_ST
  staging: fbtft: remove unused FB_TFT_SSD1325 kconfig
  staging: comedi: dt2811: remove redundant initialization of 'ns'
  staging: wilc1000: fix alignments to match open parenthesis
  staging: wilc1000: removed unnecessary defined enums typedef
  staging: wilc1000: remove unnecessary use of parentheses
  staging: rtl8192u: remove redundant initialization of 'timeout'
  staging: sm750fb: fix CamelCase for dispSet var
  staging: lustre: lnet/selftest: fix compile error on UP build
  staging: rtl8723bs: hal_com_phycfg: Remove unneeded semicolons
  staging: rts5208: Fix "seg_no" calculation in reset_ms_card()
  ...
2018-02-01 09:51:57 -08:00
Linus Torvalds
168fe32a07 Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull poll annotations from Al Viro:
 "This introduces a __bitwise type for POLL### bitmap, and propagates
  the annotations through the tree. Most of that stuff is as simple as
  'make ->poll() instances return __poll_t and do the same to local
  variables used to hold the future return value'.

  Some of the obvious brainos found in process are fixed (e.g. POLLIN
  misspelled as POLL_IN). At that point the amount of sparse warnings is
  low and most of them are for genuine bugs - e.g. ->poll() instance
  deciding to return -EINVAL instead of a bitmap. I hadn't touched those
  in this series - it's large enough as it is.

  Another problem it has caught was eventpoll() ABI mess; select.c and
  eventpoll.c assumed that corresponding POLL### and EPOLL### were
  equal. That's true for some, but not all of them - EPOLL### are
  arch-independent, but POLL### are not.

  The last commit in this series separates userland POLL### values from
  the (now arch-independent) kernel-side ones, converting between them
  in the few places where they are copied to/from userland. AFAICS, this
  is the least disruptive fix preserving poll(2) ABI and making epoll()
  work on all architectures.

  As it is, it's simply broken on sparc - try to give it EPOLLWRNORM and
  it will trigger only on what would've triggered EPOLLWRBAND on other
  architectures. EPOLLWRBAND and EPOLLRDHUP, OTOH, are never triggered
  at all on sparc. With this patch they should work consistently on all
  architectures"

* 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (37 commits)
  make kernel-side POLL... arch-independent
  eventpoll: no need to mask the result of epi_item_poll() again
  eventpoll: constify struct epoll_event pointers
  debugging printk in sg_poll() uses %x to print POLL... bitmap
  annotate poll(2) guts
  9p: untangle ->poll() mess
  ->si_band gets POLL... bitmap stored into a user-visible long field
  ring_buffer_poll_wait() return value used as return value of ->poll()
  the rest of drivers/*: annotate ->poll() instances
  media: annotate ->poll() instances
  fs: annotate ->poll() instances
  ipc, kernel, mm: annotate ->poll() instances
  net: annotate ->poll() instances
  apparmor: annotate ->poll() instances
  tomoyo: annotate ->poll() instances
  sound: annotate ->poll() instances
  acpi: annotate ->poll() instances
  crypto: annotate ->poll() instances
  block: annotate ->poll() instances
  x86: annotate ->poll() instances
  ...
2018-01-30 17:58:07 -08:00
Eujon Sellers
26311087d1 staging: comedi: reformat lines to 80 chars or less
This is a cleanup patch to fix line length issue found
by checkpatch.pl script.

In this patch, lines 186, 192 and 199 have been wrapped.

Signed-off-by: Eujon Sellers <eujon.sellers@gmail.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-26 15:08:43 +01:00
Colin Ian King
d8bc23d3ba staging: comedi: dt2811: remove redundant initialization of 'ns'
Variable ns is being initialized with a value that is never read, ns
is being re-assigned a new value later on. Remove the redundant
initialization.

Cleans up clang warning:
drivers/staging/comedi/drivers/dt2811.c:310:21: warning: Value stored
to 'ns' during its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-23 11:51:12 +01:00
Richard Sudaryono
357f862bd2 staging: comedi: adv_pci1760: fix typo in comments
Changed 'firware' to 'firmware'

Signed-off-by: Richard Sudaryono <richardsudaryono@gmail.com>
2018-01-08 16:45:45 +01:00
Michael Gebhard
2c5f7348fe staging: comedi: add identifiers to function parameters
Fix these checkpatch.pl warnings in comedidev.h:
WARNING: function definition argument '<name>' should also have an identifier name

Introduces this checkpatch.pl warning in lines 195 and 205:
WARNING: line over 80 characters
Breaking these lines would make the code less compact.

Signed-off-by: Michael Gebhard <im72ywil@cip.cs.fau.de>
Signed-off-by: David Sauerwein <la38vyti@cip.cs.fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-21 18:25:37 +01:00
Roman Lakeev
e9f14f1954 staging: comedi: s626.c - fix multiline dereference
staging: comedi: s626.c - fix the following checkpatch issues:
WARNING: Avoid multiple line dereference - prefer 'devpriv->rps_buf.logical_base'
#1380: FILE: drivers/s626.c:1380:
+				   (unsigned long)devpriv->
+						  rps_buf.logical_base);

WARNING: Avoid multiple line dereference - prefer 'cmd->scan_begin_arg'
#1898: FILE: drivers/s626.c:1898:
+			err |= comedi_check_trigger_arg_min(&cmd->
+							    scan_begin_arg,

Signed-off-by: Roman Lakeev <sunnyddayss@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-19 15:10:09 +01:00
Vikash Kesarwani
e0a0df6319 Staging: comedi: drivers: serial2002 fixed a blank line coding style
Fixed a blank line coding style after a declaration

Signed-off-by: Vikash Kesarwani <vikash.ckiiita30@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-13 12:43:08 +01:00
Greg Kroah-Hartman
e8cd29b774 Merge Linus's staging merge point into staging-next
This resolves the merge issue pointed out by Stephen in
drivers/iio/adc/meson_saradc.c.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06 15:27:17 +01:00
Al Viro
afc9a42b74 the rest of drivers/*: annotate ->poll() instances
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-11-28 11:06:58 -05:00
Matthew Giassa
02d69c0359 staging: comedi: ni_atmio: fix license warning.
Resolving license check warning for drivers/staging/comedi. Added the
license definitions present in the rest of the module and made sure it's
aligned with the license (GPL) in the comments for the affected file
(ni_atmio.c). Original warning:

WARNING: modpost: missing MODULE_LICENSE() in drivers/staging/comedi//drivers/ni_atmio.o
see include/linux/module.h for more information.

No longer present after change.

Signed-off-by: Matthew Giassa <matthew@giassa.net>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28 14:36:45 +01:00
Greg Kroah-Hartman
f814e74c9b staging: comedi: Remove redundant license text
Now that the SPDX tag is in all comedi files, that identifies the
license in a specific and legally-defined manner.  So the extra GPL text
wording can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text.  And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28 13:20:46 +01:00
Greg Kroah-Hartman
b69839391d staging: comedi: drivers: Remove redundant license text
Now that the SPDX tag is in all comedi files, that identifies the
license in a specific and legally-defined manner.  So the extra GPL text
wording can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text.  And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28 13:20:46 +01:00
Greg Kroah-Hartman
e184e2bed8 staging: comedi: add SPDX identifiers to all greybus driver files
It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/staging/comedi files files with the correct SPDX
license identifier based on the license text in the file itself.  The
SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28 13:20:45 +01:00
Al Viro
e6c8adca20 anntotate the places where ->poll() return values go
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-11-27 16:19:53 -05:00
Colin Ian King
bc4eec76e6 staging: comedi: usbdux: remove redundant initialization of val
The early initialization of val is redundant as the value is never
read and is updated inside a for-loop. Remove the initialization
and move the declaration and initialization to the for-loop scope.
Cleans up clang warning:

drivers/staging/comedi/drivers/usbdux.c:812:15: warning: Value stored
to 'val' during its initialization is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:40 +01:00
Linus Torvalds
449fcf3ab0 Staging/IIO patches for 4.15-rc1
Here is the "big" staging and IIO driver update for 4.15-rc1.
 
 Lots and lots of little changes, almost all minor code cleanups as the
 Outreachy application process happened during this development cycle.
 Also happened was a lot of IIO driver activity, and the typec USB code
 moving out of staging to drivers/usb (same commits are in the USB tree
 on a persistent branch to not cause merge issues.)
 
 Overall, it's a wash, I think we added a few hundred more lines than
 removed, but really only a few thousand were modified at all.
 
 All of these have been in linux-next for a while.  There might be a
 merge issue with Al's vfs tree in the pi433 driver (take his changes,
 they are always better), and the media tree with some of the odd atomisp
 cleanups (take the media tree's version).
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWgnFrg8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymxbwCgtNlBkqD2JJYpLRKvI/C4w1vzZsEAnA2THRkt
 g3ioPBqmqC/2DSbldr2o
 =/ebw
 -----END PGP SIGNATURE-----

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

Pull staging and IIO updates from Greg KH:
 "Here is the "big" staging and IIO driver update for 4.15-rc1.

  Lots and lots of little changes, almost all minor code cleanups as the
  Outreachy application process happened during this development cycle.
  Also happened was a lot of IIO driver activity, and the typec USB code
  moving out of staging to drivers/usb (same commits are in the USB tree
  on a persistent branch to not cause merge issues.)

  Overall, it's a wash, I think we added a few hundred more lines than
  removed, but really only a few thousand were modified at all.

  All of these have been in linux-next for a while. There might be a
  merge issue with Al's vfs tree in the pi433 driver (take his changes,
  they are always better), and the media tree with some of the odd
  atomisp cleanups (take the media tree's version)"

* tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (507 commits)
  staging: lustre: add SPDX identifiers to all lustre files
  staging: greybus: Remove redundant license text
  staging: greybus: add SPDX identifiers to all greybus driver files
  staging: ccree: simplify ioread/iowrite
  staging: ccree: simplify registers access
  staging: ccree: simplify error handling logic
  staging: ccree: remove dead code
  staging: ccree: handle limiting of DMA masks
  staging: ccree: copy IV to DMAable memory
  staging: fbtft: remove redundant initialization of buf
  staging: sm750fb: Fix parameter mistake in poke32
  staging: wilc1000: Fix bssid buffer offset in Txq
  staging: fbtft: fb_ssd1331: fix mirrored display
  staging: android: Fix checkpatch.pl error
  staging: greybus: loopback: convert loopback to use generic async operations
  staging: greybus: operation: add private data with get/set accessors
  staging: greybus: loopback: Fix iteration count on async path
  staging: greybus: loopback: Hold per-connection mutex across operations
  staging: greybus/loopback: use ktime_get() for time intervals
  staging: fsl-dpaa2/eth: Extra headroom in RX buffers
  ...
2017-11-13 20:53:28 -08:00
Greg Kroah-Hartman
b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Anton Dozenko
682455befd staging: comedi: adv_pci_dio: update for PCI-1761
Advantech PCI-1761 device support to the driver adv_pci_dio has been
added. Patch has been successfully tested on a real card (8 digital
outs, 8 digital inputs).

Signed-off-by: Anton Dozenko <anton.dozenko@gmail.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:45:48 +02:00
Arvind Yadav
526739265e staging: comedi: dt282x: fix IRQ assignment for dev->irq.
Here, dev->irq is not assigned with irq. comedi_legacy_detach()
is using dev->irq for release irq and dt282x_attach() is using dev->irq
for initialize comedi_subdevice.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:45:48 +02:00
Gustavo A. R. Silva
0cb7e343de staging: comedi: s526: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:45:48 +02:00
Kees Cook
e44d4907f8 staging/comedi: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer
to all timer callbacks, switch to using the new timer_setup() and
from_timer() to pass the timer pointer explicitly. Adds pointer back to
comedi device from private struct.

Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:45:48 +02:00
Kees Cook
1c937c1390 staging/comedi/das16: Make timer initialization unconditional
With timer initialization made unconditional, there is no reason to
make del_timer_sync() calls conditionally, there by removing the test
of the .data field.

Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-22 10:57:22 +02:00
Linus Torvalds
581bfce969 Merge branch 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more set_fs removal from Al Viro:
 "Christoph's 'use kernel_read and friends rather than open-coding
  set_fs()' series"

* 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  fs: unexport vfs_readv and vfs_writev
  fs: unexport vfs_read and vfs_write
  fs: unexport __vfs_read/__vfs_write
  lustre: switch to kernel_write
  gadget/f_mass_storage: stop messing with the address limit
  mconsole: switch to kernel_read
  btrfs: switch write_buf to kernel_write
  net/9p: switch p9_fd_read to kernel_write
  mm/nommu: switch do_mmap_private to kernel_read
  serial2002: switch serial2002_tty_write to kernel_{read/write}
  fs: make the buf argument to __kernel_write a void pointer
  fs: fix kernel_write prototype
  fs: fix kernel_read prototype
  fs: move kernel_read to fs/read_write.c
  fs: move kernel_write to fs/read_write.c
  autofs4: switch autofs4_write to __kernel_write
  ashmem: switch to ->read_iter
2017-09-14 18:13:32 -07:00
Christoph Hellwig
9a779bc149 serial2002: switch serial2002_tty_write to kernel_{read/write}
Instead of playing games with the address limit.  This also gains
us proper usage of the write counter, time stamp updates and kvec
validation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2017-09-04 19:05:15 -04:00
Simo Koskinen
423a8a6eac staging: comedi: coding style fixes found by checkpatch.pl
The patch removes "WARNING: Prefer using '"%s...", __func__'
to using 'xxxxxxxx', this function's name, in a string" warnings
reported by checkpatch.pl script.

Signed-off-by: Simo Koskinen <koskisoft@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-29 08:25:41 +02:00
Bryan Garza
e4f857f739 Staging: comedi: comedi_fops: fix dev_err() warning style
Changed dev_err() call to use function name constant instead of hardcoded
string. Issue found by checkpatch.

Signed-off-by: Bryan Garza <bry@riseup.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-23 16:26:10 -07:00
Greg Kroah-Hartman
8652892ed4 Merge 4.13-rc5 into staging-next
We need it here for iio fixes.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-14 13:35:22 -07:00
Ian Abbott
cef988642c staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNING
Comedi's read and write file operation handlers (`comedi_read()` and
`comedi_write()`) currently call `copy_to_user()` or `copy_from_user()`
whilst in the `TASK_INTERRUPTIBLE` state, which falls foul of the
`might_fault()` checks when enabled.  Fix it by setting the current task
state back to `TASK_RUNNING` a bit earlier before calling these
functions.

Reported-by: Piotr Gregor <piotrgregor@rsyncme.org>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 4.5+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-30 08:38:43 -07:00
Christopher Mårtensson
dc5b02a908 staging: comedi: ni_mio_common.c: fix coding style issue
"checkpatch.pl -f ..." gave
ERROR: open brace '{' following function definitions go on the next line

Signed-off-by: Christopher Mårtensson <cribalik@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-30 08:00:37 -07:00
Greg Kroah-Hartman
a29e249072 Merge 4.13-rc2 into staging-next
This resolves a merge issue and gets the vmbox drm driver into this
branch to be able to start taking fixes for it...

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-23 19:53:30 -07:00
Ian Abbott
15d5193104 staging: comedi: ni_mio_common: fix AO timer off-by-one regression
As reported by Éric Piel on the Comedi mailing list (see
<https://groups.google.com/forum/#!topic/comedi_list/ueZiR7vTLOU/discussion>),
the analog output asynchronous commands are running too fast with a
period 50 ns shorter than it should be.  This affects all boards with AO
command support that are supported by the "ni_pcimio", "ni_atmio", and
"ni_mio_cs" drivers.

This is a regression bug introduced by commit 080e6795cb ("staging:
comedi: ni_mio_common: Cleans up/clarifies ni_ao_cmd"), specifically,
this line in `ni_ao_cmd_set_update()`:

		/* following line: N-1 per STC */
		ni_stc_writel(dev, trigvar - 1, NISTC_AO_UI_LOADA_REG);

The `trigvar` variable value comes from a call to `ni_ns_to_timer()`
which converts a timer period in nanoseconds to a hardware divisor
value. The function already reduces the divisor by 1 as required by the
hardware, so the above line should not reduce it further by 1.  Fix it
by replacing `trigvar` by `trigvar - 1` in the above line, and remove
the misleading comment.

Reported-by: Éric Piel <piel@delmic.com>
Fixes: 080e6795cb ("staging: comedi: ni_mio_common: Cleans up/clarifies ni_ao_cmd")
Cc: Éric Piel <piel@delmic.com>
Cc: Spencer E. Olson <olsonse@umich.edu>
Cc: <stable@vger.kernel.org> # 4.7+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16 09:13:53 +02:00
Amitoj Kaur Chawla
f47d8b11ee staging: comedi: Use offset_in_page macro
Use offset_in_page macro instead of (var & ~PAGE_MASK)

The Coccinelle semantic patch used to make this change is as follows:
// <smpl>
@@
unsigned long p;
@@
- p & ~PAGE_MASK
+ offset_in_page(p)
// </smpl>

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16 08:41:01 +02:00
Ian Abbott
125178d1eb staging: comedi: use centralized error clean-up in comedi_init()
Centralize the "clean-up on error" handling in `comedi_init()` using
`goto` statements.  Also change some of the explicit `-EIO` return
values to the error return values from the failing functions as there is
no good reason to use `-EIO` explicitly.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-24 00:37:07 +08:00
Ian Abbott
a9332e9ad0 staging: comedi: fix clean-up of comedi_class in comedi_init()
There is a clean-up bug in the core comedi module initialization
functions, `comedi_init()`.  If the `comedi_num_legacy_minors` module
parameter is non-zero (and valid), it creates that many "legacy" devices
and registers them in SysFS.  A failure causes the function to clean up
and return an error.  Unfortunately, it fails to destroy the "comedi"
class that was created earlier.  Fix it by adding a call to
`class_destroy(comedi_class)` at the appropriate place in the clean-up
sequence.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.9+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-24 00:37:07 +08:00
Amisha Singh
38d0353c6e Staging: comedi: ni_labpc_regs: fixed a block comment alignment issue
Fixed a coding style issue.

Signed-off-by: Amisha Singh <amisha.sh22@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13 12:06:56 +02:00
Adrian Stanciu
97b30bad76 staging: comedi: ni_labpc_isadma: fixed a comment coding style issue
Fixed a BLOCK_COMMENT_STYLE warning reported by checkpatch.pl script.

Signed-off-by: Adrian Stanciu <adrian.stanciu.pub@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-06 16:16:09 +02:00
edcarter
3137139a65 Staging: comedi: s626.c: fixed trailing */ style issue
Fixed coding style issue where trailing */ in block comments
were not on separate lines.

Signed-off-by: Elias Carter <edcarter@ualberta.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-04 10:17:42 +02:00
Pan Bian
a455178e59 staging: comedi: addi_apci_3xxx: check return value
Function pci_ioremap_bar() will return a NULL pointer if there is no
enough memory. However, in function apci3xxx_auto_attach(), the return
value of function pci_ioremap_bar() is not validated. This may result in
NULL dereference in following access to dev->mmio. This patch fixes the
bug.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-25 20:43:42 +02:00
Ian Abbott
255364f7b8 staging: comedi: support vm_access_process for mmap'd buffer
If a process that has mmap'd a COMEDI buffer is being run under a
debugger such as GDB, the buffer contents are inaccessible from the
debugger.  Support the `access()` VM operation to allow the buffer
contents to be accessed by another process.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-25 20:43:42 +02:00
Andrea della Porta
e45c237912 staging: comedi: drivers: s626.c - fixed checkpatch issue about data type
staging: comedi: drivers: s626.c - fixed the following checkpatch issue:
CHECK: Prefer kernel type 's16' over 'int16_t'
#1939: FILE: drivers/staging/comedi/drivers/s626.c:1939:
+               int16_t dacdata = (int16_t)data[i];

Signed-off-by: Andrea della Porta <sfaragnaus@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08 17:05:59 +02:00
Ian Abbott
2bbd5023ee staging: comedi: amplc_pci224: convert CLK_CONFIG() macro to function
Convert the `CLK_CLKFIG(chan, src)` macro to a static function
`pci224_clk_config(chan, src)`.  This is consistent with an earlier
change to convert `GAT_CONFIG(chan, src)` to a static function.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08 13:03:17 +02:00
Ian Abbott
a19aa38022 staging: comedi: amplc_pci224: remove 'inline' from pci224_gat_config()
Let the compiler figure out whether `pci224_gat_confip()` should be
inlined by itself.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08 13:03:17 +02:00
Ian Abbott
c5665dfb90 staging: comedi: amplc_pci230: convert CLK_CONFIG() macro to function
Convert the `CLK_CONFIG(chan, src)` macro to a static function
`pci230_clk_config(chan, src)`.  This is consistent with an earlier
change to convert `GAT_CONFIG(chan, src)` to a static function.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08 13:03:17 +02:00
Ian Abbott
112d55e585 staging: comedi: amplc_pci230: remove 'inline' from pci230_gat_config()
Let the compiler figure out whether `pci230_gat_config()` should be
inlined by itself.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08 13:03:17 +02:00
Arnd Bergmann
54f74b492f staging: comedi: labpc: fix isadma dependency
When COMEDI_NI_LABPC is built-in and COMEDI_NI_LABPC_ISA is a loadable
module, thhe ISA DMA code is not reachable by the common module, causing
a link error:

drivers/staging/built-in.o: In function `labpc_interrupt':
ni_labpc_common.c:(.text+0x1d178): undefined reference to `labpc_handle_dma_status'
ni_labpc_common.c:(.text+0x1d1cb): undefined reference to `labpc_drain_dma'
drivers/staging/built-in.o: In function `labpc_ai_cmd':
ni_labpc_common.c:(.text+0x1d8ad): undefined reference to `labpc_setup_dma'

This changes the definition of COMEDI_NI_LABPC_ISADMA so that it will
also be builtin for that case. This looks like a rather old bug, but
I have never seen this in randconfig testing until today.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08 12:54:09 +02:00
simran singhal
cb52fce160 staging: comedi: amplc_pci224: Convert macro GAT_CONFIG to static inline function
Convert macro GAT_CONFIG to static inline function as static inline
functions are preferred over macros. This change is possible since the
arguments at all call sites have the same type.

The uses were updated with Coccinelle:

@r1@
expression dev,reg,chan,src;
@@
-GAT_CONFIG(chan, src)
+pci224_gat_config(chan, src)

Also, the comment describing the macro has been removed.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14 06:27:31 +08:00
Varsha Rao
06cb6b5434 staging: comedi: Compress return logic into one line.
Simplify function return by merging assignment and return into a single
line. The following coccinelle script is used to fix this issue.

@@
expression e;
local idexpression ret;
@@

-ret = e;
-return ret;
+return e;

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14 06:27:31 +08:00
Ian Abbott
d2c94a351b staging: comedi: jr3_pci: change module description
Change the MODULE_DESCRIPTION string from the generic "Comedi low-level
driver" to the more specific "Comedi driver for JR3/PCI force sensor
board".

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Ian Abbott
6541964dcd staging: comedi: jr3_pci: fix initial range[8] max value
`jr3_pci_alloc_spriv()` initializes `spriv->range[8]` to use a maximum
value of 65536, but that will be overwritten with 65535 at a later time
by `jr3_pci_poll_subdevice()` once the "set full scales" command is
complete.  The initial setting looks like a mistake.  This range is only
associated with a couple of dummy channels (channels 56 and 57) to read
back the model number and serial number, so no user code should be
attempting to convert those numbers to physical units.  Just change the
initial value to 65535 to match the final value.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Ian Abbott
8abde9acdf staging: comedi: jr3_pci: check PCI BAR 0 size
The various supported boards have different numbers of subdevices from 1
to 4.  Each subdevice needs a block of registers in PCI BAR 0.  Check
the region is large enough for the required number of subdevices.
Return an error from `jr3_pci_auto_attach()` if it is too small.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Ian Abbott
7cb1c5c2cd staging: comedi: jr3_pci: check sizes at compile time
The driver currently checks the size of `struct jr3_sensor` is correct
when a device is attached, returning an error if it is wrong.  Replace
that with a compile-time check.  We don't care too much about the size
of `struct jr3_sensor` as it is embedded in the larger `struct
jr3_block` and is followed by a lot of padding.  We should care more
that the size of `struct jr3_block` is correct, as it describes the
overall register layout of a block, and there is an array of such blocks
(one per subdevice).  Check its size at compile-time using the
`BUILD_BUG_ON()` macro.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Ian Abbott
6fbd1330e5 staging: comedi: jr3_pci: omit pointless debug info
`jr3_pci_open()` outputs several debug log messages containing serial
numbers of the sensors (one per subdevice) along with a pointer to the
subdevice private data structure.  The latter is of no use, so reformat
the debug log to omit it.

`jr3_pci_alloc_spriv()` outputs a debug log message containing more
useless information about the remapped base address of the board
registers, the sensor registers, and the difference between them.  Get
rid of it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Ian Abbott
9d6a94291e staging: comedi: jr3_pci: use struct jr3_block instead of jr3_t
`struct jr3_t` contains a single array member `block` of member type
`struct jr3_block`.  Rather than using pointers to `struct jr3_t`, just
use pointers to `struct jr3_block` instead and treat it as an array.
Replace the local variables `struct jr3_t __iomem *iobase` with `struct
jr3_block __iomem *block`.  Remove the definition of `struct jr3_t` as
it is no longer needed.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Ian Abbott
4e861f0fd8 staging: comedi: jr3_pci: separate out block type
`struct jr3_t` contains a single array member `block` of a tag-less
`struct` type.  Rename the tag-less `struct` type to `struct jr3_block`
and move its definition outside of `struct jr3_t`.  This will allow us
to use pointers of this type.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Ian Abbott
6c7f58084f staging: comedi: jr3_pci: rename 'channel' to 'block'
The term "channel" is overloaded in this driver.  Rename the `channel`
member of `struct jr3_t` to `block` to reduce confusion.  `block` is an
array of an anonymous `struct` type, with each element covering the
registers for one subdevice.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Ian Abbott
ef3ab9f85c staging: comedi: jr3_pci: rename data to sensor
Rename the `channel[x].data` member of `struct jr3_t` to
`channel[x].sensor` to match its type `struct jr3_sensor`.  Also rename
local variable `ch0data` in `jr3_pci_show_copyright()` to `sensor0` for
consistency.  It points to the `struct jr3_sensor` embedded in the
registers for "channel" 0.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Ian Abbott
713eab88c6 staging: comedi: jr3_pci: rename channel to sensor
The driver overloads the term "channel" a lot.  To help reduce
confusion, rename the `channel` member of `struct
jr3_pci_subdev_private` to `sensor` as it points to a `struct
jr3_sensor`.  Also rename the various function parameters and local
variables called `channel` that point to a `struct jr3_sensor` to
`sensor`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Ian Abbott
c5ad0c7b51 staging: comedi: jr3_pci: rename struct jr3_channel to jr3_sensor
The driver overloads the term "channel" a lot.  To help reduce
confusion, rename `struct jr3_channel` to `struct jr3_sensor`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12 14:57:00 +01:00
Varsha Rao
a2be06266b staging: comedi: Remove useless cast.
Variable dac_data is already declared as of type u8. Again explicit type
casting of dac_data to u8, is not required. Hence this patch removes it
by using the following coccinelle script.

@@
type T;
T *ptr;
T p;
@@
(
- (T *)(&p)
+ &p
|
- (T *)ptr
+ ptr
|
- (T *)(ptr)
+ ptr
|
- (T)(p)
+ p
)

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 19:07:57 +01:00
Ian Abbott
08680307eb staging: comedi: ni_atmio: make device_ids const
The `device_ids[]` passed to `MODULE_DEVICE_TABLE()` should be `const`.
When the "ni_atmio" driver is built-in, gcc warns about `device_ids`
being defined but ununsed.  Make it `const`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 14:08:58 +01:00
Ian Abbott
144113b003 staging: comedi: allow it to be built-in
There is no particular reason why comedi has to be built as kernel
modules.  Remove the `depends on m` from the Kconfig file to allow it to
be built-in.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 14:08:58 +01:00
Cheah Kok Cheong
d1d78d2080 Staging: comedi: comedi_fops: Change comedi_num_legacy_minors type
Change to unsigned to allow removal of negative value check in
init section. Use smaller data type since the max possible
value currently is 48.

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-03-09 14:08:58 +01:00
simran singhal
fb1e87656e staging: comedi: Replace "is is" with "is"
This patch replace "is is " with "is". The replacement couldn't be
automated because sometimes the first "is" was meant to be another
word.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-07 20:00:22 +01:00
Cheah Kok Cheong
607b6cd3d0 Staging: comedi: drivers: comedi_test: Avoid multiple line dereference
Fix checkpatch warning "Avoid multiple line dereference"
using a pointer variable to avoid line wrap.

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-03-06 09:16:58 +01:00
simran singhal
7dfc697124 staging: comedi: Using macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)).
It clarifies the divisor calculations. This occurence was detected using
the coccinelle script:

@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Tobin C. Harding
427fda4e5c staging: comedi: s626: Kernel doc format comments
Checkpatch emits WARNING: Block comments use a trailing */ on a
separate line. Offending comments are commenting variables within
the main data structure of s626 driver. We can move these comments
to kernel doc format with the benefit of clearing the warning and
improving the documentation for the driver.

Remove comments on structure members. Add original comments to the
head of the structure definition in kernel doc format.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
138bec7629 staging: comedi: jr3_pci: replace devpriv->iobase with dev->mmio
The "jr3_pci" driver currently uses the `iobase` member of its private
device data `struct jr3_pci_dev_private` to store a pointer to its
ioremapped register region.  Use the `mmio` member of the `struct
comedi_device` to store this instead, and remove the `iobase` member.
The `iobase` member was of type `struct jr3_t __iomem *`, with the
board's complicated register layout described by `struct jr3_t`.  The
`mmio` member is a generic `void __iomem *`, so its value needs
converting to a `struct jr3_t __iomem *` for our purposes.

Change the clean-up in `jr3_pci_detach()` to call `comedi_pci_detach()`
instead of `comedi_pci_disable()`, as that will iounmap `dev->mmio` for
us.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
8c8022fcd8 staging: comedi: jr3_pci: pass transform by reference
Local function `set_transforms` has a parameter of type `struct
jr3_pci_transform`.  This has a size 32 bytes, which is quite large for
passing around in a function call.  Change it to use type `const struct
jr3_pci_transform *`.  (In practice, it is probably inlined by the
compiler anyway, but doing this seems to save a few bytes.)

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
4af8c81951 staging: comedi: jr3_pci: re-work struct jr3_pci_subdev_private range
The `range` member of `struct jr3_pci_subdev_private` is an array of a
tag-less `struct` type whose layout is similar to `struct
comedi_lrange`.  Both `struct` types end with a member also called
`range`.  In the case of tag-less `struct` type, it is a single `struct
comedi_krange`.  In the case of `struct comedi_lrange`, it is a flexible
array of `struct comedi_krange`.

Elements of the `range` array member in `struct jr3_pci_subdev_private`
are pointed to by elements of the `range_table_list` array member, which
are of type `const struct comedi_lrange *`.  This requires some dodgy
type casting.

To avoid the dodgy type casting, change the element type of the `range`
member of `struct jr3_pci_subdev_private` to be a new type `union
jr3_pci_single_range`.  This contains a member `l` of type `struct
comedi_lrange`, and an array member `_reserved` that is large enough to
encompass the `struct comedi_lrange` plus a single `struct
comedi_krange`.  It is the same size as the previous type.  Accesses to
`spriv->range[i].length` and `spriv->range[i].range` are replaced with
`spriv->range[i].l.length` and `spriv->range[i].l.range[0]` respectively
(where `spriv` is a `struct jr3_pci_subdev_private *`, and `i` is an
array index).  Type-casted pointers to `spriv->range[i]` are replaced
with pointers to `spriv->range[i].l`, which do not require the type
casts.  Since we defined a new type, we can define local variables of
the corresponding pointer type to shorten some lines of code.  This is
made use of in `jr3_pci_alloc_spriv()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
de98befe56 staging: comedi: jr3_pci: separate out poll state enum
The type of the `state` member of `struct jr3_pci_subdev_private` is
defined in-situ as an enumerated type without a tag.  For aesthetic
reasons, define the type as `enum jr3_pci_poll_state` outside the
containing `struct`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
dc5761db87 staging: comedi: jr3_pci: remove next_time_max member
The `next_time_max` member of `struct jr3_pci_subdev_private` is
assigned to, but never read.  Remove it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
67aa069d93 staging: comedi: jr3_pci: remove unneeded 'spriv' checks
If `jr3_pci_auto_attach()` returns with no error, we can now be sure
that the COMEDI subdevice private data structures have been allocated.
Remove the tests for a valid pointer to the private data structure in
`jr3_pci_ai_insn_read()`, `jr3_pci_open()`, and
`jr3_pci_poll_subdevice()`, since they will not be called if the pointer
is invalid.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
048ad49af3 staging: comedi: jr3_pci: re-work firmware copyright display
If debug messages are enabled, the card initialization done in
`jr3_pci_auto_attach()` spits out 24 (0x18) debug messages to show the
null-terminated copyright string embedded in the firmware, one character
at a time, including the ASCII NUL characters at the end.  Factor out
the copyright display into a new function `jr3_pci_show_copyright()` and
re-work it to copy the whole copyright string into a buffer, so that it
can be shown with a single debug message.

Incidentally, this also removes a checkpatch warning "Avoid multiple
line dereference" in the original code.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
47ba9b5285 staging: comedi: jr3_pci: struct comedi_lrange should normally be const
Fix three checkpatch warnings of the form:

WARNING: struct comedi_lrange should normally be const

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
800f35d773 staging: comedi: jr3_pci: Reset all DSPs
The various JR3 PCI models have from 1 to 4 DSPs, one per subdevice.
Prior to loading the firmware to all the DSPs, the initialization code
in `jr3_pci_auto_attach()` resets the first DSP.  As far as I can tell,
it should reset all of them.  Change it to do so.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
8ec04a4918 staging: comedi: jr3_pci: cope with jiffies wraparound
The timer expiry routine `jr3_pci_poll_dev()` checks for expiry by
checking whether the absolute value of `jiffies` (stored in local
variable `now`) is greater than the expected expiry time in jiffy units.
This will fail when `jiffies` wraps around.  Also, it seems to make
sense to handle the expiry one jiffy earlier than the current test.  Use
`time_after_eq()` to check for expiry.

Cc: <stable@vger.kernel.org> # 3.15+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
Ian Abbott
45292be0b3 staging: comedi: jr3_pci: fix possible null pointer dereference
For some reason, the driver does not consider allocation of the
subdevice private data to be a fatal error when attaching the COMEDI
device.  It tests the subdevice private data pointer for validity at
certain points, but omits some crucial tests.  In particular,
`jr3_pci_auto_attach()` calls `jr3_pci_alloc_spriv()` to allocate and
initialize the subdevice private data, but the same function
subsequently dereferences the pointer to access the `next_time_min` and
`next_time_max` members without checking it first.  The other missing
test is in the timer expiry routine `jr3_pci_poll_dev()`, but it will
crash before it gets that far.

Fix the bug by returning `-ENOMEM` from `jr3_pci_auto_attach()` as soon
as one of the calls to `jr3_pci_alloc_spriv()` returns `NULL`.  The
COMEDI core will subsequently call `jr3_pci_detach()` to clean up.

Cc: <stable@vger.kernel.org> # 3.15+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06 09:16:58 +01:00
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
Ian Abbott
751922da90 staging: comedi: comedi_internal.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
7885bc8389 staging: comedi: comedi_compat32.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
bef966264b staging: comedi: ni_tio_internal.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
d83889a87b staging: comedi: ni_tio.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
13938181e2 staging: comedi: ni_labpc.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
22d3c2ca82 staging: comedi: mite.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
81735efcc9 staging: comedi: comedi_isadma.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
00b298544c staging: comedi: comedi_8254.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
cf9781131b staging: comedi: addi_watchdog.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:54 +01:00
Piotr Gregor
e9f363c014 drivers: staging: comedi: fix function prototypes
Add names of parameters to function prototypes in comedi PCI.
Checkpatch reports now no errors.

Signed-off-by: Piotr Gregor <piotrgregor@rsyncme.org>
Reviewed-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:12 +01:00
Ian Abbott
3e0f9b2ca8 staging: comedi: comedidev.h: Document usage of 'detach' handler
Document when the "detach" handler function pointed to by the `detach`
member of a `struct comedi_driver` is called by the comedi core, and how
the "attach" and "auto_attach" handlers can defer clean-up to it when
they return an error to the comedi core.  This is already mentioned as
part of the documentation for `comedi_auto_config()`, but is useful to
document it for `struct comedi_driver` as well, since
`comedi_auto_config()` is not usually called directly by low-level
comedi drivers, and it is not called at all for "legacy" comedi devices
that are configured manually.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-12-08 21:01:23 +01:00
Cheah Kok Cheong
c7ea8b5110 Staging: comedi: kcomedilib: Add module_init/exit function
Add init/exit function to follow LKM semantics.
Apparently this module can still load/unload without
the init/exit function.

Tested loading/unloading with and without this patch.

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>
2016-12-06 10:08:01 +01:00
Saber Rezvani
b13db6bf53 staging: comedi: s626: 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>
2016-12-06 10:08:01 +01:00
Saber Rezvani
0bc4538009 staging: comedi: s626: 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>
2016-12-06 10:08:01 +01:00
Saber Rezvani
d9f9600b8b staging: comedi: s626: 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>
2016-12-06 10:08:01 +01:00
Ian Abbott
e3007002f1 staging: comedi: ni_mio_common: remove variable 'dl' in ni_ai_insn_read()
In `ni_ai_insn_read()`, local variable `dl` is declared as `unsigned
long`, but `unsigned int` will do.  Get rid of it and use local variable
`d` instead.  (That used to be `unsigned short`, but has been `unsigned
int` since kernel version 3.18.)

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-15 11:04:21 +01:00
Ian Abbott
857a661020 staging: comedi: ni_mio_common: fix E series ni_ai_insn_read() data
Commit 0557344e21 ("staging: comedi: ni_mio_common: fix local var for
32-bit read") changed the type of local variable `d` from `unsigned
short` to `unsigned int` to fix a bug introduced in
commit 9c340ac934 ("staging: comedi: ni_stc.h: add read/write
callbacks to struct ni_private") when reading AI data for NI PCI-6110
and PCI-6111 cards.  Unfortunately, other parts of the function rely on
the variable being `unsigned short` when an offset value in local
variable `signbits` is added to `d` before writing the value to the
`data` array:

			d += signbits;
		  	data[n] = d;

The `signbits` variable will be non-zero in bipolar mode, and is used to
convert the hardware's 2's complement, 16-bit numbers to Comedi's
straight binary sample format (with 0 representing the most negative
voltage).  This breaks because `d` is now 32 bits wide instead of 16
bits wide, so after the addition of `signbits`, `data[n]` ends up being
set to values above 65536 for negative voltages.  This affects all
supported "E series" cards except PCI-6143 (and PXI-6143). Fix it by
ANDing the value written to the `data[n]` with the mask 0xffff.

Fixes: 0557344e21 ("staging: comedi: ni_mio_common: fix local var for 32-bit read")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org>
----
Needs backporting to stable kernels 3.18 onwards.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-15 11:04:21 +01:00
Ian Abbott
655c4d442d staging: comedi: ni_mio_common: fix M Series ni_ai_insn_read() data mask
For NI M Series cards, the Comedi `insn_read` handler for the AI
subdevice is broken due to ANDing the value read from the AI FIFO data
register with an incorrect mask.  The incorrect mask clears all but the
most significant bit of the sample data.  It should preserve all the
sample data bits.  Correct it.

Fixes: 817144ae7f ("staging: comedi: ni_mio_common: remove unnecessary use of 'board->adbits'")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-15 11:04:21 +01:00
Greg Kroah-Hartman
ce0347c2b0 Merge 4.9-rc5 into staging-next
We want the staging/iio fixes in here as well to resolve issues and
merge problems.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-14 08:53:56 +01:00
Ian Abbott
55abe8165f staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value
`ni_tio_clock_period_ps()` used to return the clock period in
picoseconds, and had a `BUG()` call for invalid cases.  It was changed
to pass the clock period back via a pointer parameter and return an
error for the invalid cases.  Unfortunately the code to handle
user-specified clock sources with user-specified clock period is still
returning the clock period the old way, which can lead to the caller not
getting the clock period, or seeing an unexpected error.  Fix it by
passing the clock period via the pointer parameter and returning `0`.

Fixes: b42ca86ad6 ("staging: comedi: ni_tio: remove BUG() checks for ni_tio_get_clock_src()")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 4.7+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-07 11:45:42 +01:00
Ted Chen
c9b3272122 staging: comedi: ni_tio: fix warnings of uninitialized variables
Fix the following warnings by initializing these variables
to zero and add error check to return early when the check
returns an error.

drivers/staging/comedi/drivers/ni_tio.c: In function ‘ni_tio_set_sync_mode’:
drivers/staging/comedi/drivers/ni_tio.c:492:28: warning: ‘ps’ may be used uninitialized in this function [-Wuninitialized]
drivers/staging/comedi/drivers/ni_tio.c: In function ‘ni_tio_insn_config’:
drivers/staging/comedi/drivers/ni_tio.c:820:2: warning: ‘temp64’ may be used uninitialized in this function [-Wuninitialized]
drivers/staging/comedi/drivers/ni_tio.c:811:6: note: ‘temp64’ was declared her

Signed-off-by: Ted Chen <tedc.37zngo@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-07 11:22:47 +01:00
Spencer E. Olson
1ffe8bdc09 staging: comedi: ni_mio_common: split out ao arming from ni_ao_inttrig
AO device arming was previously done as a part of ni_ao_inttrig which is
called as a result of the user calling comedi_internal_trigger.  For
start_src == TRIG_EXT, this does not make very much sense since external
triggers should not conceptually need to be software triggered also.  This
patch splits out the arming functionality to allow arming to specifically
and separately be done via the CONFIG_INSN_ARM ioctl command.

In order to provide backwards compatibility, this patch also provides
automatic arming if ni_ao_inttrig is simply called.

Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:17 +02:00
Spencer E. Olson
cc7a6d6c46 staging: comedi: make constants slightly more consistent
This makes INSN_CONFIG_DIO_{INPUT,OUTPUT,OPENDRAIN} simply be copies of the
already-existing constants COMEDI_INPUT, COMEDI_OUTPUT, and
COMEDI_OPENDRAIN.

This change also ensures that if a user happens to use, for example,
COMEDI_INPUT in place of where INSN_CONFIG_DIO_INPUT, the result will
always be the same and also acceptable and correct usage.

Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:16 +02:00
Spencer E. Olson
5c53440daa staging: comedi: porting NI_GPCT constants from comedi.org module
Information pertaining to the NI_GPCT_ARM* registers were added to the
comedi.org version of the comedi kernel.  This adds this information to
the staging-tree version of the comedi kernel.  Relevant comments are also
copied over.

Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:15 +02:00
Jakub Jedelsky
321c799cd9 staging: comedi: Align the * on block comments
Block comments should align the * on each line as reported by checkpatch

Signed-off-by: Jakub Jedelsky <jakub.jedelsky@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:25:06 +02:00
Ramiro Oliveira
37a7029b75 Staging: comedi: Align the * in block comments
Align the * on each line of block comments as reported by checkpatch

Signed-off-by: Ramiro Oliveira <roliveir@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-02 17:29:11 +02:00
sayli karnik
ec9d0754e0 staging: comedi: Use vma_pages function on vma object instead of explicit computation
This patch uses vma_pages function on vma object instead of explicit
computation.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20 14:01:21 +02:00
sayli karnik
e28c631770 staging: comedi: Use the BIT() macro instead of left shifting 1
This patch replaces left shifts on 1 with the BIT(x) macro, as suggested
by checkpatch.pl.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-16 10:27:52 +02:00
Bhumika Goyal
521865a8c9 Staging: comedi: s626: Remove all unused functions
Remove all #ifdef'ed static functions as they are not used anywhere
in the kernel. Some functions were detected using Coccinelle but removed by
hand and some were removed as the functions in which they were getting
used were also unused functions.
Script:

@initialize:python@
@@
def display(name,p):
        print(name,p[0].file)

@r1@
identifier func;
type T;
position p;
@@
static T func@p(...)
{
...
}

@r@
identifier r1.func;
@@
func

@script:python depends on !r@
func << r1.func;
p << r1.p;
@@
display(func,p)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-16 10:27:52 +02:00
Bhumika Goyal
25b80dbe3f Staging: comedi: drivers: Delete NULL check before pci_dev_put
The function pci_dev_put checks whether its argument is NULL and returns
immediately. Therefore, NULL test before the call if not needed.
Found using coccinelle:
@@
expression x;
@@

- if(x)
- pci_dev_put(x);
+ pci_dev_put(x);

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-13 14:51:53 +02:00
Matias Mucciolo
6e30293976 staging: comedi: comedi_fops: coding style fixes
- Fixed coding style in comedi_fops.c Symbolic to octal permission.

Signed-off-by: Matias Mucciolo <mmucciolo@suteba.org.ar>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-13 14:51:53 +02:00
Greg Kroah-Hartman
9c2edd8b5b Merge 4.8-rc5 into staging-next
We want the staging fixes in here as well to handle merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-05 08:13:24 +02:00
Anson Jacob
9f96309698 staging: comedi: cb_pcidas64: Fix checkpath warning
Fix checkpatch.pl warning:
Please use a blank line after function/struct/union/enum declarations

Move macro definition to the top of the file
Aligne macro definitions

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-02 14:40:52 +02:00
Anson Jacob
4281c748d6 staging: comedi: ni_at_a2150: Fix checkpatch warning
Fix checkpatch.pl warning 'line over 80 characters'
Remove extra space after /*

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-02 14:40:51 +02:00
Anson Jacob
d5e59c9678 staging: comedi: jr3_pci.c: Fix checkpatch warning
Fix checkpatch.pl warning 'line over 80 characters'
Remove extra space after /*

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-02 14:40:51 +02:00
Anson Jacob
1c454fabc2 staging: comedi: s626.h: Fix checkpatch warning
Fix checkpatch.pl warning for
Comparisons should place the constant on the right side of the test
Remove extra space after /*

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-02 14:40:51 +02:00
Anson Jacob
da91a80a94 staging: comedi: ni_atmio.c: Fix checkpatch warning
Fix checkpatch.pl warning for 'Statements should start on a tabstop'
Convert single line block comment to single line comment
Align single line comment

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-02 14:40:51 +02:00
Anson Jacob
f8d791f2ab staging: comedi: jr3_pci.h: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Block comments starts with /* followed by comments on the next line

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-02 14:40:51 +02:00
Anson Jacob
12f992adeb staging: comedi: cb_pcidas64: Fix commenting style
Remove additional space after /*
Convert single line block comment into single line comment

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-02 14:40:51 +02:00
Anson Jacob
28fec2e65f staging: comedi: cb_pcidas64.c: Fix checkpatch warning
Fix checkpatch.pl warning:
Block comments use * on subsequent lines
Block comments use a trailing */ on a separate line

Signed-off-by: Anson Jacob <ansonjacob.aj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-02 14:40:51 +02:00
Colin Ian King
cb14a0b4a1 Staging: comedi: fix spelling mistake "Firmare" -> "Firmware"
Trivial fix to spelling mistake in dev_dbg message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-01 17:45:50 +02:00
Ian Abbott
f0f4b0cc3a staging: comedi: ni_mio_common: fix AO inttrig backwards compatibility
Commit ebb657babf ("staging: comedi: ni_mio_common: clarify the
cmd->start_arg validation and use") introduced a backwards compatibility
issue in the use of asynchronous commands on the AO subdevice when
`start_src` is `TRIG_EXT`.  Valid values for `start_src` are `TRIG_INT`
(for internal, software trigger), and `TRIG_EXT` (for external trigger).
When set to `TRIG_EXT`.  In both cases, the driver relies on an
internal, software trigger to set things up (allowing the user
application to write sufficient samples to the data buffer before the
trigger), so it acts as a software "pre-trigger" in the `TRIG_EXT` case.
The software trigger is handled by `ni_ao_inttrig()`.

Prior to the above change, when `start_src` was `TRIG_INT`, `start_arg`
was required to be 0, and `ni_ao_inttrig()` checked that the software
trigger number was also 0.  After the above change, when `start_src` was
`TRIG_INT`, any value was allowed for `start_arg`, and `ni_ao_inttrig()`
checked that the software trigger number matched this `start_arg` value.
The backwards compatibility issue is that the internal trigger number
now has to match `start_arg` when `start_src` is `TRIG_EXT` when it
previously had to be 0.

Fix the backwards compatibility issue in `ni_ao_inttrig()` by always
allowing software trigger number 0 when `start_src` is something other
than `TRIG_INT`.

Thanks to Spencer Olson for reporting the issue.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reported-by: Spencer Olson <olsonse@umich.edu>
Fixes: ebb657babf ("staging: comedi: ni_mio_common: clarify the cmd->start_arg validation and use")
Cc: stable <stable@vger.kernel.org>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:07:19 +02:00
Dan Carpenter
5ac5c3bcf5 staging: comedi: dt2811: fix a precedence bug
Bitwise | has higher precedence than ?: so we need to add some
parenthesis for this to work as intended.

Fixes: 7c9574090d ('staging: comedi: dt2811: simplify A/D reference configuration')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:07:19 +02:00
Phil Turnbull
c71f20ee76 staging: comedi: adv_pci1760: Do not return EINVAL for CMDF_ROUND_DOWN.
The CMDF_ROUND_DOWN case falls through and so always returns -EINVAL.

Fixes: 14b93bb6bb ("staging: comedi: adv_pci_dio: separate out PCI-1760 support")
Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:07:19 +02:00
Ian Abbott
5ca05345c5 staging: comedi: ni_mio_common: fix wrong insn_write handler
For counter subdevices, the `s->insn_write` handler is being set to the
wrong function, `ni_tio_insn_read()`.  It should be
`ni_tio_insn_write()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reported-by: Éric Piel <piel@delmic.com>
Fixes: 10f74377ee ("staging: comedi: ni_tio: make ni_tio_winsn() a
  proper comedi (*insn_write)"
Cc: <stable@vger.kernel.org> # 3.17+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:07:19 +02:00
Ian Abbott
403fe7f34e staging: comedi: comedi_test: fix timer race conditions
Commit 73e0e4dfed ("staging: comedi: comedi_test: fix timer lock-up")
fixed a lock-up in the timer routine `waveform_ai_timer()` (which was
called `waveform_ai_interrupt()` at the time) caused by
commit 2405124744 ("staging: comedi: comedi_test: use
comedi_handle_events()").  However, it introduced a race condition that
can result in the timer routine misbehaving, such as accessing freed
memory or dereferencing a NULL pointer.

73e0... changed the timer routine to do nothing unless a
`WAVEFORM_AI_RUNNING` flag was set, and changed `waveform_ai_cancel()`
to clear the flag and replace a call to `del_timer_sync()` with a call
to `del_timer()`.  `waveform_ai_cancel()` may be called from the timer
routine itself (via `comedi_handle_events()`), or from `do_cancel()`.
(`do_cancel()` is called as a result of a file operation (usually a
`COMEDI_CANCEL` ioctl command, or a release), or during device removal.)
When called from `do_cancel()`, the call to `waveform_ai_cancel()` is
followed by a call to `do_become_nonbusy()`, which frees up stuff for
the current asynchronous command under the assumption that it is now
safe to do so.  The race condition occurs when the timer routine
`waveform_ai_timer()` checks the `WAVEFORM_AI_RUNNING` flag just before
it is cleared by `waveform_ai_cancel()`, and is still running during the
call to `do_become_nonbusy()`.  In particular, it can lead to a NULL
pointer dereference:

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffffc0c63add>] waveform_ai_timer+0x17d/0x290 [comedi_test]

That corresponds to this line in `waveform_ai_timer()`:

		unsigned int chanspec = cmd->chanlist[async->cur_chan];

but `do_become_nonbusy()` frees `cmd->chanlist` and sets it to `NULL`.

Fix the race by calling `del_timer_sync()` instead of `del_timer()` in
`waveform_ai_cancel()` when not in an interrupt context.  The only time
`waveform_ai_cancel()` is called in an interrupt context is when it is
called from the timer routine itself, via `comedi_handle_events()`.

There is no longer any need for the `WAVEFORM_AI_RUNNING` flag, so get
rid of it.

The bug was copied from the AI subdevice to the AO when support for
commands on the AO subdevice was added by commit 0cf55bbef2 ("staging:
comedi: comedi_test: implement commands on AO subdevice").  That
involves the timer routine `waveform_ao_timer()`, the comedi "cancel"
routine `waveform_ao_cancel()`, and the flag `WAVEFORM_AO_RUNNING`.  Fix
it in the same way as for the AI subdevice.

Fixes: 73e0e4dfed ("staging: comedi: comedi_test: fix timer lock-up")
Fixes: 0cf55bbef2 ("staging: comedi: comedi_test: implement commands
 on AO subdevice")
Reported-by: Éric Piel <piel@delmic.com>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 4.4+
Cc: Éric Piel <piel@delmic.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:07:19 +02:00
Ian Abbott
80e162ee9b staging: comedi: daqboard2000: bug fix board type matching code
`daqboard2000_find_boardinfo()` is supposed to check if the
DaqBoard/2000 series model is supported, based on the PCI subvendor and
subdevice ID.  The current code is wrong as it is comparing the PCI
device's subdevice ID to an expected, fixed value for the subvendor ID.
It should be comparing the PCI device's subvendor ID to this fixed
value.  Correct it.

Fixes: 7e8401b23e ("staging: comedi: daqboard2000: add back
subsystem_device check")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.7+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:07:19 +02:00
Ravishankar Karkala Mallikarjunayya
2061d41061 Staging: comedi: s626: fix line over 80 characters issue
This fixes up a line over 80 characters issues found by
the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:02:42 +02:00
Cheah Kok Cheong
62190d498c staging: comedi: drivers: replace le16_to_cpu() with usb_endpoint_maxp()
Use macro introduced in commit 939f325f4a
("usb: add usb_endpoint_maxp() macro")

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>
2016-08-21 17:02:42 +02:00
Nayeemahmed Badebade
49c9d6ad68 staging: comedi/drivers: Fixed sparse warnings
Fixed below sparse warnings in dt2811.c
 warning: symbol 'dt2811_clk_dividers' was not declared. Should it be static?
 warning: symbol 'dt2811_clk_multipliers' was not declared. Should it be static?

Signed-off-by: Nayeemahmed Badebade <itachi.opsrc@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:02:42 +02:00
H Hartley Sweeten
27fa082b33 staging: comedi: ni_at_a2150: fix block comments
Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines
WARNING: Block comments use a trailing */ on a separate line

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>
2016-08-21 17:01:10 +02:00
H Hartley Sweeten
8c0740cade staging: comedi: ni_pcidio: fix block comments
Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines
WARNING: Block comments use a trailing */ on a separate line

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>
2016-08-21 17:01:10 +02:00
H Hartley Sweeten
28e0721e33 staging: comedi: ni_atmio16d: fix block comments
Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

Move the configuration options comment into the comedi driver comment
block. That's were they typically are listed.

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>
2016-08-21 17:01:10 +02:00
H Hartley Sweeten
44a678b966 staging: comedi: ni_atmio: fix block comments
Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

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>
2016-08-21 17:01:10 +02:00
H Hartley Sweeten
26994fd520 staging: comedi: ni_daq_dio24: fix block comments
Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

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>
2016-08-21 17:01:10 +02:00
H Hartley Sweeten
a3310f385f staging: comedi: ni_mio_cs: fix block comments
Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

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>
2016-08-21 17:01:10 +02:00
H Hartley Sweeten
8b1bb11d63 staging: comedi: ni_pcimio: fix block comments
Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

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>
2016-08-21 17:01:10 +02:00
H Hartley Sweeten
15203e5a79 staging: comedi: ni_670x: fix block comment issues
Fix the checkpatch.pl issues:
WARNING: Block comments use * on subsequent lines

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>
2016-08-21 17:01:10 +02:00
H Hartley Sweeten
b4a7c742f4 staging: comedi: das08_cs: fix block comments
Fix the checkpatch.pl issue:
WARNING: Block comments use * on subsequent lines

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>
2016-08-21 17:01:10 +02:00
H Hartley Sweeten
741a9c1c3a staging: comedi: addi_apci_3501: add a comedi driver comment block
This comment block is used to automatically generate documentation in
Comedi and Comedilib.

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>
2016-08-21 17:00:31 +02:00
H Hartley Sweeten
a6672530f6 staging: comedi: addi_apci_3501: remove timer/counter subdevice support
This driver is for a simple 4/8 channel analog output board with 2 isolated
digital inputs and 2 isolated digital outputs. Support for these subdevices
is provided by the driver.

The boards also has a watchdog timer that can be used to reset the analog
outputs. It can also be used as a general purpose 12-bit timer when the
watchdog function is not necessary. The current support code for this
subdevice is broken. It does not follow the comedi API and requires some
out-of-tree patches in order to even work.

Remove the subdevice support. If a proper register map can be located for
this board we can add support back 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>
2016-08-21 17:00:31 +02:00
Ian Abbott
686869b451 staging: comedi: plx9080.h: rename some macros for consistency
Most of the macros in "plx9080.h" that define register values are
single-bits flags of the form `PLX_<REG>_<FLAG>`, or are constant,
multi-bit values of the form `PLX_<REG>_<FIELD>_<VAL>`, or are
non-constant, function-like macros of the form `PLX_<REG>_<FIELD>(x)`.
Some of the macros for constant, multi-bit values do not currently
fit the pattern, so rename them for consistency.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:00:31 +02:00
Ian Abbott
6ad124d53a staging: comedi: plx9080.h: define PLX_<REG>_TO_<FIELD>(r) macros
Various macros in "plx9080.h" take the form `PLX_<REG>_<FIELD>(x)`,
where `<REG>` is a register name, `<FIELD>` is a field within the
register, and `x` is a value for the field specified by the caller.  The
macros construct a partial register register with the specified field
value placed in the appropriate bits of the register value, and other
bits of the register value zeroed.  Add corresponding macros of the form
`PLX_<REG>_TO_<FIELD>(r)` that extract a field value from a specified
register values.  Remove macros of the form `PLX_<REG>_<FIELD>_SHIFT`
that specified the bit position of a field within a register value as
they are no longer useful.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 17:00:31 +02:00
Wolfram Sang
1a55f38d63 staging: comedi: drivers: usbduxfast: don't print error when allocating urb fails
kmalloc will print enough information in case of failure.

Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15 15:56:33 +02:00
Arnd Bergmann
70db384cd6 staging: comedi: avoid using timeval
Comedi uses 32-bit seconds for its timestamps, on both 32-bit and
64-bit machines. For all I can tell, this was originally meant as
a 'timespec', which would overflow in 2038 because of the use of
a signed 'long' on 32-bit machines, but it is now used as an
array of two unsigned 'lsampl_t' values in comedilib, which will
only overflow in 2106, on both 32-bit and 64-bit machines.

In an effort to get rid of all uses of 'struct timeval' in the kernel,
this replaces the internal code with a call to ktime_get_real_ts64()
and a comment at the location of the conversion.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:14:34 -07:00
Ravishankar Karkala Mallikarjunayya
533364c7c6 Staging: comedi: dt2817: Coding style issue fixed.
This fixes up a WARNING: 'Block comments use a trailing */ on a
separate line' found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:14:34 -07:00
Ravishankar Karkala Mallikarjunayya
62c701d794 Staging: comedi: dt2815: Comment issue fixed
This fixes up a WARNING: 'Block comments use a trailing */ on a
separate line' found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:14:31 -07:00
Ravishankar Karkala Mallikarjunayya
6adb21c275 Staging: comedi: dt2814: Block comment issue fixed
This fixes up a WARNING: 'Block comments use a trailing */ on a
separate line' found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:14:31 -07:00
Chris Cesare
c9b0f2b63f staging: comedi: serial2002: Fix unnecessary cast styling issue
checkpatch.pl warns that a cast of 1 to (long long) is unnecessary.
Remove the cast and also add code to check and make sure that
maxdata_list[chan] is not shifted too far, as suggested by Ian
Abbott.

Signed-off-by Chris Cesare <chris.cesare@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:14:16 -07:00
Chris Cesare
2e3d417c02 staging: comedi: serial2002: Fix bare unsigned styling issue
checkpatch.pl warns about a bare unsigned. Add type int to make
explicit and suit the coding style.

Signed-off-by Chris Cesare <chris.cesare@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:14:16 -07:00
Ravishankar Karkala Mallikarjunayya
deecca61b3 Staging: comedi: fix comment issue fixed for das800.c
This is a patch to the das800.c file that fixes up a
WARNING: 'Block comments use a trailing */ on a separate line'
found by the checkpatch.pl tool

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:13:29 -07:00
Ravishankar Karkala Mallikarjunayya
55cc6164ee Staging: comedi: Block comment issue fixed for das16.c
This is a patch to the das16.c file that fixes up a
WARNING: 'Block comments use a trailing */ on a separate line'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:13:29 -07:00
Ravishankar Karkala Mallikarjunayya
d855c3a41f Staging: comedi: fix blank line issue in das16.c
This is a patch to the das16.c file that fixes up a blank line after
function/struct/union/enum  check found by the checkpatch.pl tool

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:13:29 -07:00
Ravishankar Karkala Mallikarjunayya
d9b9c9a033 Staging: comedi: dmm32at: fix BIT macro issue.
This Replace all occurences of (1<<x) by BIT(x) and DMM32AT_CTRL_PAGE(x),
DMM32AT_AI_CFG_SCINT(x) macros to get rid of checkpatch.pl
"CHECK" output "Prefer using the BIT macro"

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:12:50 -07:00
Ravishankar Karkala Mallikarjunayya
5efe11599e Staging: comedi: Used unsigned int instead of unsigned issue in jr3_pci.c
This is a patch to the jr3_pci.c file that fixes up a
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:12:50 -07:00
Ravishankar Karkala Mallikarjunayya
2c81ab4304 Staging: comedi: fix BIT macro issue in das6402.c
This patch Replace all occurences of (1<<x) by BIT(x) and DAS6402_CTRL_TRIG(x),
DAS6402_MODE_RANGE(x), DAS6402_MODE_DMA(x) macros in the file das6402.c
to get rid of checkpatch.pl "CHECK" output "Prefer using the BIT macro"

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:12:47 -07:00
Ravishankar Karkala Mallikarjunayya
86c7815e97 Staging: comedi: Prefer using the BIT macro issue in das16.c
This patch Replace all occurences of (1<<x) by BIT(x) in the file das16.c
to get rid of checkpatch.pl "CHECK" output "Prefer using the BIT macro"

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:12:47 -07:00
Ravishankar Karkala Mallikarjunayya
fb999e7fab Staging: comedi: Fix comment issues in jr3_pci.c
This is a patch to the jr3_pci.c file that fixes up a
WARNING: 'Block comments use a trailing */ on a separate line'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:12:47 -07:00
Ravishankar Karkala Mallikarjunayya
e31eae7618 Staging: comedi:Fix a warning issues in me_daq.c
This is a patch to the me_daq.c file that fixes up a
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:12:47 -07:00
Ravishankar Karkala Mallikarjunayya
45de268819 Staging: comedi: Indentation issue in mpc624.c
This is a patch to the mpc624.c file that fixes up a
WARNING: 'Statements should start on a tabstop' found by
the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya <ravishankarkm32@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:12:47 -07:00
Colin Ian King
6f594b8203 staging: comedi: adl_pci9118: fix spelling mistake "acqusition" -> "acquisition"
trivial fix to spelling mistake

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 21:03:58 -07:00
H Hartley Sweeten
20cefae2d2 staging: comedi: addi_apci_1564: remove unnecessary wdog register defines
The watchdog subdevice is supported using the addi_watchdog module and
it uses the register defines from addi_tcw.h. The only register define
needed it the iobase offset to the register block.

Remove the unnecessary defines and rename the iobase define.

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>
2016-06-17 21:02:56 -07:00
H Hartley Sweeten
2ec19efbc8 staging: comedi: addi_apci_1564: rewrite the counter subdevice support
Like the timer, the support functions for the counter subdevice are broken.

Rewrite the code to follow the comedi API.

The new implementation is based on the (minimal) datasheet I have from
ADDI-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>
2016-06-17 21:02:56 -07:00
H Hartley Sweeten
05704ffafa staging: comedi: addi_apci_1564: rewrite the timer subdevice support
The support functions for the timer subdevice are broken.

1) The (*insn_write) assumes that insn->n is always 2 (data[1] is used)
2) The (*insn_read) assumes that insn->n is always 2 (data can be returned in
   data[0] and data[1]).
3) The (*insn_config) does not follow the API. It assumes insn->n is always 4
   (data[1], data[2] and data[3] are used). It also doesn't use data[0] to
   determine what the config "instruction" is.

Rewrite the code to follow the comedi API and add the missing comedi driver
comment block.

The new implementation is based on the (minimal) datasheet I have from
ADDI-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>
2016-06-17 21:02:56 -07:00
H Hartley Sweeten
a23b85a5ab staging: comedi: addi_apci_1564: use comedi_handle_event() for counters
The counter subdevice can generate an interrupt. Currently send_sig() is used
to let the task know when the interrupt occurs. Use the dev->read_subdev and
comedi_handle_events() instead.

Remove the, now unused, 'tsk_current' member from the private data and the
unnecessary include of <linux/sched.h>.

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>
2016-06-17 21:02:56 -07:00
H Hartley Sweeten
ff9842b651 staging: comedi: addi_apci_1564: use comedi_handle_event() for timer
The timer subdevice can generate an interrupt. Currently send_sig() is used
to let the task know when the interrupt occurs. Use the dev->read_subdev
and comedi_handle_events() 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>
2016-06-17 21:02:56 -07:00
H Hartley Sweeten
931987a0c6 staging: comedi: addi_apci_1564: clarify change-of-state interrupt support
This board supports change-of-state interrupts on digital inputs 4 to 19
not 0 to 15.

The current code "works" but it could set inappropriate bits in the mode1
and mode2 registers that setup which channels are enabled. It also doesn't
return the status of the upper 4 channels (19 to 16).

Fix the comment and mask the mode1/mode2 values so that only the interrupt
capable channels can be enabled.

Add the SDF_LSAMPL flag to the subdevice so that 32-bit samples are used
instead of 16-bit ones. This allows returning the upper 4 channels. Use
the remaining bits in the sample to return "event" flags to the user.

The timer and counter subdevices can also generate interrupts and are a bit
hacked. They don't currently follow the comedi API and they use send_sig()
to let the task that know that the interrupt occured. The "event" flags will
be used instead when these subdevices are fixed.

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>
2016-06-17 21:02:56 -07:00
Ian Abbott
52caeb4ad1 staging: comedi: plx9080.h: include headers for declarations
Add `#include` lines to declare stuff used by "plx9080.h" itself.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
6a64877f63 staging: comedi: plx9080.h: Add kerneldoc comments
Document the DMA descriptor `struct plx_dma_desc`, and the DMA abort
function `plx9080_abort_dma()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
457bec0f73 staging: comedi: plx9080.h: tidy up some comments
Use the usual block comment style and remove some excess spaces from
single-line comments.  Remove some obvious stuff about register offsets
being zero relative.  Remove some text about the original history of the
file, as it bears hardly any resemblance to it now.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
eb89333146 staging: comedi: drivers: add PLX PCI 9080 DMATHR register values
Add macros in "plx9080.h" that define values for the DMATHR register
values.  Use the prefix `PLX_DMATHR_` for the macros.  Make use of the
`BIT(x)` and `GENMASK(h,l)` macros to define the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
3dcf1b5596 staging: comedi: drivers: re-do PLX PCI 9080 DMACSRx register values
Replace the existing macros in "plx9080.h" that define values for the
DMACSR0 and DMACSR0 registers.  Use the prefix `PLX_DMACSR_` for the
macros.  Make use of the `BIT(x)` macro to define the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
dde90d89ae staging: comedi: drivers: re-do PLX PCI 9080 DMADPRx register values
Replace the existing macros in "plx9080.h" that define values for the
DMADPR0 and DMADPR1 registers.  (A little-endian version of the register
value is also placed in the `next` member of `struct plx_dma_desc`.)
Use the prefix `PLX_DMADPR_` for the macros.  Make use of the `BIT(x)`
and `GENMASK(h,l)` macros to define the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
65bf53de83 staging: comedi: drivers: re-do PLX PCI 9080 DMAMODEx register values
Replace the existing macros in "plx9080.h" that define values for the
DMAMODE0 and DMAMODE1 registers.  Use the prefix `PLX_DMAMODE_` for the
macros.  Make use of the `BIT(x)` and `GENMASK(h,l)` macros to define
the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
df04d3aa02 staging: comedi: plx9080.h: add hard-coded PCIHIDR register value
For the PLX PCI 9080, the read-only PCIHIDR register is hard-coded with
the value `0x908010b5`.  Add a macro `PLX_PCIHIDR_9080` that expands to
this value.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
a3228bc8b7 staging: comedi: drivers: re-do PLX PCI 9080 CNTRL register values
Replace the existing macros in "plx9080.h" that define values for the
CNTRL register.  Use the prefix `PLX_CNTRL_` for the macros.  Make use
of the `BIT(x)` and `GENMASK(h,l)` macros to define the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
9dc53852b1 staging: comedi: drivers: re-do PLX PCI 9080 INTCSR register values
Replace the existing macros in "plx9080.h" that define values for the
INTCSR register.  Use the prefix `PLX_INTCSR_` for the macros.  Make use
of the `BIT(x)` and `GENMASK(h,l)` macros to define the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
ed5df5db92 staging: comedi: drivers: re-do PLX PCI 9080 DMCFGA register values
Replace the existing macros in "plx9080.h" that define values for the
DMCFGA register.  Use the prefix `PLX_DMCFGA_` for the macros.  Make use
of the `BIT(x)` and `GENMASK(h,l)` macros to define the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
e0045472e0 staging: comedi: drivers: re-do PLX PCI 9080 DMPBAM register values
Replace the existing macros in "plx9080.h" that define values for the
DMPBAM register.  Use the prefix `PLX_DMPBAM_` for the macros.  Make use
of the `BIT(x)` and `GENMASK(h,l)` macros to define the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
1ddb95d3c4 staging: comedi: drivers: re-do PLX PCI 9080 LBRDx register values
Replace the existing macros in "plx9080.h" that define values for the
LBRD0 and LBRD1 registers.  Use the prefix `PLX_LBRD_` for macros that
apply to both registers, `PLX_LBRD0_` for macros that apply only to the
LBRD0 register, and `PLX_LBRD1_` for macros that apply only to the LBRD1
register.  Make use of the `BIT(x)` and `GENMASK(h,l)` macros to define
the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
a9c254a763 staging: comedi: drivers: re-do PLX PCI 9080 BIGEND register values
Replace `enum bigend_bits` in "plx9080.h" with a bunch of macros
defining values for the BIGEND register.  Use the prefix `PLX_BIGEND_`
for the macro names.  Make use of the `BIT(x)` and `GENMASK(h,l)` macros
to define the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
b5dcdceafa staging: comedi: drivers: re-do PLX PCI 9080 MARBR register values
Replace `enum marb_bits` in "plx9080.h" with a bunch of macros defining
values for the MARBR and DMAARB registers (which are the same
Mode/Arbitation register at two different offsets).  Use the prefix
`PLX_MARBR_` for the macros.  Make use of the `BIT(x)` and
`GENMASK(h,l)` macros to define the values.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
5eaa593dbf staging: comedi: drivers: re-do macros for PLX PCI 9080 LASxBA values
Replace the existing macros in "plx9080.h" that define values for the
LAS0BA and LAS1BA registers.  Use the prefix `PLX_LASBA_` for the
macros.  Make use of the `BIT(x)` and `GENMASK(h,l)` macros to define
the macros.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
be13e14e31 staging: comedi: drivers: re-do macros for PLX PCI 9080 LASxRR values
Rename the macros for the PLX PCI 9080 LAS0RR and LAS1RR registers in
"plx9080.h", using the prefix `PLX_LASRR_`.  Make use of the `BIT(x)`
and `GENMASK(h,l)` macros to define the values.

Define a macro `PLX_LASRR_PREFETCH` for the "prefetchable memory" bit in
this register, and define a macro `PLX_LASRR_MLOC_MASK` to mask the PCI
memory location control bits.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
c644a11aae staging: comedi: drivers: rename PLX PCI 9080 register offsets
Rename the macros in "plx9080.h" that define the offsets of registers,
following the pattern `PLX_REG_<NAME>`, where `<NAME>` is the register
name from the PLX PCI 9080 Data Book.

Add defines for the "Mailbox" registers, and add parameterized macros
for the mailbox registers and the DMA control registers.  Make use of
the parameterized versions of the macros where it seems appropriate.

The registers for supporting the I2O (Intelligent Input/Output) feature
are largely left undefined, just defining enough to allow the I2O
feature to be disabled.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
dc895b4287 staging: comedi: plx9080.h: remove Power-Up Test Suite stuff
The defines related to the Power-Up Test Suite (PUTS) are just cruft that
has nothing to do with the PLX PCI-9080 chip.  They seem to have been
inherited from "drivers/net/plx9060.h" in the kernel 2.2.16 sources for
use by the "wanxl" driver.  Remove them.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
66906590ca staging: comedi: plx9080.h: correct LRNG_IO_MASK and LMAP_IO_MASK
For the PLX local address space range registers, LAS0RR and LAS1RR, bit
0 indicates whether the local address space will be mapped to memory
space or I/O space.  If mapped to I/O space, bit 1 must be set to 0, and
bits 31 to 2 form the address decoding mask, which should be -2^N mod
2^32 for a range of length 2^N.

The `LRNG_IO_MASK` macro is supposed to specify the address decoding
bits for I/O space.  It currently has the value `0xfffffffa`, but should
be `0xfffffffc`, or possibly `0xfffffffe` (it doesn't really matter,
since bit 1 is required to be set to 0).  Change it to `0xfffffffc`.

Similarly, for the PLX local address space local base address (remap)
registers, LAS0BA and LAS1BA, bits 31 to 2, masked with the
corresponding "range" register form the local base address for the local
address space.  The `LMAP_IO_MASK` macro is supposed to mask the valid
bits for I/O space.  Change its value from `0xfffffffa` to `0xfffffffc`
to match `LRNG_IO_MASK`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-17 20:59:52 -07:00
Ian Abbott
cda2315000 staging: comedi: daqboard2000: prefer usleep_range()
The checkpatch.pl warns about two `udelay(x)` calls, one of 100
microseconds, and one of 10 microseconds.  The 100 microseconds one is
used when waiting for FPGA to become ready to accept firmware, and is
not that critical, so replace it with a call to `usleep_range(100,
1000)`.  The 10 microseconds one is called as each 16-bit word of
firmware data is written.  Replace it with a fairly tight
`usleep_range(10, 20)` to avoid slowing down firmware loading too much.
The firmware is fairly short, so this would only slow it down firmware
loading by about 20 milliseconds or so.

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>
2016-06-17 20:57:54 -07:00
Ian Abbott
0ef613473f staging: comedi: daqboard2000: rename CamelCase functions
Rename functions to avoid CamelCase warnings from checkpatch, and to use
namespace associated with the driver.

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>
2016-06-17 20:57:54 -07:00
Ian Abbott
2c7aab274d staging: comedi: daqboard2000: rename reference DACs register macros
Rename the macros that define values for the reference DACs register to
avoid CamelCase, and to make it clearer which register they are
associated with.  Add a macro `DB2K_REG_DACS_SET` for the value `0x0080`
that triggers setting one of the references.

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>
2016-06-17 20:57:54 -07:00
Ian Abbott
77b9634cbd staging: comedi: daqboard2000: rename trigger control register macros
Rename the macros that define values for the trigger control register to
avoid CamelCase, and to make it clearer which register they are
associated with.

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>
2016-06-17 20:57:54 -07:00