Commit graph

2710 commits

Author SHA1 Message Date
Yuanhan Liu
4ecd6228ac staging: comedi: jr3_pci: return 'result' from comedi_pci_enable instead of -EIO
Fix a smatch warning:
drivers/staging/comedi/drivers/jr3_pci.c:793 jr3_pci_auto_attach() info: why not propagate 'result' from comedi_pci_enable() instead of -5?

CC: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-13 11:16:01 -08:00
H Hartley Sweeten
346cf14a96 staging: comedi: addi_apci_1032: remove unnecessary include
The header amcc_s5933.h is not needed. Remove the include.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:58 +01:00
H Hartley Sweeten
39c2ec30c2 staging: comedi: addi_apci_1032: remove len_chanlist on di subdevice
This value is only needed for subdevices that support async commands.
The comedi core will default the value to 1 when it is not initialized.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:58 +01:00
H Hartley Sweeten
4cde0a6d51 staging: comedi: addi_apci_1032: hook-up the interrupt subdevice
The board supported by this driver can generate an interrupt based
on the state of input channels 0-15.

The apci1032_intr_insn_config() function is used to configure which
inputs are used to generate the interrupt. Currently this function
is broken since it does not follow the comedi API for insn_config
functions. Fix this function by implementing the, currently unused,
config instruction INSN_CONFIG_DIGITAL_TRIG.

Add the remaining subdevice operations necessary for the interrupt
subdevice to support async commands.

Fix the subdevice initialization so that if the interrupt is not
available the subdevice is set as COMEDI_SUBD_UNUSED.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:58 +01:00
H Hartley Sweeten
14696bbec4 staging: comedi: addi_apci_1032: remove send_sig() use
The addi-data drivers use send_sig() to let the user know when an
interrupt has occurred. The "standard" way to do this in the comedi
subsystem is to have a subdevice that supports asynchronous commands
and use comedi_event() to signal the user.

Remove the send_sig() usage in this driver. This also allows removing
the dev->private usage since tsk_Current was the only member still
being used in the private data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:58 +01:00
H Hartley Sweeten
6835a17a91 staging: comedi: addi_apci_1032: add a subdevice for the interrupt support
This board supports a single interrupt that can be generated by an AND/OR
combination of 16 of the input channels.

Create a separate subdevice, similar to the comedi_parport driver, to
handle this interrupt.

Move the i_APCI1032_ConfigDigitalInput() operation from the digital
input subdevice to this new subdevice. Rename the CamelCase function
to apci1032_intr_insn_config().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:57 +01:00
H Hartley Sweeten
6a3734af9a staging: comedi: addi_apci_1032: merge in hwdrv_apci1032.c
Merge the remaining code from hwdrv_apci1032.c into the driver and
delete the now unused file.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:57 +01:00
H Hartley Sweeten
12d606f754 staging: comedi: addi_apci_1032: cleanup v_ADDI_Interrupt()
There is no need for this function to call v_APCI1032_Interrupt()
in hwdrv_apci1032.c to reset the board. Just move the code from
v_APCI1032_Interrupt() directly into this function.

Rename the CamelCase function to apci1032_interrupt().

Rename the CamelCase local variable used to read/write the control
register.

Change the return from IRQ_RETVAL(1) to IRQ_HANDLED.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:57 +01:00
H Hartley Sweeten
b37f84d56a staging: comedi: addi_apci_1032: only allocate one subdevice
There is only one subdevice used in the driver. Remove the unused
subdevice init and only allcoate space for the one used.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:57 +01:00
H Hartley Sweeten
a3de4cd33c staging: comedi: addi_apci_1032: cleanup i_APCI1032_ReadMoreDigitalInput()
Move this function from hwdrv_apci1032.c.

Remove the unnecessary comment and rename the CamelCase function to
apci1032_di_insn_bits().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:57 +01:00
H Hartley Sweeten
b4c137506e staging: comedi: addi_apci_1032: remove i_APCI1032_Read1DigitalInput()
This function is the insn_read operation for the digital input subdevice.
This operation can be emulated by the comedi core now that the insn_bits
operation follows the comedi API. Remove this now unnecessary function.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:57 +01:00
H Hartley Sweeten
d6d7084855 staging: comedi: addi_apci_1032: fix i_APCI1032_ReadMoreDigitalInput()
This function is the insn_bits operation for the digital input subdevice.
According to the comedi API it's supposed return the status of the inputs
in data[1]. The addi-drivers abuse the API and try to make it conform to
their own use.

