Move the remaining defines in this header to the c file. Nothing
in the header is needed by any other file.
While moving the defines, reorder them so that the bit defines
are associated with the register they go with. Also, convert the
bit defines to bit shifts to make them a bit clearer.
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>
Absorb the cnt_reset and cnt_config helper functions. They are
now both just single line routines.
Remove the printk noise about "Invalid instruction length".
Fix the return value, the value should be the number of data values
used to perform the instruction. The GPCT_RESET instruction only
has one parameter.
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: me4000: use the 8253 helper functions
The counter subdevice of this board is a standard 8254 compatible
counter/timer. Instead of open-coding the 8254 timer io, use the
helper functions provided by 8253.h.
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: me4000: fix the interrupt request/free
Only set the dev->irq when the request_irq is successful.
Use the dev->board_name for the name passed to request_irq.
Change the printk messages into dev_warn().
Make sure free_irq is called in 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>
staging: comedi: me4000: remove program_regbase from private data
The program_regbase variable in the private data is only used
when the board is first attached. This variable holds the pci
base address used to read/write the xilinx part to upload the
firmware.
Use a local variable in the xilinx_download() function to hold
this address and remove program_regbase 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>
Convert this PCI driver to use the comedi PCI auto config attach
mechanism by adding an 'attach_pci' callback function. Since the
driver does not require any external configuration options, and
the legacy 'attach' callback is now optional, 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>
Move the non pci probe related code out of the me4000_probe function
and back into the me4000_attach function in preparation of converting
this driver to the 'attach_pci' callback.
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 ao context is a struct containing all the register addresses
used with the ao subdevice. These can easily be calculated when
needed. Remove the me4000_ao_context struct, its initialization
function, and it's variable in the private data.
The last value written to the ao channels still needs to be saved
in the private data for readback.
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 ai context is a struct containing all the register addresses
used with the ai subdevice. These can easily be calculated when
needed. Remove the me4000_ai_context struct, its intialization
function, and it's variable 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>
The dio context is a struct containing all the register addresses
used with the dio subdevice. These can easily be calculated when
needed. Remove the me4000_dio_context struct, its intialization
function, and it's variable 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>
staging: comedi: me4000: use dev->iobase for the card base address
Use the iobase variable provided in the comedi_device for the
main base address used in the driver. Remove the me4000_regbase
variable 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>
staging: comedi: me4000: remove the noise when probing the card
The me4000_probe() function has a bunch of error messages that
are displayed when various parts of the probe fail. These are
just added noise. 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>
The me4000_cnt_contect simply holds the unsigned long i/o addresses
used to read/write the counter registers. Thes can be calculated
as needed. Remove the struct and the associated field 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>
The me4000_ao_info in the boardinfo struct is used to indicate
the number of analog output channels and a couple other details
about them. Remove the extra struct and absorb the data into the
boardinfo struct.
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 me4000_aio_info in the boardinfo struct is used to indicate
the number of analog input channels and a couple other details
about them. Remove the extra struct and absorb the data into the
boardinfo struct.
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 me4000_dio_info in the boardinfo struct is used to indicate
the number of 8 bit dio ports the the board has. Add a 'dio_nchan'
field to struct me4000_board and remove the struct me4000_dio_info.
The 'dio_nchan' value can then be used directly in the attach of
the board when setting the subdevice number of channels.
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 me4000_cnt_info in the boardinfo struct is used to indicate
that the board has an 8254 counter. Add a 'has_counter' field
to struct me4000_board and remove the struct me4000_cnt_info.
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>
Remove the terminating entry in the boardinfo so that ARRAY_SIZE
works correctly. Then remove ME4000_BOARD_VERSIONS and just use
ARRAY_SIZE in the 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>
staging/ipack: Fix bug introduced by IPack device matching
~0 can not be casted to u8. Instead of using the IPACK_ANY_ID for the format
field we introduce a new IPACK_ANY_FORMAT specifically for that field and
defined as 0xff.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jens Taprogge <jens.taprogge@taprogge.org> Acked-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
gcc complains about some potentially uninitalized variables here, yet it
can not happen, due to an enumerated type (either the board is one type
or the other.) Make the compiler happy by providing a default case
option that makes the logic a bit simpler for it to determine that there
really isn't a problem here.
Cc: H Hartley Sweeten <hartleys@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
USB autosuspend suspends vhci_hcd. In this process hcd_bus_suspend gets
executed which puts vhci_hcd in suspend state and calls vhci_hub_status.
vhci_hub_status function checks hub state and if it is in suspend state,
usb_hcd_resume_root_hub gets executed which resumes hub and if hub is
idle, again autosuspend puts it in suspend state and this goes on.
vhci_hub_status should resume hub only when hub port is in suspend state
and hub port status has changed.
staging: usbip: avoid deadlock in vhci_device_unlink_cleanup()
Almost all of usbip assumes that the_controller->lock is acquired
before vdev->priv_lock. The exception is in
vhci_device_unlink_cleanup(), where locks are acquired in the
reverse order. This leads to occasional deadlocks.
Fixing this is a bit fiddly, as the_controller->lock can't be held
when calling usb_hcd_unlink_urb_from_ep() in the middle of the list
traversal. As I can't rule out concurrent callers to this function
(perhaps it is safe?), the code here becomes slightly uglier - when
locks are dropped in the middle so the list may have emptied itself
(not even list_for_each_entry_safe is safe here).
Signed-off-by: Bernard Blackham <b-linuxgit@largestprime.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Thu, 6 Sep 2012 12:40:20 +0000 (15:40 +0300)]
staging: ramster: fix range checks in zcache_autocreate_pool()
If "pool_id" is negative then it leads to a read before the start of the
array. If "cli_id" is out of bounds then it leads to a NULL dereference
of "cli". GCC would have warned about that bug except that we
initialized the warning message away.
Also it's better to put the parameter names into the function
declaration in the .h file. It serves as a kind of documentation.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: me_daq: rename 'subdevice' variable to 's'
Rename the variable used for the comedi_subdevice pointer from
'subdevice' to 's'. This is more typical in other comedi drivers
and helps when searching with grep.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>