summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
2013-02-05staging: comedi: vmk80xx: cleanup digital input subdevice initH Hartley Sweeten
Change the type for the digital input 'di_chans' boardinfo to match the comedi_subdevice type it is set to. For aesthetic reasons, rename the variable also. Remove the SDF_GROUND flag from s->subdev_flags. This flag only has meaning for analog subdevices. Add the missing s->range_table for the subdevice. Rename the (*insn_read) and (*insn_bits) functions for the digital input subdevice to make grepping easier. For aesthetic reasons, add some whitespace to 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>
2013-02-05staging: comedi: vmk80xx: cleanup analog output subdevice initH Hartley Sweeten
Change the type for the analog output 'ao_chans' boardinfo to match the comedi_subdevice type it is set to. For aesthetic reasons, rename the variable also. Rename the (*insn_write) and (*insn_read) functions for the analog output subdevice to make grepping easier. For aesthetic reasons, add some whitespace to 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>
2013-02-05staging: comedi: vmk80xx: cleanup analog input subdevice initH Hartley Sweeten
Change the 'ai_bits' in the boardinfo to 'ai_maxdata' so that the calculation of s->maxdata can be removed. Change the types for the analog input boardinfo to match the comedi_subdevice types they are set to. Rename the (*insn_read) function for the analog input subdevice from vmk80xx_ai_rinsn to vmk80xx_ai_insn_read to make grepping easier. For aesthetic reasons, add some whitespace to 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>
2013-02-05staging: comedi: vmk80xx: remove need for boardinfo in private_dataH Hartley Sweeten
The only information in the boardinfo that is used outside of the attach of the driver is the 'model' of the device. Remove the 'board' pointer from the private data and replace it with the 'model' enum and just copy that information over 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-02-05staging: comedi: vmk80xx: push usb (*probe) into comedi (*auto_attach)H Hartley Sweeten
Make the usb_driver (*probe) simply call comedi_usb_auto_config() and move all the (*probe) code into the (*auto_attach) function. This allows getting rid of the static private data array since we no longer do part of the initialization in the (*probe) and then finish it in the (*auto_attach). We can simply kzalloc the private data instead. The comedi core will then handle the kfree of the data when the driver is detached. We can also get rid of the static 'glb_mutex' since this mutex was only used to protect the static private data array. Change the parameters for a couple of the helper functions used during the auto attach. Now that the comedi_device is available we can simply pass that pointer and get the specific pointers needed by the helper functions from 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-02-05staging: comedi: comedi_usb: allow comedi usb drivers to pass a 'context'H Hartley Sweeten
Allow the comedi usb drivers to pass a 'context' from their (*probe) functions to the comedi core's comedi_usb_auto_config(). This 'context' is then passed to comedi_auto_config() and then to the comedi_driver's (*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-02-05staging: comedi: vmk80xx: remove private data 'attached'H Hartley Sweeten
The 'attached' flag in the private data is set after the comedi_driver (*auto_attach) function has completed successfully. The only places it's checked are in rudimentary_check(), which does some basic sanity checks before doing any of the subdevice operations, and vmk80xx_auto_attach(), which is the comedi_driver (*auto_attach) function. The (*auto_attach) function can only be called as the result of a successfull usb_driver (*probe). Part of the probe is to locate a free slot in the static private data array. All free slots are initialized to '0' so the 'attached' flag will always be cleared. Remove the unneccessary 'attached' flag in 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-02-05staging: comedi: vmk80xx: remove private data 'probed'H Hartley Sweeten
The 'probed' variable is used in the usb driver (*probe) to detect an unused element in the static private data arry. This variable is then set after the usb driver has completed its (*probe) before calling comedi_usb_auto_config(). When the comedi core does the auto config it will call the (*auto_attach) function, vmk80xx_auto_attach(), which then locates the correct private data in the static array by checking to see if it has been 'probed' and that the 'intf' variable matches the usb_interface pointer for the usb device. Now that the private data is clean after failed usb probes and disconnects we don't have to worry about have a garbage 'intf' value in the private data that might match. Remove the 'probed' flag from the private data and just use the 'intf' pointer to detect the match. 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-02-05staging: comedi: vmk80xx: make sure private data is clean when detachedH Hartley Sweeten
Currently the private data used in this driver is stored in a static array. During the usb (*probe) and empty location is found in this array for use by the usb device. Some initialization of the private data is then done before comedi_usb_auto_config() is called to allow the comedi core to attach its comedi_device to the usb device. The (*probe) can fail for various reasons. If it does, make sure that the private data is clean before returning an error. The usb (*disconnect) simply calls comedi_usb_auto_unconfig() to allow the comedi core to disconnect its comedi_device from the usb device. Since the private data points to the static array it cannot be kfree'ed during the detach. Instead make sure it clean before leaving 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-02-05staging: comedi: vmk80xx: remove private data 'count'H Hartley Sweeten
The 'count' in the private data is only used in a couple dev_info() kernel messages. These messages are just added noise. Remove the 'count' variable in the private data as well as the dev_info() 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-02-05staging: comedi: vmk80xx: factor out usb buffer allocationH Hartley Sweeten
Factor the code that allocates the usb buffers out of vmk80xx_usb_probe(). 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-02-05staging: comedi: vmk80xx: factor out usb endpoint detectionH Hartley Sweeten
Factor the code that detects the usb endpoints out of vmk80xx_usb_probe(). Cleanup the detection code in the new function, 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-02-05staging: comedi: vmk80xx: consistently use the same local var namesH Hartley Sweeten
Rename some of the local variables used in this driver to make the code easier to maintain and understand. s/udev/usb the usb_device that the comedi_driver is attached to s/dev/devpriv the private data of the comedi_device s/cdev/dev the comedi_device Also, use some local variables in a couple of the functions to tidy up the code a bit. 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-02-05staging: comedi: vmk80xx: rename struct vmk80xx_usbH Hartley Sweeten
The struct vmk80xx_usb is actually the private data for the comedi_device. For aesthetic reasons, rename the struct to vmk80xx_private. 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-02-05staging: comedi: vmk80xx: remove VMK80XX_SUBD_* enumH Hartley Sweeten
These enum values are only used in the initialization of the comedi_subdevices. They don't help make the code any clearer so just remove 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-02-05staging: comedi: vmk80xx: remove common and unused boardinfoH Hartley Sweeten
Some of the information in the boardinfo is common for both boards supported by this driver. Remove that information from the boardinfo and just initialize the subdevice values directly. Also, remove any information in the boardinfo that is not used in the 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-02-05staging: comedi: vmk80xx: save the boardinfo in the comedi_deviceH Hartley Sweeten
Save a copy of the boardinfo pointer in the comedi_device 'board_ptr'. The subdevice functions can then simply get it using the comedi_board() helper. 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-02-05staging: comedi: vmk80xx: move boardinfo into a const arrayH Hartley Sweeten
The normal way of presenting the board specific information in comedi drivers is store the data in a static const array. This data is then accessed using a pointer, normally the comedi_device 'board_ptr', Move the boardinfo for the two boards supported by this driver from the vmk80xx_usb_probe() function into a static const array. Change the access of this information so a pointer is used. 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-02-05staging: comedi: vmk80xx: use comedi_auto_unconfig() for (*disconnect)H Hartley Sweeten
The usb_driver (*disconnect) in this driver is simply a wrapper around comedi_auto_unconfig(). Just use comedi_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-02-05staging: comedi: vmk80xx: move usb_driver (*disconnect) codeH Hartley Sweeten
The usb_driver (*disconnect) in this driver calls the comedi core comedi_usb_auto_unconfig() which calls the comedi_driver (*detach). Move the code in the (*disconnect) to the (*detach) to get all the disconnect/detach in one place. 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-02-05staging: comedi: vmk80xx: remove support for manual attachingH Hartley Sweeten
This comedi USB driver supports attaching with the auto config mechanism. Remove the manual attaching support using the COMEDI_DEVCONFIG ioctl. 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-02-05zram: get rid of lockdep warningMinchan Kim
Lockdep complains about recursive deadlock of zram->init_lock. [1] made it false positive because we can't request IO to zram before setting disksize. Anyway, we should shut lockdep up to avoid many reporting from user. [1] : zram: force disksize setting before using zram Acked-by: Jerome Marchand <jmarchan@redhat.com> Acked-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Minchan Kim <minchan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05zram: fix warning of print formatMinchan Kim
kbuild bot whinges due to print format mistmatch caused by zram: force disksize setting before using zram. This patch fixes it. Reported-by: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Minchan Kim <minchan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/vt6656: Fix sparse warning constant 0xffffffff00000000U is so big it ↵Peter Huewe
is unsigned long Since 7c65fa2a4c176c9bfab1ef954c4cef005dd9fb8b 'staging: vt6656: Remove QWORD from source and replace with u64.' a new sparse warning showed up: 'drivers/staging/vt6656/card.c:798:26: sparse: constant 0xffffffff00000000U is so big it is unsigned long' -> Append L to fix the warning. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Cc: Forest Bond <forest@alittletooquiet.net> Cc: Malcolm Priestley <tvboxspy@gmail.com> Cc: "Justin P. Mattock" <justinmattock@gmail.com> Cc: Marcos Paulo de Souza <marcos.souza.org@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove always false if statementPeter Huewe
MCLKData does not contain any 0x1C value for its field SR28 nor does XGI340_ECLKData contain any 0x1C or 0x22 value for its field SR2E. -> the statement always evaluates to false. -> remove Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unneeded conditional assignmentPeter Huewe
pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2 -> The conditional assignment is not needed here as it always evaluates to true. -> remove Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unused values in XGI340_ECLKDataPeter Huewe
In the lookup table XGI340_ECLKData only the first three 'lines' are used, thus the remaining entries can be removed. Rationale: - vb_init.c uses pVBInfo->ram_type as the index for XGI340_ECLKData. - pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2 -> only the first three values are used. -> remove the remeining entries. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unused entries in XGI340New_MCLKData and XGI27New_MCLKDataPeter Huewe
In the lookup tables XGI340New_MCLKData and XGI27New_MCLKData only the first three 'lines' are used, thus the remaining fields can be removed. Rationale: - vb_init.c uses pVBInfo->ram_type as the index for pVBInfo->MCLKData - pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2 - pVBInfo->MCLKData is assigned to either XGI340New_MCLKData or XGI27New_MCLKData in vb_setmode.c -> only the first three values are used, the rest can be removed. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unused values in XG27_SR13 and XGI340_SR13Peter Huewe
In the lookup tables XG27_SR13 and XGI340_SR13 only the first three values are used of each 'line', thus the remaining fields can be removed. Rationale: - vb_init.c uses pVBInfo->ram_type for the 'column' index for pVBInfo->SR15. - pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2 - pVBInfo->SR15 is assigned to either XG27_SR13 or XGI340_SR13 in vb_setmode.c -> only the first three values are used. This becomes also evident as values 3-7 are all 0. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unused values in XGI340_cr41 and XGI27_cr41Peter Huewe
In the lookup tables XGI340_cr41 and XGI27_cr41 only the first three values are used of each 'line', thus the remaining fields can be removed. Rationale: - vb_init.c uses pVBInfo->ram_type for the 'column' index for pVBInfo->CR40. - pVBInfo->ram_type is assigned the return value of XGINew_GetXG20DRAMType which can only be 0, 1 or 2 - pVBInfo->CR40 is assigned to either XGI340_cr41 or XGI27_cr41 in vb_setmode.c -> only the first three values are used. This becomes also evident as values 3-7 are all 0. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Remove unused variablePeter Huewe
After the patch 'staging/xgifb: Don't write the same values x times' the local variable i is unused, which leads to the following warning: driverrs/staging/xgifb/vb_init.c: In function ‘XGINew_SetDRAMDefaultRegister340’: drivers/staging/xgifb/vb_init.c:433:43: warning: unused variable ‘i’ [-Wunused-variable] This patch fixes this Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05Merge tag 'iio-for-3.9c' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: "Third set of IIO new drivers, cleanups and fixes for the 3.9 cycle New drivers 1) A driver for ST microelectronics sensors. This driver already covers a large set of new parts (20 gyros, accelerometer and magnetometers) not currently covered by the existing drivers. The intent moving forward is to merge this with the other drivers for similar parts already in tree. The lis3l02dq driver currently in staging/iio will be trivial, the lis3 driver in misc more complex as it has a number of additional interfaces. Any merging in of the lis3 driver will rely on the not currently merged iio_input bridge driver and handling of freefall notifications etc. 2) A driver for the itg3200 gyroscope. Graduations from staging 1) Cleanup and move out of staging of the adxrs450 gyroscope driver. The cleanup required was all minor but there were a couple of fixes hidden in there. Core and driver additions 1) Initial work from Guenter Roeck on device tree support for IIO's provider/ consumer code. Focuses on the iio_hwmon driver and the max1363 adc driver. The full device tree syntax is currently under discussion but should follow shortly. Cleanups and fixes 1) Remove a noop function __iio_update_buffer 2) Couple of small fixes and cleanups for the max1363 "
2013-02-05staging: comedi: check s->async for poll(), read() and write()Ian Abbott
Some low-level comedi drivers (incorrectly) point `dev->read_subdev` or `dev->write_subdev` to a subdevice that does not support asynchronous commands. Comedi's poll(), read() and write() file operation handlers assume these subdevices do support asynchronous commands. In particular, they assume `s->async` is valid (where `s` points to the read or write subdevice), which it won't be if it has been set incorrectly. This can lead to a NULL pointer dereference. Check `s->async` is non-NULL in `comedi_poll()`, `comedi_read()` and `comedi_write()` to avoid the bug. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging: comedi: remove 'comedi_autoconfig' module parameterH Hartley Sweeten
This module parameter is used to enable the auto config mechanism in the comedi core. Most of the PCI, PCMCIA, and USB drivers have been converted to use the auto config mechanism and will not attach if it is disabled. Since the 'comedi_autoconfig' parameter is defaulted to true, just remove it so that the comedi drivers that use auto config will always be able to 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-02-05staging: comedi: quatech_daqp_cs: factor out common ai scanlist codeH Hartley Sweeten
Factor the code that programs the analog input scanlist out of the daqp_ai_insn_read() and daqp_ai_cmd() functions. 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-02-05staging: comedi: quatech_daqp_cs: fix daqp_ao_insn_write()H Hartley Sweeten
The (*insn_write) functions are expected to write 'insn->n' number of samples to the channel. Fix this function so it works as 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-02-05staging: comedi: quatech_daqp_cs: use (*insn_bits) for digital outputsH Hartley Sweeten
Change the subdevice operation used to write the digital outputs from a (*insn_write) to a (*insn_bits) function. The (*insn_write) functions are expected to write 'insn->n' number of samples. The (*insn_bits) functions just write a single sample (insn->n = 1). Change the return from '1' to 'insn->n' to clarify what the return is. Using an (*insn_bits) function to write the digital outputs also allows the user to read the current state of the output channels. Fix the io operation used to update the digital outputs. The register is only 8-bits and should by updated with an outb() not an outw(). Also, set the 'maxdata' for the subdevice. For digital io this value should be '1' (digital io can only be 1 or 0). Remove the setting of the len_chanlist for the subdevice. This variable only has meaning for subdevices that support asynchronous commands. The comedi core will initialize it appropriately during the postconfig. 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-02-05staging: comedi: quatech_daqp_cs: use (*insn_bits) for digital inputsH Hartley Sweeten
Change the subdevice operation used to read the digital inputs from a (*insn_read) to a (*insn_bits) function. The (*insn_read) functions are expected to read 'insn->n' number of samples. The (*insn_bits) functions just read a single sample (insn->n = 1). Change the return from '1' to 'insn->n' to clarify what the return is. Also, set the 'maxdata' for the subdevice. For digital io this value should be '1' (digital io can only be 1 or 0). 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-02-05staging: comedi: quatech_daqp_cs: remove unused defineH Hartley Sweeten
The MAX_DEV define is no longer used in this 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-02-05staging: comedi: quatech_daqp_cs: rename the private data structH Hartley Sweeten
The private data in this driver is associated with the comedi_device pointer not the pcmcia_device. For aesthetic reasons, rename the private data struct from local_into_t to daqp_private. Also, rename the local variables used for the private data from local to devpriv as that is more common in the comedi drivers. 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-02-05staging: comedi: quatech_daqp_cs: store private data in the comedi_deviceH Hartley Sweeten
All the comedi_subdevices in this driver use the same 'local' private data. Instead of storing the pointer to the private data in each subdevice, just store it in the comedi_device. Also, instead of passing the private data pointer to pcmcia_request_irq() in link->priv, pass the comedi_device pointer. This allows removing the comedi_device and comedi_subdevice pointers from the private data. We can get them as needed from the void * in the interrupt function. Fix the pcmcia suspend/resume functions so they use the comedi_device pointer stored in link->priv to then get 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-02-05staging: comedi: quatech_daqp_cs: ao subdevice does not support commandsH Hartley Sweeten
The analog output subdevice does not support aynchronous commands. Don't set the dev->write_subdev to this 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-02-05staging: comedi: quatech_daqp_cs: use comedi_pcmcia_disable() for (*detach)H Hartley Sweeten
The (*detach) function, daqp_detach() is now a simple wrapper around comedi_pcmcia_disable(). Just use comedi_pcmcia_disable() directly for 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-02-05staging: comedi: quatech_daqp_cs: use comedi_pcmcia_{enable, disable}H Hartley Sweeten
Use the comedi_pcmcia_{enable,disable} helpers to enable/disable the PCMCIA 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-02-05staging: comedi: quatech_daqp_cs: convert to auto attachH Hartley Sweeten
Convert this pcmcia driver to the comedi auto attach mechanism. This allows getting rid of the static data that held "A list of "instances" of the device" that was used to pass the pcmcia_device pointer from the pcmcia_driver to the comedi_driver. Also, remove the now unused variables in the private data that were used to pass the pcmcia_device. Remove the code that pulled the model number of the card out of the PCMCIA CIS and stashed it in the private data since it is not used in the 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-02-05staging/xgifb: Consolidate if branches with similar conditionsPeter Huewe
1) The same condition (pVBInfo->IF_DEF_LVDS == 0) was checked in the if clause directly in front of this one. 2) The same condition pVBInfo->VBType & (VB_SIS301B | VB_SIS302B | VB_SIS301LV | VB_SIS302LV | VB_XGI301C) was checked in the if clause directly in front of this one. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Consolidate if/else for 'identical' branchesPeter Huewe
Since XGI_LCDDesStruct is fully contained in XGI330_LCDDataDesStruct2 and the offsets for the first members is identical we can consolidate the if/else branches here and use XGI330_LCDDataDesStruct2 for everything. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Don't write the same values x timesPeter Huewe
With the previous patch 'Move duplicated code for dram to helper function' it becomes evident that the code is performing the same thing 4 or 8 times in a row without changing arguments to the function and thus writing the same values over and over again. It was tested that these repeats are unnecessary. -> we can safely remove them. Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Move duplicated code for dram to helper functionPeter Huewe
XGINew_SetDRAMDefaultRegister340 uses the same code fragment 4 times with only a slight variation each time. -> Move this code to a helper function - this saves some lines and ~450bytes in the .o / .ko Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-05staging/xgifb: Replace XGI340_CR6B table with simple if/elsePeter Huewe
The XGI340_CR6B lookup table consists of the entries {0xaa, 0xaa, 0xaa, 0xaa} for an index <= 2 and {0x00, 0x00, 0x00, 0x00} for all other indices. The only user XGINew_SetDRAMDefaultRegister340 loops over these 4 values of a line with a for loop and since all entries are the same for each line we can simply replace the whole lookup table with a simple if/else assignment. Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>