Fix this function so it follows the comedi API.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:57 +01:00
H Hartley Sweeten
274113fd78 staging: comedi: addi_apci_1032: cleanup i_APCI1032_Reset()
Move this function from hwdrv_apci1032.c.

Remove the unnecessary comment and rename the CamelCase function to
apci1032_reset().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:56 +01:00
H Hartley Sweeten
c0133ee10a staging: comedi: addi_apci_1032: cleanup the register map defines
For aesthetic reasons, rename the defines used for the register map
so they are a bit shorter.

Define, and use, the bits in the interrupt control register.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:56 +01:00
H Hartley Sweeten
ac467b5e21 staging: comedi: addi_apci_1032: remove the boardinfo
This driver supports only one boardtype. Since this driver uses the
comedi auto attach mechanism, the information left in the boaridnfo
is not required to attach this driver to the comedi subsystem.

Remove the boardinfo data and its use in the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:56 +01:00
H Hartley Sweeten
feae759ffe staging: comedi: addi_apci_1032: call v_APCI1032_Interrupt() directly
Remove the boardinfo about the 'interrupt' function and just call
it directly.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:56 +01:00
H Hartley Sweeten
b1b640a8d8 staging: comedi: addi_apci_1032: remove unnecessary eeprom code
Now that this driver is separate from the "common" addi-data code,
the eeprom does not contain any information required to make this
driver work.

Remove the unneeded initalization of the 's_EeParameters' and the
code that reads the eeprom to fill in the parameters.

Also, since reading the eeprom is not really interesting, remove
the EEPROM subdevice.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:56 +01:00
H Hartley Sweeten
cea5d88c34 staging: comedi: addi_apci_1032: remove i_IobaseReserved
PCI bar 3 is not used by this driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:56 +01:00
H Hartley Sweeten
427ee2be54 staging: comedi: addi_apci_1032: remove use of devpriv->iobase
Currently, devpriv->iobase is used to hold the PCI bar 2 base address
used to read/write the registers on the board. The same information
is stored in the comedi_device dev->iobase. Use that instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:56 +01:00
H Hartley Sweeten
e0085d1fc9 staging: comedi: addi_apci_1032: remove i_IorangeBase[01]
This boardinfo is no longer required by the driver. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:55 +01:00
H Hartley Sweeten
09284a77b2 staging: comedi: addi_apci_1032: remove dw_AiBase
This board does not use the ioremap'ed PCI bar 3 memory address.
Remove the ioremap and iounmap of that region.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:55 +01:00
H Hartley Sweeten
05f22ad7d2 staging: comedi: addi_apci_1032: simplify the PCI bar reading
This board has a 93c76 eeprom. Knowing this information allows
simplifying the code that reads the PCI bars to get the iobase
addresses used in the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:55 +01:00
H Hartley Sweeten
4c2c1488d3 staging: comedi: addi_apci_1032: board has 32 digital inputs
This board always has 32 digital inputs. Remove the test when
initializing the subdevice.

Also, since this board is the only one supported by this driver,
remove the boardinfo about the digital inputs and just use the
data directly in the subdevice init.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:55 +01:00
H Hartley Sweeten
9559ff7e7e staging: comedi: addi_apci_1032: board does not have analog outputs
This board does not have analog outputs. Remove the subdevice init for
them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:55 +01:00
H Hartley Sweeten
f2a3ac3b03 staging: comedi: addi_apci_1032: board does not have analog inputs
This board does not have analog inputs. Remove the subdevice init for
them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:55 +01:00
H Hartley Sweeten
5dbdbf67c3 staging: comedi: addi_apci_1032: board does not have digital outputs
This board does not have digital outputs. Remove the subdevice init for
them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:54 +01:00
H Hartley Sweeten
df9133bf19 staging: comedi: addi_apci_1032: board does not have a timer
This board does not have a timer. Remove the subdevice init for it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:54 +01:00
H Hartley Sweeten
166d15fd1e staging: comedi: addi_apci_1032: board does not have ttl i/o
This board does not have ttl i/o. Remove the subdevice init for
it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:54 +01:00
H Hartley Sweeten
a486baa6cf staging: comedi: addi_apci_1032: remove i_ADDI_Reset()
This driver is now separate from the "common" code used with the
addi-data drivers. There is no need to use i_ADDI_Reset() to call
the correct "reset" function.

