Commit graph

388159 commits

Author SHA1 Message Date
Fabio Estevam
55b31cf406 imx-drm: ipu-dp: Check the return value of devm_kzalloc()
devm_kzalloc() may fail, so let's check its return value.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-25 13:33:14 -07:00
Fabio Estevam
ea8d158320 imx-drm: imx-drm-core: Export imx_drm_encoder_get_mux_id
When building imx_v6_v7_defconfig with imx-drm drivers selected as modules, we
get the following build error:

ERROR: "imx_drm_encoder_get_mux_id" [drivers/staging/imx-drm/imx-ldb.ko] undefined!

Export the required function to avoid this problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-25 13:33:14 -07:00
Geert Uytterhoeven
bcc27c82ba staging: comedi: Add missing #include <linux/slab.h>
sparc64 allmodconfig:

drivers/staging/comedi/drivers/addi_apci_2032.c: In function 'apci2032_auto_attach':
drivers/staging/comedi/drivers/addi_apci_2032.c:328:3: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration]
drivers/staging/comedi/drivers/addi_apci_2032.c:328:11: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/staging/comedi/drivers/addi_apci_2032.c: In function 'apci2032_detach':
drivers/staging/comedi/drivers/addi_apci_2032.c:350:3: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]

drivers/staging/comedi/drivers/amplc_pci224.c: In function 'pci224_attach_common':
drivers/staging/comedi/drivers/amplc_pci224.c:1289:2: error: implicit declaration of function 'kmalloc' [-Werror=implicit-function-declaration]
drivers/staging/comedi/drivers/amplc_pci224.c:1289:23: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/staging/comedi/drivers/amplc_pci224.c:1296:24: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/staging/comedi/drivers/amplc_pci224.c:1303:25: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/staging/comedi/drivers/amplc_pci224.c:1348:42: warning: assignment makes pointer from integer without a cast [enabled by default]
drivers/staging/comedi/drivers/amplc_pci224.c: In function 'pci224_detach':
drivers/staging/comedi/drivers/amplc_pci224.c:1474:3: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration]

