aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-11-28staging: comedi: ni_atmio: fix license warning.Matthew Giassa1-0/+5
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-13Merge tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/stagingLinus Torvalds7-28/+54
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-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman10-0/+10
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-10-18staging: comedi: adv_pci_dio: update for PCI-1761Anton Dozenko2-4/+26
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-18staging: comedi: dt282x: fix IRQ assignment for dev->irq.Arvind Yadav1-0/+2
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-18staging: comedi: s526: mark expected switch fall-throughGustavo A. R. Silva1-3/+2
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-18staging/comedi: Convert timers to use timer_setup()Kees Cook3-17/+22
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-09-22staging/comedi/das16: Make timer initialization unconditionalKees Cook1-6/+4
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-14Merge branch 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfsLinus Torvalds1-19/+5
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-04serial2002: switch serial2002_tty_write to kernel_{read/write}Christoph Hellwig1-19/+5
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-08-29staging: comedi: coding style fixes found by checkpatch.plSimo Koskinen1-2/+2
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-23Staging: comedi: comedi_fops: fix dev_err() warning styleBryan Garza1-1/+1
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-14Merge 4.13-rc5 into staging-nextGreg Kroah-Hartman1-0/+3
We need it here for iio fixes. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-30staging: comedi: comedi_fops: do not call blocking ops when !TASK_RUNNINGIan Abbott1-0/+3
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-30staging: comedi: ni_mio_common.c: fix coding style issueChristopher Mårtensson1-1/+2
"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-23Merge 4.13-rc2 into staging-nextGreg Kroah-Hartman1-2/+1
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-16staging: comedi: ni_mio_common: fix AO timer off-by-one regressionIan Abbott1-2/+1
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 080e6795cba3 ("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: 080e6795cba3 ("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-16staging: comedi: Use offset_in_page macroAmitoj Kaur Chawla1-1/+1
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-06-24staging: comedi: use centralized error clean-up in comedi_init()Ian Abbott1-21/+22
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-24staging: comedi: fix clean-up of comedi_class in comedi_init()Ian Abbott1-0/+1
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-13Staging: comedi: ni_labpc_regs: fixed a block comment alignment issueAmisha Singh1-1/+1
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-06staging: comedi: ni_labpc_isadma: fixed a comment coding style issueAdrian Stanciu1-1/+1
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-04Staging: comedi: s626.c: fixed trailing */ style issueedcarter1-3/+6
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-04-25staging: comedi: addi_apci_3xxx: check return valuePan Bian1-0/+2
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-25staging: comedi: support vm_access_process for mmap'd bufferIan Abbott3-0/+41
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-08staging: comedi: drivers: s626.c - fixed checkpatch issue about data typeAndrea della Porta1-1/+1
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-08staging: comedi: amplc_pci224: convert CLK_CONFIG() macro to functionIan Abbott1-4/+9
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-08staging: comedi: amplc_pci224: remove 'inline' from pci224_gat_config()Ian Abbott1-2/+1
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-08staging: comedi: amplc_pci230: convert CLK_CONFIG() macro to functionIan Abbott1-3/+6
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-08staging: comedi: amplc_pci230: remove 'inline' from pci230_gat_config()Ian Abbott1-2/+1
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-08staging: comedi: labpc: fix isadma dependencyArnd Bergmann1-1/+3
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-03-14staging: comedi: amplc_pci224: Convert macro GAT_CONFIG to static inline functionsimran singhal1-4/+8
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-14staging: comedi: Compress return logic into one line.Varsha Rao1-3/+1
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-12staging: comedi: jr3_pci: change module descriptionIan Abbott1-1/+1
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-12staging: comedi: jr3_pci: fix initial range[8] max valueIan Abbott1-1/+1
`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-12staging: comedi: jr3_pci: check PCI BAR 0 sizeIan Abbott1-0/+3
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-12staging: comedi: jr3_pci: check sizes at compile timeIan Abbott1-6/+1
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-12staging: comedi: jr3_pci: omit pointless debug infoIan Abbott1-7/+2
`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-12staging: comedi: jr3_pci: use struct jr3_block instead of jr3_tIan Abbott2-16/+12
`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-12staging: comedi: jr3_pci: separate out block typeIan Abbott1-8/+10
`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-12staging: comedi: jr3_pci: rename 'channel' to 'block'Ian Abbott2-6/+6
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-12staging: comedi: jr3_pci: rename data to sensorIan Abbott2-6/+6
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-12staging: comedi: jr3_pci: rename channel to sensorIan Abbott1-77/+75
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-12staging: comedi: jr3_pci: rename struct jr3_channel to jr3_sensorIan Abbott2-16/+16
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-09staging: comedi: Remove useless cast.Varsha Rao1-1/+1
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-09staging: comedi: ni_atmio: make device_ids constIan Abbott1-1/+1
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-09staging: comedi: allow it to be built-inIan Abbott1-1/+0
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-09Staging: comedi: comedi_fops: Change comedi_num_legacy_minors typeCheah Kok Cheong1-4/+3
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-07staging: comedi: Replace "is is" with "is"simran singhal1-1/+1
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-06Staging: comedi: drivers: comedi_test: Avoid multiple line dereferenceCheah Kok Cheong1-4/+4
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>