Remove the i_ADDI_Reset() function and the 'reset' pointer to the
real function from the boardinfo and just call the function directly
where needed.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:54 +01:00
H Hartley Sweeten
2bb8b1dfe6 staging: comedi: addi_apci_1032: separate from addi_common.c
The addi_apci_1032 driver is a simple digital input board with 32
optically isolated inputs. 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 special handling for allocating and freeing the
dma buffers in the common code.

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>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:30:54 +01:00
Ian Abbott
11aade2650 staging: comedi: cb_pcidas64: update driver comment
Update the comedi driver comment to reflect the fact that manual
attachment of devices is no longer supported.  Also replace the request
to file a bug report about unidentified PCI device IDs with a request to
let the maintainers know about such devices.

Reformat the comment using the usual block comment style.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:28:59 +01:00
Ian Abbott
dd379fa23f staging: comedi: cb_pcidas64: fix forward declararions 4
Move `disable_plx_interrupts()`, `disable_ai_interrupts()`,
`enable_ai_interrupts()`, `set_ai_fifo_segment_length()`,
`set_ai_fifo_size()`, `ai_fifo_size()`, `load_ao_dma_buffer()`, and
`load_ao_dma()`, and remove forward declarations of these functions.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:28:59 +01:00
Ian Abbott
012e642c01 staging: comedi: cb_pcidas64: fix forward declarations 3
Move `abort_dma()`, `disable_ai_pacing()`, `i2c_high_udelay`,
`i2c_low_udelay`, `i2c_set_sda()`, `i2c_set_scl()`, `i2c_write_byte()`,
`i2c_read_ack()`, `i2c_start()`, `i2c_stop()`, `i2c_write()`,
`get_divisor()`, `check_adc_timing()`, `disable_ai_pacing()`,
`abort_dma()`, `get_ao_divisor()`, `ao_inttrig()`,
`caldac_8800_write()`, `caldac_i2c_write()`, `check_adc_timing()`,
`get_divisor()`, and `get_ao_divisor()`, and remove their forward
declarations.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:28:59 +01:00
Ian Abbott
a299d8817d staging: comedi: cb_pcidas64: fix forward declarations 2
Move `cb_pcidas64_find_pci_board()`, `auto_attach()` and `detach()` and
remove the forward declaration of `setup_subdevices()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:28:58 +01:00
Ian Abbott
9c7a00f572 staging: comedi: cb_pcidas64: fix forward declarations 1
Move `setup_subdevices()` and remove a load of forward declarations.
Added a forward declaration of `setup_subdevices()` temporarily.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:28:58 +01:00
Ian Abbott
b07244ceea staging: comedi: cb_pcidas64: remove board(dev) inline
The `board(dev)` inline function returns `dev->board_ptr` cast from
`const void *` to `struct pcidas64_board *`.  It really ought to return
a `const struct pcidas64_board *`.  Rather than fix the function, just
remove it and replace the calls with a local variable `thisboard` in the
functions that call it.  `thisboard` is set to the result of the common
inline function `comedi_board(dev)` defined in "comedidev.h".

Fix a little resulting fall-out from the inline function
`ai_dma_ring_count(board)` whose parameter should have been a const
pointer.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:28:58 +01:00
Ian Abbott
4dba6c02cd staging: comedi: comedidev.h: make comedi_board() parameter const
The inline function `comedi_board(dev)` merely returns `dev->board_ptr`.
It does not modify any members of `*dev` so make its parameter a const
pointer.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:28:58 +01:00
Ian Abbott
46ca84c465 staging: comedi: cb_pcidas64: whitespace/brace changes
Some whitespace changes, mostly to fix lines > 80 characters and
operator placement.  Add/remove some braces according to CodingStyle.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:28:58 +01:00
Ian Abbott
65998b1ba4 staging: comedi: cb_pcidas64: fix printks
Replace `printk` calls with something else.  For the `DEBUG_PRINT()`
macro, use `pr_debug()` (if `PCIDAS64_DEBUG macro defined) or
`no_printk()`.

Fix a few `DEBUG_PRINT()` calls due to compiler warnings and add
newlines where they are missing.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:28:58 +01:00
Ian Abbott
b91524ee48 staging: comedi: cb_pcidas64: use auto_attach method
This driver does not need to support manual attachment of supported PCI
devices.  Replace the `attach()` hook with an `auto_attach()` hook.
This will be called via `comedi_pci_auto_config()` at PCI probe time.

The `auto_attach()` calls new function `cb_pcidas64_find_pci_board()` to
find the correct entry in `pcidas64_boards[]` for the PCI device.

