Ian Abbott [Fri, 23 Oct 2015 09:56:09 +0000 (10:56 +0100)]
staging: comedi: fix extreme case of comedi_nsamples_left()
`comedi_nsamples_left(s, nsamples)` returns the number of samples
remaining to complete an asynchronous command or the passed in
`nsamples`, whichever is lower. However, it goes wrong in the extreme
case of setting the `nsamples` parameter to `UINT_MAX` when the number
of conversions per "scan" (`s->async->cmd.scan_end_arg`) is 1. It uses
`comedi_nscans_remaining(s, nscans)` to determine the number of scans
remaining, or the parameter `nscans`, whichever is lower. To determine
the parameter `nscans`, it divides `nsamples` by the number of
conversions per scan and adds 1. The addition of 1 is to avoid setting
the parameter `nscans` to 0, as `comedi_nscans_remaining(s, nscans)`
treats that value specially. However in the extreme case where
`nsamples` is `UINT_MAX` and the number of samples per scan is 1, the
addition of 1 to `nscans` overflows, producing the unwanted 0.
Fix it by refactoring new a function `__comedi_nscans_remaining(s,
nscans)` out of `comedi_nscans_remaining(s, nscans)`. The new function
does everything except the special handling when `nscans` is 0. Change
`comedi_nsamples_remaining()` to call the new function without adding 1
to `nscans` to avoid the overflow.
This overflow bug doesn't affect any of the current COMEDI drivers. I
stumbled across it while changing to one of the drivers.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shivani Bhardwaj [Mon, 26 Oct 2015 14:51:05 +0000 (20:21 +0530)]
Staging: wilc1000: coreconfigurator: Remove irrelevant wrapper function
Remove the function get_current_channel() and replace its calls by
get_current_channel_802_11n() as the former function's definition
involves only returning the value of latter function.
Semantic patch used to find out the issue:
Shivani Bhardwaj [Mon, 26 Oct 2015 14:46:32 +0000 (20:16 +0530)]
Staging: wilc1000: coreconfigurator: Drop unneeded wrapper functions
Replace the wrapper functions get_address1(), get_address2() and get_address3()
with the standard kernel function ether_addr_copy().
Semantic patch used to identify the issue:
Chaehyun Lim [Mon, 26 Oct 2015 00:44:43 +0000 (09:44 +0900)]
staging: wilc1000: fix parameter name of function declaration
This patch changes struct host_if_drv of host_int_set_WEPDefaultKeyID
function declaration from hWFIDrv to hif_drv in host_interface.h
With this change, first parameter name of this function declaration and
definition has same name as hif_drv.
Chaehyun Lim [Mon, 26 Oct 2015 00:44:42 +0000 (09:44 +0900)]
staging: wilc1000: fix return type of host_int_set_WEPDefaultKeyID
This patch changes return type of host_int_set_WEPDefaultKeyID from s32
to int. The result variable gets return value from wilc_mq_send that has
return type of int. It should be changed return type int as well as data
type of result variable.
Staging: mt29f_spinand: Prefer using the BIT macro
Replace all instances of bit shifting on 1 with the BIT(x) macro. In
addition, convert other non-1 shift operations with the equivalent
BIT(x) macro for uniformity. Issue pointed out by checkpatch.
CHECK: Prefer using the BIT macro
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Staging: mt29f_spinand: Replace udelay function with usleep_range
Use 'usleep_range' instead of 'udelay' to elapse time. For
spinand_reset, define the upper limit by a factor of 2 to keep the wait
short while still allowing a "good enough" range for wakeup. Define the
range 250us - 1ms for spinand_cmdfunc to provide enough leeway before
issuing spinand_reset. Checkpatch found this issue.
CHECK: usleep_range is preferred over udelay; see
Documentation/timers/timers-howto.txt
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use of the timer API function setup_timer instead of init_timer, removing
the structure field assignments, and make the codeflow more readable.
The simplified sematic patch used is :-
<smpl>
Use the timer API function setup_timer instead of init_timer, removing
the structure field assignments.
The simplified semantic patch used is :-
<smpl>
Dennis Menschel [Wed, 21 Oct 2015 21:16:56 +0000 (23:16 +0200)]
staging: fbtft: fix voltage settings for C-Berry28
This patch fixes some internal voltage settings for the C-Berry28 display.
The original example source files for the C-Berry28 as provided by
its vendor admatec contained six issues where a command parameter's value
didn't match its corresponding comment.
I've informed admatec about these discrepancies on 2015-08-25. In the
meantime, I've assumed the comments to be more reliable than the code,
and thus have used these values to write the initial C-Berry28 driver.
After having received a reply from admatec on 2015-10-16 that the issues
have been fixed in their example code, it has turned out that for the
voltages VCOM and AVDD, the code was indeed correct, but the comments
were wrong. This patch is meant to fix these two pending mistakes.
Signed-off-by: Dennis Menschel <menschel-d@posteo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dennis Menschel [Wed, 21 Oct 2015 21:16:55 +0000 (23:16 +0200)]
staging: fbtft: use init function instead of init sequence
This patch converts the default init sequence of the ST7789V
display controller into an init function, as init sequences
are considered deprecated by the maintainers of fbtft.
Signed-off-by: Dennis Menschel <menschel-d@posteo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dennis Menschel [Wed, 21 Oct 2015 21:16:54 +0000 (23:16 +0200)]
staging: fbtft: remove redundant set_addr_win() function
This patch removes the function set_addr_win() from fb_st7789v.c, as its
definition is redundant to the default implementation fbtft_set_addr_win()
which can be found in fbtft-core.c.
Signed-off-by: Dennis Menschel <menschel-d@posteo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dennis Menschel [Wed, 21 Oct 2015 21:16:53 +0000 (23:16 +0200)]
staging: fbtft: use MIPI DCS for ST7789V and C-Berry28
This patch makes use of the standard MIPI Display Command Set to remove
redundant entries from the command enum of the ST7789V display controller
and also some of the magic constants found in the init sequence of the
C-Berry28 display.
Signed-off-by: Dennis Menschel <menschel-d@posteo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Code is correct, i needs to be moved back by 2 to correct for the last
iteration of the while loop, since READ_NEXT_PAIR advances two. Fixing
the misleading indentation.
Fix a smatch warning:
drivers/staging/rtl8188eu/hal/rf_cfg.c:217
rtl88e_phy_config_rf_with_headerfile() warn: curly braces intended?
Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add support for DESC_PACKET_TYPE_INIT to rtl92e_send_cmd_pkt().
With this generalization, _rtl92e_fw_download_code() may be removed
after slight modification.
staging: rtl8192e: Use macro to represent fragmentation threshold
Add CMDPACKET_FRAG_SIZE macro and use it as fragmentation threshold
in send_cmd_pkt functions.
This makes rt_firmware::cmdpacket_frag_thresold and
rtl92e_init_fw_param() obsolete.
Deepa Dinamani [Thu, 22 Oct 2015 01:42:37 +0000 (18:42 -0700)]
staging: ft1000: remove obsolete driver
Remove support for Qleadtek Flash-OFDM modems. Telecom carrier is
discontinuing service for the radio technology.
See http://www.gtigroup.org/news/ind/2015-08-18/6996.html.
staging: comedi: adl_pci9118: tidy up pci9118_ai_setup_dma()
For aesthetics, init the dmalen[01] local variables when they are declared.
Use a local variable, 'scan_bytes', for the (devpriv->ai_n_realscanlen << 1)
calculation. For aesthetics and clarification, use comedi_bytes_per_sample()
instead of the '<< 1' shift to calculate the value.
The local variable 'i' is badly named. Remove it and use a local variable
'tmp' where it is used.
When checking the DMA buffer lengths for non-neverending commands the
scan length calculation, (devpriv->ai_n_realscanlen << 1) * cmd->stop_arg,
could overflow. Use and unsigned long long local variable to hold the
calculation and avoid the overflow.
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>
staging: comedi: adl_pci9118: tidy up check_channel_list()
Rename this function to give it namespace associated with the driver.
Currently this function is called by both the AI (*do_cmdtest) and the (*do_cmd)
functions. It really only needs to be called by the (*do_cmdtest) to validate
that the chanlist meets the requirements of the hardware. It's only called by
the (*do_cmd) to verify that the scan length is not to large after adding the
extra samples needed to satisfy the DMA.
Move the extra scan length check into the (*do_cmd) function and remove the
unnecessary parameters 'frontadd' and 'backadd'.
Tidy up the reset of the function.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: adl_pci9118: remove unnecessary check in check_channel_list()
Step 3 of the AI (*do_cmdtest) validates that the cmd->chanlist_len is >= 1. If
it's not the (*do_cmdtest) fails and check_channel_list() is never called. This
This function is also called by the AI (*do_cmd) and the comedi core ensures
that the async command has a valid chanlist. Remove the unnecessary 'n_chan'
check.
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>
This inline function just returns the bits needd to enable
a calibration source. For aethetics, absorb it into the callers.
Sorten the variable name in the private data used to hold the
current calibration source.
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>
The analog output and analog input interrupts are currently cleared
as they are handled. Refactor the code to gather all the bits needed
to clear the interrupts and do it once at the end of the interrupt
handler.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>