staging: comedi: das1800: tidy up das1800_ai_transfer_size()
For aesthetics, pass the fill time 'ns' as a parameter to this function.
Refactor this function to calculate the transfer size in 'samples' instead
of 'bytes'. This removes the need to constantly multiply the values by the
'sample_size'. It also helps avoid any possible integer overflow issues.
Use the comedi_nsamples_left() helper to limit the samples when cmd->stop_src
is TRIG_COUNT.
Use comedi_samples_to_bytes() to return the final DMA size in bytes.
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: das1800: remove hard coded 'sample_size'
Use the comedi_bytes_per_sample() helper to remove the hard coded sample_size
in suggest_transfer_size().
The helper function needs to comedi_subdevice pointer. Change the parameters
passed to suggest_transfer_size() and setup_dma() so that this pointer is
available. Rename these functions so they have namespace associated with the
driver.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: ni_labpc_isadma: move dma programming out of labpc_drain_dma()
The external caller of labpc_drain_dma() does not enable the DMA transfer. Only
the call from handle_isa_dma() results in the programmed DMA operation getting
enabled.
For aesthetics, move the dma programming to handle_isa_dma(). Make sure the
DMA operation would actually do something (dma->size != 0) before programming
it to avoid enabling the DMA at the end of a stop_src == TRIG_COUNT command.
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>
According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.
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>
According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.
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>
According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.
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>
According to Documentation/DMA-ISA-LPC.txt, the DMA lock needs to be
claimed before using any of the ISA DMA routines. Introduce a helper
function to disable the ISA DMA controller and add the necessary
locking calls.
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 DAS16 board is an ISA device not a PCI device. For aesthetics, use
dma_{alloc,free}_coherent() to allocate and free the DMA buffers instead
of the PCI versions.
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>
DMA is optional with this driver. Introduce a helper function to request
the DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid DMA channel or the channel cannot be
requested.
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 IRA and DMA are optional with this driver but both are required to
support async commands. Introduce a helper function to request the IRQ
and DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid IRQ or DMA channel or they cannot be
requested.
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>
DMA is optional with this driver. Introduce a helper function to request
the DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid DMA channel or the channel cannot be
requested.
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: pcl816: fix short DMA transactions
When the cmd->stop_src == TRIG_COUNT the last DMA transfer might be smaller
than the buffer size. This results in invalid data being added to the async
buffer.
Add a 'size' member to the DMA descriptor and initialize it with the
actual size of the DMA transfer. Use that in interrupt and ai subdevice
(*poll) function to return the proper number of samples. Use the
comedi_bytes_to_samples() helper to convert the byte size to comedi
samples in 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>
The IRA and DMA are optional with this driver but both are required to
support async commands. Introduce a helper function to request the IRQ
and DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid IRQ or DMA channel or they cannot be
requested.
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: pcl818: fix pcl818_handle_dma() for short DMA transaction
Currently this function always transfers the full DMA buffer to the comedi
async buffer. When the cmd->stop_src == TRIG_COUNT the last DMA transfer
might be smaller than the buffer size. This results in invalid data being
added to the asunc buffer.
Add a 'size' member to the DMA descriptor and initialize it with the
actual size of the DMA transfer. Use that in pcl818_handle_dma() to
return the proper number of samples. Use the comedi_bytes_to_samples()
helper to convert the byte size to comedi samples. Remove the unnecessary
'bufptr' local variable.
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>
DMA is optional with this driver. Introduce a helper function to request
the DMA channel and allocate the buffers. Don't fail the driver attach
if the user passed an invalid DMA channel or the channel cannot be
requested.
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 driver requires an IRQ and DMA in order to support async commands.
For aesthetics, introduce a helper function to request the IRQ and DMA
channels and allocate the DMA buffer. Since the async command support
is optional, make the helper function handle any request/allocation
errors and allow the driver to still attach without async command support.
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: das1800: separate AI FIFO bounce buffer from DMA buffer
This driver can use DMA or the hardware FIFO to read analog input samples.
When DMA is enabled it's also possible for some async commands to cause
DMA to be disabled and the FIFO is used instead.
Currently the first DMA channels buffer is used for the bounce buffer
when using the FIFO. For aesthetics, add a new member to the private
data and use that for the FIFO bounce buffer.
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: das1800: reduce indent level of das1800_init_dma()
An IRQ and at least one DMA channel are required to use DMA with this driver.
Move the check to the caller to reduce the indent level of this function.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jonathan Jin [Tue, 16 Dec 2014 03:28:23 +0000 (21:28 -0600)]
staging: rtl8192e: rejoin split quoted strings
Fix a checkpatch.pl warning regarding quoted string splits across lines.
While each join of these quoted strings results in a new checkpatch.pl
"lines over 80 characters" warning, the regained ability to grep for
these log strings in the codebase is, I would argue, well worth the
trade-off.
Signed-off-by: Jonathan Jin <jjin082693@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8723au: hal: odm.c: Remove some unused functions
Removes some functions that are not used anywhere:
odm_1R_CCA23a() odm_TXPowerTrackingCheckAP() odm_TXPowerTrackingCheckMP()
odm_RSSIMonitorCheck23aAP() odm_RSSIMonitorCheck23aMP() odm_RSSIMonitorInit()
odm_RefreshRateAdaptiveMask23aAPADSL23a() odm_RefreshRateAdaptiveMask23aMP23a()
This was partially found by using a static code analysis program called cppcheck.
This is a patch to the hal/rtl8723au_xmit.c file that fixes the
following warnings found by sparse tool:
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:88:22: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:88:22: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:88:22: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:91:22: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:91:22: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:91:22: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:99:22: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:99:22: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:99:22: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:103:30: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:103:30: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:103:30: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:106:38: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:106:38: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:106:38: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:108:38: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:108:38: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:108:38: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:112:38: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:112:38: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:112:38: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:120:22: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:120:22: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:120:22: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:123:30: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:123:30: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:123:30: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:125:30: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:125:30: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:125:30: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:129:30: warning: invalid assignment: |=
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:129:30: left side has type unsigned int
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:129:30: right side has type restricted __le32
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:184:51: warning: incorrect type in argument 2 (different base types)
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:184:51: expected unsigned int [usertype] *pdw
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:184:51: got restricted __le32 *<noident>
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:185:51: warning: incorrect type in argument 2 (different base types)
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:185:51: expected unsigned int [usertype] *pdw
drivers/staging/rtl8723au//hal/rtl8723au_xmit.c:185:51: got restricted __le32 *<noident>
Some struct fields in wifi.h are meant to be __le16 but were declared as
unsigned short. This was reported by sparse:
rtw_wlan_util.c:538:24: warning: cast to restricted __le16
rtw_wlan_util.c:1544:29: warning: cast to restricted __le16
rtw_wlan_util.c:1546:25: warning: cast to restricted __le16
This patch updates the types of the fields in `AC_param` and
`ADDBA_request` structs to be consistent with relevant structs in
include/linux/ieee80211.h.