Ian Abbott [Wed, 14 Nov 2012 13:10:35 +0000 (13:10 +0000)]
staging: comedi: don't call attach_pci handler
All the Comedi drivers that call `comedi_pci_auto_config()` have
replaced the `attach_pci()` handler in their `struct comedi_driver` with
a `auto_attach()` handler, so there is no need to check for the
existence of the `attach_pci()` handler any more. Remove this check and
the code that calls it.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 14 Nov 2012 13:10:34 +0000 (13:10 +0000)]
staging: comedi: remove old auto-config
All the Comedi drivers that call `comedi_pci_auto_config()` or
`comedi_usb_auto_config()` define a `auto_attach()` handler in their
`struct comedi_driver`. There is no need to fall back to abusing the
`attach()` handler any more, so remove the code that supports that.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 14 Nov 2012 11:22:55 +0000 (11:22 +0000)]
staging: comedi: define operations for INSN_CONFIG_DIGITAL_TRIG
The 'addi_apci_1032' driver recently started supporting the
`INSN_CONFIG_DIGITAL_TRIG` configuration instruction, but as no other
drivers were using it before, there was no existing practice of how the
instruction should look.
Define the format to be something a bit more configurable. In
particular, a subdevice might have more than one trigger requiring an ID
and/or `COMEDI_EV_...` flags to disambiguate them, a trigger might have
more than 32 inputs, and a trigger might need several
`INSN_CONFIG_DIGITAL_TRIG` configuration instructions to configure
completely (if there are more than 32 inputs or if it uses a combination
of edge-triggered and level-triggered inputs).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 14 Nov 2012 11:22:57 +0000 (11:22 +0000)]
staging: comedi: check data length for INSN_CONFIG_DIGITAL_TRIG
The newly defined format for the `INSN_CONFIG_DIGITAL_TRIG`
configuration instruction expects 6 data values. Check the length in
`check_insn_config_length()` before calling the comedi subdevice's
`insn_config` handler.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Wed, 14 Nov 2012 11:22:56 +0000 (11:22 +0000)]
staging: comedi: addi_apci_1032: conform to new INSN_CONFIG_DIGITAL_TRIG
Conform to the new definition of the `INSN_CONFIG_DIGITAL_TRIG`
configuration instruction.
Return an error if the 'trigger number' in `data[1]` is non-zero or if
the configuration operation in `data[2]` is not supported. Deal with
the 'left-shift' amount in `data[3]`.
The trigger's input channels can only be configured as a set of rising
and falling edges ('OR' mode) or as a set of high and low levels ('AND'
mode). Preserve the old input channels to the right of the 'left-shift'
value except when switching modes.
(The 'left-shift' support is a bit of an overkill for this driver since
the trigger only has 16 input channels.)
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: comedi_fc.h: introduce new helpers for do_cmdtest step 3
Step 3 of the do_cmdtest functions validates the arguments for the
command to be executed. Most of these are simple tests to see if the
argument "is" a value, a "min" value, or a "max" value. Each of these
tests then clamps the argument to the value if it fails the test.
Introduce three new helper functions in comedi_fc.h to handle these
tests and remove the boilerplate code from the drivers.
The new helper functions are:
cfc_check_trigger_arg_is() - argument must be == the value
cfc_check_trigger_arg_min() - argument must be >= the value
cfc_check_trigger_arg_max() - argument must be <= the value
All of these helpers set the argument to the value and return -EINVAL
if the validation fails.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This function is used by the watchdog subdevice to "ping" the watchdog.
Rename the CamelCase function to apci1516_wdog_insn_write.
Currently this function does not follow the comed API. INSN_WRITE functions
are supposed to write insn->n values. Also, starting and stopping the
watchdog is handled by the INSN_CONFIG function.
Fix this function so it works like the comedi core expects. Also, since
the watchdog needs to be enabled in order to "ping" it, make sure it is
enabled before writing to it.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This function is used by the watchdog subdevice to enable/disable and
set the timeout for the watchdog. Rename the CamelCase function to
apci1516_wdog_insn_config.
Currently this function does not follow the comed API. Recode it so
it works like the core expects. data[0] is the configuration id code
(INSN_CONFIG_*) for the configuration instruction. Two instructions
are supported:
INSN_CONFIG_ARM: enables the watchdog and sets the timeout value
INSN_CONFIG_DISARM: disables the watchdog
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This function is used by the watchdog subdevice to read the status of
the watchdog. Rename the CamelCase function to apci1516_wdog_insn_read
and fix the function to return the status value insn->n times like
the comedi core expects.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This driver uses the comedi auto_config mechanism to attach to
the comedi subsystem. The dev->hw_dev is set by the core so
comedi_to_pci_dev() will always return a valid pcidev. Remove
the unnecessary test.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_1516: cleanup the s->subdev_flags
The flags SDF_GROUND and SDF_COMMON only have meaning for analog
input/output subdevices. Remove these flags from the digital
input/output and timer subdevices in this driver.
The digital output subdevice does not need the SDF_READABLE flags.
Remove it.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_1516: remove setting of s->len_chanlist
This value only has meaning for subdevices that support async commands.
Since this driver does not support async commands on any of its subdevices,
don't bother setting it . The comedi core will detect this and set the
value appropriately.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This driver uses the comedi auto_config mechanism to attach to the
PCI board.
This mechanism does not require passing the boardinfo data in the
comedi_driver. Remove it and modify the code to directly access
the boardinfo data instead of messing with the dev->driver->board_name
pointer.
All the boards supported by this driver have the same PCI vendor id.
Remove this extra info from the boardinfo and the test for it.
Rename the function so it has namespace associated with this driver.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_1516: remove use of struct addi_private
The only private data this driver has is the iobase address for the
watchdog. Create a local struct to hold this information in dev->private
and remove the need for struct addi_private from the "common" code.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_1516: remove use of devpriv->s_EeParameters
This driver no longer reads the eeprom to find the board specific data,
all the necessary data is in the boardinfo. Use the boardinfo directly
instead of passing through devpriv->s_EeParameters.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_1516: remove unnecessary info from boardinfo
The i_IorangeBase[012], i_PCIEeprom, and pc_EepromChip data in the
boardinfo was only needed to work out the usage of the PCI bars.
This is no longer needed so remove the data.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_1516: simplify the PCI bar reading
The boards supported by this driver have an eeprom attached to a S5920
PCI controller chip. Knowing this information allows simplifying the
code that reads the PCI bars to get the iobase address.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The same subdevice operations are used, as needed, for all the boards
supported by this driver. Remove the function pointers from the
boardinfo and set the subdevice operations directly in the attach.
Remove all the subdevice operations that would be set to NULL.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The same low-level reset function is used by all the boards supported
by this driver. Remove it from the boardinfo and absorb the function
from hwdrv_apci1516.c directly into the driver.
Rename the CamelCase function i_ADDI_Reset() to apci1516_reset().
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_1516: separate from addi_common.c
This driver is for simple 16 channel dio boards. Using the addi-data
"common" code introduces a lot of bloat.
Copy the code in addi_common.c to this driver and remove the #include
that caused addi_common.c to be compiled with this driver. This will
allow removing the bloat.
Rename the attach_pci and detach functions so they have namespace
associated with this driver.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_1516: add support for apci1016 board
The apci1016 board can also be supported by this driver. This board is
also a 16 channel dio board with 16 input channels. The apci1016 does
not have the watchdog timer feature of the apci1516 and apci2016.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: addi_apci_1516: merge in addi_apci_2016 driver
The low-level hardware support code for these drivers, hwdrv_apci1516.c
and hwdrv_apci2016.c, is identical. Both of these boards are 16 channel
dio boards. The 1516 board has 8 input/8 output channels and the 2016
has 16 output channels.
To ease maintainability, merge the boardinfo and pci device information
from the addi_apci_2016 driver into the addi_apci_1516 driver and modify
the Kconfig and Makefile appropriately.
This allows deleting the addi_apci_2016.c and hwdrv_apci2016.c files.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: vt6656: iwctl_giwaplist/device_ioctl : use off stack buffers.
Calls ioctl SIOCGIWAPLIST use off stack buffers.
clears up warning messages.
main_usb.c:2015:1: warning: the frame size of 1888 bytes is larger than 1024 bytes [-Wframe-larger-than=]
iwctl.c:683:1: warning: the frame size of 1280 bytes is larger than 1024 bytes [-Wframe-larger-than=]
Radhesh Fadnis [Tue, 13 Nov 2012 18:10:04 +0000 (14:10 -0400)]
staging: omap-thermal: fix context restore function
In the context restore function, if the context is lost or
not is being checked by the contents of the counter register.
But this is logic hold good as long as counter reset value is
zero, if the reset value is non-zero then above logic doesn't
hold good. Hence removed checking of the register value and
restoring the context.
Eduardo Valentin [Tue, 13 Nov 2012 18:10:02 +0000 (14:10 -0400)]
staging: omap-thermal: remove freq_clip table
The API exposed by cpu cooling does not need any freq clip
table anymore. Now the cpu cooling device is smart enough
to build its own table.
For this reason, this patch removes all the code that is
generating a freq clip table and also removes all references
in data structures regarding freq clip table.