This driver no longer increments the PCI reference count during
attachment, so remove the call to `pci_dev_put()` when detaching the
device.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-06 09:28:57 +01:00
Ian Abbott
15358a7f77 staging: comedi: adl_pci9118: support auto-attachment
Support auto-attachment of supported PCI devices by adding the
`auto_attach()` hook (`pci9118_auto_attach()`) to the `struct
comedi_driver`.  This is called via `comedi_pci_auto_attach()` at PCI
probe time.

Previously, the driver's call to `comedi_pci_auto_config()` would fall
back to the old method of auto-attaching devices and would fail because
it couldn't find a board name matching the driver name.  The new method
doesn't care about that.

There are still a few problems.  All the boards supported by this driver
have the same PCI vendor and device ID, so it will just pick the first
supported board type, "pci9118dg".  (Other supported board types have
different AI ranges or different AI speeds, but are otherwise the same.)
Also, manual attachment of devices allows several optional features to
be configured, such as use of an external multiplexord, specified
sample&hold delays and options to ignore certain hardware errors.  These
will all be set to defaults for auto-attached devices.  A future version
of the driver may address these issues via configurable device
attributes.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-02 11:39:38 -07:00
Ian Abbott
00d9319475 staging: comedi: adl_pci9118: cards have same vendor ID
Don't bother recording the PCI vendor ID of each board in `boardtypes[]`
as they are all the same and the code doesn't use it anyway.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-02 11:39:38 -07:00
Ian Abbott
f3b81d5458 staging: comedi: adl_pci9118: split pci9118_attach()
Split most of the functionality of the attach routine `pci9118_attach()`
into a new function `pci9118_common_attach()` that can be called when
auto-attachment of devices is supported.  Move the enabling of the PCI
device and its i/o regions into this function.  Do the requesting of the
interrupt near the end of the function so it doesn't get enabled before
the device is ready.

Note that auto-attachment of PCI devices is currently broken in this
driver because the list of board names referred to by the `struct
comedi_driver` does not contain a "wildcard" entry matching the comedi
driver name.  This won't be a problem once support for the
`auto_attach()` method is added.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-02 11:39:37 -07:00
Ian Abbott
f41d2573b2 staging: comedi: adl_pci9118: replace printks
Replace or remove the `printk()` calls in this driver.  Call new function
`pci9118_report_attach()` to report successful attachment of the board.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-02 11:39:37 -07:00
YAMANE Toshiaki
bb29ea142d staging/comedi: Use dev_ printks in ni_tiocmd.c
fixed below checkpatch warnings.
- WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  to printk(KERN_ERR ...
- WARNING: Prefer netdev_info(netdev, ... then dev_info(dev, ... then pr_info(...  to printk(KERN_INFO ...
- WARNING: Prefer netdev_notice(netdev, ... then dev_notice(dev, ... then pr_notice(...  to printk(KERN_NOTICE ...

Signed-off-by: YAMANE Toshiaki <yamanetoshi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-02 11:36:03 -07:00
H Hartley Sweeten
60eebfad7a staging: comedi: addi_apci_3120: cleanup addi_find_boardinfo()
This driver uses the comedi PCI auto attach mechanism and the comedi
core does not use the boardinfo during the attach.

Now that this driver has the attach separated from addi_common.c we
can remove passing the boardinfo in the comedi_driver and cleanup
the code that finds the boardinfo.

Also, rename addi_find_boardinfo() 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>
2012-11-02 11:23:51 -07:00
H Hartley Sweeten
7dd2358156 staging: comedi: addi_apci_3120: remove COMEDI_SUBD_TTLIO define
This define is not used by the driver. 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>
2012-11-02 11:23:50 -07:00
H Hartley Sweeten
97641816b5 staging: comedi: addi_apci_3120: cleanup apci3120_detach()
This driver always tried to allocate the dma buffers so they need to
be free'd when the board is detached.

Remove the unneeded tests for the eeprom chip and bring the code
back an indent.

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>
2012-11-02 11:23:50 -07:00
H Hartley Sweeten
0bb482e25c staging: comedi: addi_apci_3120: clarify AO subdevice init
Only the apci3120 board supports an analog output subdevice. The
boardinfo indicates this by setting the 'i_NbrAoChannel' value.

The range table as well as the function used for the insn_write
operation are fixed for the analog outputs. Remove this information
from the boardinfo and use it directly in the subdevice init.

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>
2012-11-02 11:23:50 -07:00
H Hartley Sweeten
2e8fcd1820 staging: comedi: addi_apci_3120: remove 'b_AvailableConvertUnit'
This boardinfo value is not used by the driver. 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>
2012-11-02 11:23:50 -07:00