staging: comedi: pcmuio: remove 'iobases' from subdevice private data
The 'asic' and 'port' associated with a given subdevice can easily be
found based on the subdevice 'index'. With that information we can
then calculate the correct iobase and register offset needed to read/
write the 8-bit ports.
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: pcmuio: simplify 'n_subdevs' and 's->n_chan'
The number of subdevices needed by the driver is based on the
'num_asics' reported by the boardinfo and each subdevice always
has 24 channels. Simplify the attach a bit.
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 member of the subdevice private data is always initialize to
'0' due to the 'thisasic_chanct' always being zero when it is set
during the attach. Simplify the driver a bit by removing it.
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 member of the subdevice private data is always initialize to
s->n_chan if the subdevice supports interrupts and is only used
in functions that can be called by the interrupt subdevice.
Simplyfy the driver a bit by removing it and just using s->n_chan.
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 member of the subdevice private data is always initialize to
'0' due to the 'byte_no' always being zero when it is set during
the attach. Simplify the driver a bit by removing it.
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>
All the I/O ports are left unlocked in the driver so the 'pagelock'
in the private data is not necessary. The paranoia sanity checks
are also unnecessary, Remove them.
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: have comedi_set_spriv() allocate the memory
As suggested by Ian Abbott, comedi_set_spriv() can only be used to
set the subdevice->private pointer to something that can be kfree()'d.
Rename the function to comedi_alloc_spriv() and have it kzalloc() the
memory as well as set the private pointer. This saves a function call
in the drivers and avoids the possibility of incorrectly calling
comedi_set_spriv() for some pointer that is not meant to be kfree()'d.
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>
None of the addi-data drivers that still use the "common" code have
ttl digital i/o. Remove the unnecessary boardinfo as well as the
subdevice initialization code.
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: addi-data: remove unused vars from boardinfo
Due to the on-going cleanup of the addi-data drivers, the boardinfo
used in the "common" code has a number of variables that are not
used. Remove the cruft.
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: addi-data: simplify the PCI bar reading
All of the remaining addi-data drivers that use the "common" code
either do not have an eeprom or the PCI controller chip is not a
PLX PCI 9054. Knowing this we can simplify the common code that
reads the PCI bars to get the iobase addresses.
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: addi-data: remove unused vars from private data
Due to the on-going cleanup of the addi-data drivers, the private
data used in the "common" code has a number of variables that
either are not used at all or or set but never used.
Remove all of them from the private data and the unnecessary use
in the drivers.
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>
Xenia Ragiadakou [Wed, 19 Jun 2013 01:58:07 +0000 (04:58 +0300)]
staging: rtl8192u: fix comments in r819xU_phy.c
This patch fixes the comments in r819xU_phy.c by:
- replacing "// ..." with "/* .... */"
- removing unnecessary comments, the dates and names of
developers from comments
- fixing some inconsistent comments
- fixing some typos
- fixing alignment issues
Xenia Ragiadakou [Wed, 19 Jun 2013 01:58:05 +0000 (04:58 +0300)]
staging: rtl8192u: remove variable 'Ret' in r819xU_phy.c
This patch removes variable 'Ret' from rtl8192_QueryBBReg()
since its value is returned immediately after it is
assigned. The name 'Ret', anyway, does not give any
insight and the function description comment is sufficiently
informative regarding the returned value.
Chad Williamson [Tue, 18 Jun 2013 03:32:05 +0000 (22:32 -0500)]
Staging: silicom: move more assignments out of if conditions
Remove more assignments from if-statement conditions in bpctl_mod.c,
resolving checkpatch.pl errors. Those that remain need more attention
than I'm presently prepared to give them.
Signed-off-by: Chad Williamson <chad@dahc.us> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Chad Williamson [Tue, 18 Jun 2013 03:32:04 +0000 (22:32 -0500)]
Staging: silicom: move assignments out of if conditions
Remove a bunch of assignments from if-statement conditions in
bpctl_mod.c, resolving checkpatch.pl errors. (This isn't all of
them, but the patch is getting rather long...)
Signed-off-by: Chad Williamson <chad@dahc.us> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Xenia Ragiadakou [Tue, 18 Jun 2013 02:29:41 +0000 (05:29 +0300)]
staging: rtl8192u: rename general variables in r819xU_phy.c
This patch renames the following variables:
- dwRegAddr and RegAddr into reg_addr
- dwData and Data into data
- BitShift into bitshift
- Offset into offset
- NewOffset into new_offset
- Bandwidth into bandwidth
The renaming was done to remove camel case and
unnecessary 'dw' prefix from the above variable names.
Xenia Ragiadakou [Tue, 18 Jun 2013 02:29:40 +0000 (05:29 +0300)]
staging: rtl8192u: rename *BitMask variables in r819xU_phy.c
This patch renames BitMask and dwBitMask variables into
bitmask to remove camel case.
dwBitMask in the given context can be renamed into simply
bitmask since its number of bits (dw->32) can be deduced
by its type which is u32.
Xenia Ragiadakou [Tue, 18 Jun 2013 02:29:39 +0000 (05:29 +0300)]
staging: rtl8192u: replace *Value variables in r819xU_phy.c
This patch renames the variables OriginalValue, NewValue,
Original_Value, New_Value and retValue to reg, and
the variables bRegValue and dwRegValue to reg_u8 and
reg_u32, respectively. This is done primarily in
order to reduce the variable name length and consequently
line length.
Also, it replaces the pair of Original and New variables
with one variable.
Markus Niebel [Tue, 18 Jun 2013 01:23:58 +0000 (09:23 +0800)]
staging: imx_drm: imx_ldb: fix 18 bit format
Since 18 bit is supported as datawidth in device tree it should be
supported in driver. Beside the LDB channel the IPU channel has also
to be configured to use BGR666.
Xenia Ragiadakou [Sat, 15 Jun 2013 04:29:02 +0000 (07:29 +0300)]
staging: rtl8192u: fix braces in r819xU_phy.c
This patch fixes the brace position and the whitespace
around braces.
That corrects the following checkpatch errors:
ERROR: that open brace { should be on the previous line
ERROR: else should follow close brace '}'
ERROR: space required after that close brace '}'
Also, it removes completely an if(0) statement,
instead of correcting its braces.
Xenia Ragiadakou [Sat, 15 Jun 2013 04:29:01 +0000 (07:29 +0300)]
staging: rtl8192u: fix bitshift calculation in r819xU_phy.c
This patch uses the ffs linux built-in routine in the
computation of the bitshift to take advantage of
architecture specific instructions that implement this
computation more efficiently.
Tobias Polzer [Thu, 13 Jun 2013 21:00:35 +0000 (23:00 +0200)]
staging: csr: Fix obvious logic error in staging/csr
In uf_process_ma_packet_req() (staging/csr/unifi_pdu_processing.c), the
test for
(staInfo->timSet != CSR_WIFI_TIM_RESET) || (staInfo->timSet !=
CSR_WIFI_TIM_RESETTING)
obviously makes no sense and causes GCC to emit a warning if
-Wlogical-op is enabled.
As suggested in the referenced bug report, || was replaced by &&.
References: https://bugzilla.kernel.org/show_bug.cgi?id=46571 Reported-By: David Binderman <dcb314@hotmail.com> Signed-off-by: Tobias Polzer <tobias.polzer@fau.de> Signed-off-by: Dominik Paulus <dominik.paulus@fau.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Lawniczak [Sun, 9 Jun 2013 21:11:30 +0000 (23:11 +0200)]
staging: keucr: removed unnecessary variables and comments
blen and bn were only used in commented code fragments.
since comments should be informative and not for storing old
code, both, commented code and variables, were removed.
Signed-off-by: Laura Lawniczak <laura.lawniczak@googlemail.com> Signed-off-by: Johannes Schilling <of82ecuq@cip.cs.fau.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_3xxx: only allocate needed subdevices
The number of subdevices needed by a given board supported by this
driver can cary from 2 (for the apci3500) to a maximum of 5. Currently
this driver always allocates 7 subdevices and sets the subdevice type
to COMEDI_SUBD_UNUSED for the ones that are not needed.
Calculate the actual number of needed subdevices from the boardinfo
and only allocate and setup the ones that are used.
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: addi_apci_3xxx: fix the analog input subdevice
The analog input subdevice support functions in hwdrv_apci3xxx.c
do not follow the comedi API.
The (*insn_config) function overrides the INSN_CONFIG_DIO_INPUT
instruction as an internal APCI3XXX_CONFIGURATION instruction. The
APCI3XXX_CONFIGURATION instruction requires 4 data parameters but
the comedi core sanity checks the INSN_CONFIG_DIO_INPUT instruction
which only has 1 data parameter. Because of this the (*insn_config)
function can never be called.
The (*insn_read) function is supposed to do "one-shot" or "software-
triggered" reads and return the data. The function in hwdrv_apci3xxx.c
does do this but it also is used to optionally start a "hardware-
triggered" conversion. Hardware-triggered conversions should be done
with the comedi_async command functions.
Delete the hwrdv_apci3xxx.c file and fix the analog input subdevice
in the driver by:
1) add a new (*insn_read) function for "one-shot" reads
2) implement the (*do_cmdtest) and (*do_cmd) functions for
"hardware-triggered" asyncronous reads
3) fix the interrupt handler to return the read data via the
comedi_async 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: addi_apci_3xxx: stub in analog input command support
The analog input subdevice in this driver is broken. The attach of
this driver requests the irq and sets the dev->read_subdev to the
analog input subdevice but it does not setup the subdevice to support
commands.
Stub in the command support functions so we can fix the subdevice.
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: addi_apci_3xxx: remove 'b_SingleDiff' private data
The analog reference desired for the acquisition is stored in the
insn->chanspec that is passed to the (*insn_read) function. There is
no need to use a private data variable to hold the desired analog
reference that is set in the (*insn_config).
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 number of differential analog input channels is always half the
number of single-ended channels, 'ai_n_chan', or all the channels
if the board does not support single-ended channels. We can use the
'ai_subdev_flags' boardinfo to determine if the board does not support
single-ended channels.
To simplify the boardinfo, remove the 'i_NbrAiChannelDiff' and just
use 'ai_n_chan' to specify the number of channels.
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: addi_apci_3xxx: properly set the analog input subdev_flags
Some of the boards supported by this driver only have differential
analog inputs. Add a new boardinfo, 'ai_subdev_flags', to allow
properly setting the subdev_flags for the analog input subdevice.
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: addi_apci_3xxx: remove 'i_AiChannelList' from the boardinfo
The analog input s->len_chanlist for the boards supported by this driver
should always be the number of channels (s->n_chan). Use that instead
and remove the 'i_AiChannelList' from the boardinfo.
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: addi_apci_3xxx: remove 'b_AiInitialisation' from private data
This variable is set during the attach of the board and never cleared
so the test in i_APCI3XXX_InsnReadAnalogInput() will always succeed.
Just remove the variable to help with cleaning up this 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: addi_apci_3xxx: refactor the ttl digital i/o support
Currently, the subdevice functions used to configure and read/write the
ttl digital i/o ports is way over to complicated. The (*insn_config)
function also abuses the comedi API by overriding the instruction
command passed in data[0].
Fix the ttl digital i/o support to work like the comedi core expects.
The (*insn_config) function supports the three instructions common for
COMEDI_SUBD_DIO subdevices:
INSN_CONFIG_DIO_INPUT - configure the specified channel as input
INSN_CONFIG_DIO_OUTPUT - configure the specified channel as output
INSN_CONFIG_DIO_QUERY - returns the status of the specified channel
Port 0 (channels 0-7) is always input
Port 1 (channels 8-15) is always output
Port 2 (channels 9-23) are programmable i/o (all channels are input or output)
The (*insn_bits) function allows writing to the output channels and returns
the state of all channels.
The (*insn_read) and (*insn_write) functions are not required. The comedi
core will emulate them using the (*insn_bits) 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>
The boards that have analog outputs always have 4 channels.
Remove the 'i_NbrAoChannel' data from the boardinfo and add a bit
field to indicate that the board 'has_ao'. Use that to conditionally
initialize the subdevice and open code the s->n_chan value of 4.
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 comedi core validates the insn->chanspec to make sure the channel
number and range are valid for the subdevice. The extra checks in this
function are not required.
(*insn_write) functions are supposed to write all the data passed
in the data pointer (insn->n values) then return the number of data
values written of an errno. Fix this function to work like the core
expects.
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: addi_apci_3xxx: tidy up the ttl digital i/o subdevice init
For aesthetic reasons, add some whitespace to the initialization of the
ttl digital i/o subdevices.
Fix the subdev_flags for the subdevice. The SDF_GROUND and SDF_COMMON
flags only apply to analog subdevices.
Fix the s->iobits for the subdevice. According to the datasheet:
Port 0 (channels 0-7) are always outputs
Port 1 (channels 8-15) are always inputs
Port 2 (channels 9-23) are programmable i/o (default to inputs)
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: addi_apci_3xxx: tidy up the digital in and out subdevice init
For aesthetic reasons, add some whitespace to the initialization of the
digital input and output subdevices.
Fix the subdev_flags for both subdevices. The SDF_GROUND and SDF_COMMON
flags only apply to analog subdevices. Digital output subdevices do not
need the SDF_READABLE flag set.
Remove the initialization of s->io_bits. It only has meaning for
COMEDI_SUBD_DIO subdevices.
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: addi_apci_3xxx: analog output 'maxdata' is always 12-bit
The boards that have analog outputs always have 12-bit resolution.
Remove the 'i_AoMaxdata' data from the boardinfo and open code the
s->maxdata. Use the hex value for the resolution since that is more
common in comedi drivers.
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 boards that have ttl input and output channels always have 24
channels.
Remove the 'i_NbrTTLChannel' data from the boardinfo and add a bit
field to indicate that the board 'has_ttl_io'. Use that to conditionally
initialize the subdevice and open code the s->n_chan value of 24.
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 boards that have digital input and output channels always have
4 inputs and 4 outputs.
Remove the 'i_NbrD[io]Channel' data from the boardinfo and add two
bit fields to indicate that the board 'has_dig_in' and 'has_dig_out'.
Use those to conditionally initialize the subdevices and open code
the s->n_chan value of 4 for both subdevices.
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 abuses the enum comedi_subdevice_type by redefining
enum 11 - COMEDI_SUBD_SERIAL as COMEDI_SUBD_TTLIO. The subdevice
that uses COMEDI_SUBD_TTLIO is a TTL Digital Input/Output subdevice.
Remove COMEDI_SUBD_TTLIO and just use COMEDI_SUBD_DIO as the
subdevice type.
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>