Introduced by commit 0bdab509bf ("staging:
comedi: use comedi_alloc_devpriv()"), which removed some inclusions of
<linux/slab.h>.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-25 13:26:50 -07:00
H Hartley Sweeten
c325f9a9ed staging: comedi: ii_pci20kc: cleanup final pieces
Tidy up the multi-line comments at the beginning of the file and
remove any irrelevant information.

Fix the II20K_ID_PCI200341M_1 define, there are one to many 0's.

Rename all the remaining pci20xxx_* to ii20k_*. The "pci" just adds
confusion, this is not a PCI board.

Remove the private (*detach) function. It's safe to call the comedi
core provided comedi_legacy_detach() even if there is nothing to
cleanup.

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>
2013-07-25 13:24:20 -07:00
H Hartley Sweeten
3aa5e81177 staging: comedi: ii_pci20kc: cleanup the ai subdevice
The PCI-200341M-1 module can both provide an analog input subdevice
in this driver. The module provides four differential input channels
with four programmable gains.

Currently the gain is configured as an option passed when the board
is attached. Rewrite the ai subdevice support functions to properly
handle the programmable gain.

For aesthetics, redefine the memory map for the module.

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>
2013-07-25 13:24:13 -07:00
H Hartley Sweeten
87a61614e3 staging: comedi: ii_pci20kc: cleanup the ao subdevice
The PCI-20006M-1 and PCI-20006M-2 modules can both provide an
analog output subdevice in this driver. Fix the module init code
to detect both of them.

The analog output can support +/-5, 0-10, or +/-10 volt ranges
depending on jumpers on the board. Report all the ranges to the
user instead of relying on the configuration options to set the
range. The user can then select the appropriate range depending
on how they have configured the hardware.

Tidy up the (*insn_{read,write})() functions to work 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>
2013-07-25 13:24:13 -07:00
H Hartley Sweeten
04815a4b5e staging: comedi: ii_pci20kc.c: break up the subdevice private data union
The union used for the subdevice private data just adds confusion.
Split the union into two separate private data structs.

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>
2013-07-25 13:24:13 -07:00
H Hartley Sweeten
57b2161f02 staging: comedi: ii_pci20kc.c: remove 'iobase' from the subdevice private data
The 'iobase' can be calculated when needed. Remove it from the
subdevice private 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>
2013-07-25 13:24:13 -07:00
H Hartley Sweeten
f0e32df3d2 staging: comedi: ii_pci20kc.c: tidy up the subdevice module init
Use the carrier board id to determine if a module is installed for
a given subdevice.

Consolidate the module init code into ii20k_init_module().

For aesthetic reasons, rename the subdevice functions to remove
'pci' from them.

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>
2013-07-25 13:24:12 -07:00
H Hartley Sweeten
9abeb196a7 staging: comedi: ii_pci20kc.c: cleanup the dio subdevice
For asethetics, redefine the register map for the carrier board.
The 'PCI*' names lead one to think this is a PCI board not a
legacy ISA board.

Remove the #if 0'd out pci20xxx_{do,di}() functions. They are not
needed.

Rename, and fix, the pci20xxx_dio_config() function. The control
and direction registers are not readable. Use the new register map
defines instead of the crazy bit shifts.

Rename, and fix, the pci20xxx_dio_insn_config() function. This
function should treat data[0] as the 'instruction' to handle not
just use it to determine if the port is an input or output.

Rename, and tix, the pci20xxx_dio_insn_bits() function. The 'state'
only needs to be updated if the 'mask' indicates.

For aesthetics, abosrb the pci20xxx_dio_init() into the (*attach)
function.

Fix the carrier board id detect in the (*attach). There are two carrier
board types, one with 32 dio channels and one without. Use this info
when setting up the dio subdevice.

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>
2013-07-25 13:24:12 -07:00
H Hartley Sweeten
6d305f8952 staging: comedi: ii_pci20kc: remove CHAN macro
This macro is not used, and it looks to much like the comedi CR_CHAN
macro. Just 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>
2013-07-25 13:24:12 -07:00
H Hartley Sweeten
3366244718 staging: comedi: ii_pci20kc: move comedi_lrange tables
For aesthetic reasons, move the static const data to the head of
the file.

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>
2013-07-25 13:24:12 -07:00
H Hartley Sweeten
842525c6c1 staging: comedi: ii_pci20kc: remove forward declarations 3
Move a couple functions to remove the need for the last forward
declarations.

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>
2013-07-25 13:24:12 -07:00
H Hartley Sweeten
63d6e8ff0d staging: comedi: ii_pci20kc: remove forward declarations 2
Move the pci20xxx_dio_*() functions to remove the need for some of
the forward declarations.

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>
2013-07-25 13:24:12 -07:00
H Hartley Sweeten
0f8409dc05 staging: comedi: ii_pci20kc: remove forward declarations 1
Move the pci20xxx_attach() and pci20xxx_detach() functions to remove
the need for some of the forward declarations.

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>
2013-07-25 13:24:11 -07:00
H Hartley Sweeten
2b00f54b24 staging: comedi: ii_pci20kc: use comedi_alloc_spriv()
For aesthetic reasons, use the helper function to allocate the
subdevice private data instead of hanging it on the device
private data. The core will free the memory during the detach.

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>
2013-07-25 13:24:11 -07:00
H Hartley Sweeten
4f2cfd6778 staging: comedi: addi_common.h: cleanup after removal of addi_apci_1710
Now that the addi_apci_1710 driver has been removed, get rid of all the
unnecessary stuff in addi_common.h.

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>
2013-07-25 13:22:51 -07:00
H Hartley Sweeten
3b4cb6717d staging: comedi: addi_apci_1710: delete driver
This driver is seriously broken and most of it does not "work" with
the comedi API. Just remove 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>
2013-07-25 13:21:11 -07:00
H Hartley Sweeten
c1f00be048 staging: comedi: addi_apci_1710: separate from addi_common.h
Move the necessary bits from addi_common.h to remove it's dependency
and make this driver standalone.

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>
2013-07-25 13:20:17 -07:00
H Hartley Sweeten
32d6d4e00b staging: comedi: addi_apci_1710: fix some compile errors/warnings
Fix a couple comments within comments errors.

Remove the #include of eddi_eeprom.c. This driver does not use it.

Remove an unused 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>
2013-07-25 13:20:17 -07:00
H Hartley Sweeten
a2ec3dd325 staging: comedi: adv_pci1724: remove ao_range_list_1724
All the AO channels have the same ranges. Remove the subdevice
s->range_table_list and just use the s->range_table to setup the
ranges.

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>
2013-07-25 13:20:17 -07:00
H Hartley Sweeten
065b091270 staging: comedi: range: tidy up comedi_check_chanlist()
The only difference in the if() and else if() check of the chanlist
is the source of the range table length. Consolidate the checks to
make the function a bit more concise.

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>
2013-07-25 13:20:17 -07:00
H Hartley Sweeten
eee7d9e9ef staging: comedi: usbdux: tidy up usbdux_ao_cancel()
Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

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>
2013-07-25 13:15:38 -07:00
H Hartley Sweeten
7c8ed94eb8 staging: comedi: usbdux: tidy up usbdux_ao_stop()
For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer. Rename the local variable used
for the private data pointer to the comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

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>
2013-07-25 13:15:37 -07:00
H Hartley Sweeten
aa6081e5e0 staging: comedi: usbdux: tidy up usbdux_ai_cancel()
Rename the local variable used for the private data pointer to the
comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

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>
2013-07-25 13:15:37 -07:00
H Hartley Sweeten
b3476e67c1 staging: comedi: usbdux: tidy up usbdux_ai_stop()
For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer. Rename the local variable used
for the private data pointer to the comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.

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>
2013-07-25 13:15:37 -07:00
H Hartley Sweeten
b8c162c961 staging: comedi: usbdux: make private data flags bit-fields
Change the flags in the private data to bit-fields to save a bit of
space.

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>
2013-07-25 13:15:37 -07:00
H Hartley Sweeten
903f4fde80 staging: comedi: usbdux: remove 'ifnum' from the private data
The 'ifnum' is only used during the attach of the device. Remove it
from the private 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>
2013-07-25 13:15:37 -07:00
H Hartley Sweeten
0b20d613af staging: comedi: usbdux: remove usb_device back pointer from private data
The usb_device can be found when needed using the comedi_to_usb_dev()
helper. Use that instead the remove the back pointer from the private
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>
2013-07-25 13:15:37 -07:00
H Hartley Sweeten
11642c658f staging: comedi: usbdux: pass comedi_device pointer to usbdux_alloc_usb_buffers()
For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer.

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>
2013-07-25 13:15:36 -07:00
H Hartley Sweeten
fb90856828 staging: comedi: usbdux: tidy up receive_dux_commands()
For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer. Rename the local variable used
for the private data pointer to the comedi "norm".

Add a local variable for the usb_device pointer to tidy up the
usb_bulk_msg() call.

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>
2013-07-25 13:15:36 -07:00
H Hartley Sweeten
49cc49dd9e staging: comedi: usbdux: tidy up send_dux_commands()
For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer. Rename the local variable used
for the private data pointer to the comedi "norm".

Add a local variable for the usb_device pointer to tidy up the
usb_bulk_msg() call.

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>
2013-07-25 13:15:36 -07:00
H Hartley Sweeten
5d293d904c staging: comedi: usbdux: remove 'interface' from private data
This back pointer is only used for a couple dev_printk() messages and
during the detach.

For the dev_printk() we can use the dev->class_dev. In the detach we
can get the usb_interface from the comedi_device.

Do that and remove the back pointer from the private 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>
2013-07-25 13:15:36 -07:00
H Hartley Sweeten
cc8cb3da9e staging: comedi: usbdux: remove 'comedidev' from private data
This back pointer is no longer needed 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>
2013-07-25 13:15:36 -07:00
H Hartley Sweeten
5a80fa0429 staging: comedi: usbdux: tidy up usbduxsub_submit_pwm_urbs()
Pass the comedi_device pointer (the urb context) to this function
instead of the private data pointer.

Use a local variable for the urb pointer that is setup and submitted.

Remove the sanity check of the private data. This function can only
get called if the allocation was successful during the attach.

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>
2013-07-25 13:15:36 -07:00
H Hartley Sweeten
6754698b6a staging: comedi: usbdux: tidy up usbduxsub_submit_outurbs()
Pass the comedi_device pointer (the urb context) to this function
instead of the private data pointer.

Use a local variable for the urb pointers that are setup and submitted.

Remove the sanity check of the private data. This function can only
get called if the allocation was successful during the attach.

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>
2013-07-25 13:15:35 -07:00
H Hartley Sweeten
865d9eedd1 staging: comedi: usbdux: tidy up usbduxsub_submit_inurbs()
Pass the comedi_device pointer (the urb context) to this function
instead of the private data pointer.

Use a local variable for the urb pointers that are setup and submitted.

Remove the sanity check of the private data. This function can only
get called if the allocation was successful during the attach.

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>
2013-07-25 13:15:30 -07:00
H Hartley Sweeten
91aa6b2193 staging: comedi: usbdux: remove dev_printk() noise
Most of these are just function trace noise. The rest report errors
that the user can't do anything about so they amount to added noise.

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>
2013-07-25 13:15:26 -07:00
H Hartley Sweeten
38691ec110 staging: comedi: usbdux: tidy up the comedi_lrange tables
Cleanup the whitespace in the tables.

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>
2013-07-25 13:15:26 -07:00
H Hartley Sweeten
e5acdc3561 staging: comedi: usbdux: remove the SUBDEV_* defines
These defines are only used to index the dev->subdevices array
during the attach. It's cleaner to just open-code the values.

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>
2013-07-25 13:15:26 -07:00
H Hartley Sweeten
c9f3363a30 staging: comedi: usbdux: tidy up usbduxsub_pwm_irq()
Rename the local variables to the comedi "norm".

Use dev->class_dev as the device for all dev_printk() messages.

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>
2013-07-25 13:15:26 -07:00
H Hartley Sweeten
e057288ffd staging: comedi: usbdux: tidy up usbduxsub_ao_isoc_irq()
Rename the local variables to the comedi "norm".

The comedi_subdevice in this function is actually the dev->write_subdev
that was initialized in the attach. Use that instead of accessing the
dev->subdevices array directly.

Use dev->class_dev as the device for all dev_printk() messages.

Instead of using the 'comedidev' back pointer in the private data, use
the comedi_device 'dev' that we already have.

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>
2013-07-25 13:15:26 -07:00
H Hartley Sweeten
0a9502f2c3 staging: comedi: usbdux: tidy up usbduxsub_ai_isoc_irq()
Rename the local variables to the comedi "norm".

The comedi_subdevice in this function is actually the dev->read_subdev
that was initialized in the attach. Use that instead of accessing the
dev->subdevices array directly.

Use dev->class_dev as the device for all dev_printk() messages.

Instead of using the 'comedidev' back pointer in the private data, use
the comedi_device 'dev' that we already have.

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>
2013-07-25 13:15:26 -07:00
H Hartley Sweeten
cc84f4f980 staging: comedi: usbdux: absorb usbdux_attach_common into caller
This function is only called by usbdux_auto_attach(), absorb it.

Also, there is no reason to down/up the semaphore during the attach.
None of the subdevices are functioning yet so there are no commands
being sent to the usb device.

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>
2013-07-25 13:15:25 -07:00
H Hartley Sweeten
72db740fd9 staging: comedi: usbdux: tidy up usbdux_attach_common()
Rename the local variable used for the device private data.

Move the setting of the device private data 'comedidev' to the
(*auto_attach) where the other back pointers are set.

Tidy up the subdevice init by removing the unnecessary comments
and adding some whitespace.

Remove the unnecessary dev_info() after a sucessful attach.

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>
2013-07-25 13:15:25 -07:00
H Hartley Sweeten
ee9c2dd35c staging: comedi: usbdux: remove NOISY_DUX_DEBUGBUG
This define enables printing of the 'dux_commands' that is sent to
the usb device in send_dux_commands(). This type of development
debug should not be left in the final 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>
2013-07-25 13:15:25 -07:00
H Hartley Sweeten
8ff14ee8a6 staging: comedi: usbdux: cleanup the (*detach)
The tidy_up() function is only called by the (*detach). That function
unlinks any running urbs and frees all the allocated urbs and buffers
used by the driver.

Rename tidy_up() to usbdux_free_usb_buffers() and move all the parts
that don't deal with the freeing of the buffers directly into the
(*detach).

Also, remove all the unnecessary clearing of the pointers. The comedi
core will kfree() the private data after calling the (*detach).

Foe aesthetic reasons, do the kfree()'ing of the buffers and urbs in
the reverse order that they were allocated.

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>
2013-07-25 13:15:25 -07:00
H Hartley Sweeten
29d0c07428 staging: comedi: usbdux: remove unnecessary tidy_up() calls
If the comedi_driver (*auto_attach) fails, the comedi core will call
the (*detach) function to do any cleanup. It's not necessary to do
the cleanup in the (*auto_attach).

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>
2013-07-25 13:15:25 -07:00
H Hartley Sweeten
ef1ee8cf12 staging: comedi: usbdux: push usb (*probe) into comedi (*auto_attach)
The usb_driver (*probe) calls comedi_usb_auto_config() after finding a
free slot for the static private data and doind some initial allocation
and setup. The comedi_usb_auto_config() will then call the comedi_driver
(*auto_attach).

Move all the probe/auto_attach into the comedi_driver and just have the
usb_driver call comedi_usb_auto_config(). This allows the comedi_driver
to allocate the private data and removes the need for the static array
and the semaphore that protects it.

Since all the probe/auto_attach is now handled by the comedi_driver, we
can also remove the 'attached' and 'probed' information from the private
data. The subdevice functions will only be hooked up if the usb device
has been probed and the comedi device is attached.

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>
2013-07-25 13:15:25 -07:00
H Hartley Sweeten
a7dd65f57c staging: comedi: usbdux: push usb (*disconnect) into comedi (*detach)
The usb_driver (*disconnect) calls comedi_usb_auto_unconfig() which will
call the comedi_driver (*detach). Just move all the disconnect/detach
into the comedi_driver and use comedi_usb_auto_unconfig() directly for
the (*disconnect).

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>
2013-07-25 13:15:24 -07:00