firefly-linux-kernel-4.4.55.git
11 years agozram: force disksize setting before using zram
Minchan Kim [Wed, 30 Jan 2013 02:41:40 +0000 (11:41 +0900)]
zram: force disksize setting before using zram

Now zram document syas "set disksize is optional"
but partly it's wrong. When you try to use zram firstly after
booting, you must set disksize, otherwise zram can't work because
zram gendisk's size is 0. But once you do it, you can use zram freely
after reset because reset doesn't reset to zero paradoxically.
So in this time, disksize setting is optional.:(
It's inconsitent for user behavior and not straightforward.

This patch forces always setting disksize firstly before using zram.
Yes. It changes current behavior so someone could complain when
he upgrades zram. Apparently it could be a problem if zram is mainline
but it still lives in staging so behavior could be changed for right
way to go. Let them excuse.

Acked-by: Jerome Marchand <jmarchand@redhat.com>
Acked-by: Nitin Gupta <ngupta@vflare.org>
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agozram: Fix deadlock bug in partial read/write
Minchan Kim [Wed, 30 Jan 2013 02:41:39 +0000 (11:41 +0900)]
zram: Fix deadlock bug in partial read/write

Now zram allocates new page with GFP_KERNEL in zram I/O path
if IO is partial. Unfortunately, It may cause deadlock with
reclaim path like below.

write_page from fs
fs_lock
allocation(GFP_KERNEL)
reclaim
pageout
write_page from fs
fs_lock <-- deadlock

This patch fixes it by using GFP_NOIO.  In read path, we
reorganize code flow so that kmap_atomic is called after the
GFP_NOIO allocation.

Cc: stable@vger.kernel.org
Acked-by: Jerome Marchand <jmarchand@redhat.com>
Acked-by: Nitin Gupta <ngupta@vflare.org>
[ penberg@kernel.org: don't use GFP_ATOMIC ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agopci_ids.h: add common pci vendor ids from comedi subsystem
H Hartley Sweeten [Thu, 31 Jan 2013 21:42:16 +0000 (14:42 -0700)]
pci_ids.h: add common pci vendor ids from comedi subsystem

There are a number of pci vendor ids that are used in multiple
drivers in the comedi subsystem. Move these ids to pci_ids.h.

This also fixes some build warnings reported by the kbuild test
robot about PCI_VENDOR_ID_AMPLICON being undeclared.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: correct differential channel sequence for AI commands
Ian Abbott [Fri, 1 Feb 2013 14:51:58 +0000 (14:51 +0000)]
staging: comedi: ni_labpc: correct differential channel sequence for AI commands

Tuomas <tvainikk _at_ gmail _dot_ com> reported problems getting
meaningful output from a Lab-PC+ in differential mode for AI cmds, but
AI insn reads gave correct readings.  He tracked it down to two
problems, one of which is addressed by this patch.

It seems the setting of the channel bits for particular scanning modes
was incorrect for differential mode.  (Only half the number of channels
are available in differential mode; comedi refers to them as channels 0,
1, 2 and 3, but the hardware documentation refers to them as channels 0,
2, 4 and 6.)  In differential mode, the setting of the channel enable
bits in the command1 register should depend on whether the scan enable
bit is set.  Effectively, we need to double the comedi channel number
when the scan enable bit is not set in differential mode.  The scan
enable bit gets set when the AI scan mode is `MODE_MULT_CHAN_UP` or
`MODE_MULT_CHAN_DOWN`, and gets cleared when the AI scan mode is
`MODE_SINGLE_CHAN` or `MODE_SINGLE_CHAN_INTERVAL`.  The existing test
for whether the comedi channel number needs to be doubled in
differential mode is incorrect in `labpc_ai_cmd()`.  This patch corrects
the test.

Thanks to Tuomas for suggesting the fix.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.7.x, 3.8.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc: set up command4 register *after* command3
Ian Abbott [Fri, 1 Feb 2013 14:51:57 +0000 (14:51 +0000)]
staging: comedi: ni_labpc: set up command4 register *after* command3

Tuomas <tvainikk _at_ gmail _dot_ com> reported problems getting
meaningful output from a Lab-PC+ in differential mode for AI cmds, but
AI insn reads gave correct readings.  He tracked it down to two
problems, one of which is addressed by this patch.

It seems that writing to the command3 register after writing to the
command4 register in `labpc_ai_cmd()` messes up the differential
reference bit setting in the command4 register.  Set up the command4
register after the command3 register (as in `labpc_ai_rinsn()`) to avoid
the problem.

Thanks to Tuomas for suggesting the fix.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org> # 3.7.x, 3.8.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: restrict comedi_set_hw_dev() usage
Ian Abbott [Fri, 1 Feb 2013 13:23:20 +0000 (13:23 +0000)]
staging: comedi: restrict comedi_set_hw_dev() usage

Don't allow comedi drivers to change `dev->hw_dev` using
`comedi_set_hw_dev()` if it's already been set.  Return `-EEXIST` in
that case.

`dev->hw_dev` needs to be set to NULL by the core during clean-up of the
comedi device, so add a local function `comedi_clear_hw_dev()` to do
that.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: export comedi_set_hw_dev()
Ian Abbott [Fri, 1 Feb 2013 13:23:19 +0000 (13:23 +0000)]
staging: comedi: export comedi_set_hw_dev()

Chnage the inline `comedi_set_hw_dev()` to an exported function and
change it's return type from `void` to `int` so we can impose some
restrictions (in a later patch) and return an error if necessary.

Only a few comedi drivers call this, although they don't need to if the
hardware device has been attached automatically via
`comedi_auto_config()` and the comedi driver's `auto_attach()` method.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: change comedi_alloc_subdevice_minor parameters
Ian Abbott [Fri, 1 Feb 2013 10:20:30 +0000 (10:20 +0000)]
staging: comedi: change comedi_alloc_subdevice_minor parameters

`comedi_alloc_subdevice_minor()` doesn't really need a parameter
pointing to a `struct comedi_device` as it can get this information from
the parameter pointing to a `struct comedi_subdevice`.  Just pass the
subdevice parameter.

Signed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: move comedi_alloc_subdevice_minor declarations
Ian Abbott [Fri, 1 Feb 2013 10:20:29 +0000 (10:20 +0000)]
staging: comedi: move comedi_alloc_subdevice_minor declarations

Move the declarations of `comedi_alloc_subdevice_minor()` and
`comedi_free_subdevice_minor()` from "comedidev.h" to
"comedi_internal.h" since they are only of interest to the comedi core,
and are not exported to the low-level comedi drivers.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: wlan-ng: Fix tab coding style issue in hfa384x.h
Garrick He [Fri, 1 Feb 2013 09:45:16 +0000 (01:45 -0800)]
Staging: wlan-ng: Fix tab coding style issue in hfa384x.h

Fix all 'please, no space before tabs' warning found by checkpatch.pl

Signed-off-by: Garrick He <garrickhe@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: das08: split out bus specific code
H Hartley Sweeten [Thu, 31 Jan 2013 22:25:49 +0000 (15:25 -0700)]
staging: comedi: das08: split out bus specific code

Split the bus specific ISA/PC-104 and PCI code out of this driver
and create two new drivers, das08_isa and das08_pci.

This allows removing all the #ifdef'ery in the das08 driver that
handled if the CONFIG_COMEDI_DAS08_{ISA,PCI} options were enabled.

It also makes the PCI driver cleanly Plug-and-Play since the comedi
driver only has an auto_attach callback. Previously it also had an
attach callback in order to handle the ISA cards.

Since the PCMCIA support was already split out, we can also remove
the now unused enum das08_bustype and it's use in the boardinfo.
The bus specific code deals with the bustype automatically before
it calls the common attach function in das08.

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>
11 years agostaging: vt6656: fix C99 // comments in main_usb.c
Andres More [Thu, 31 Jan 2013 23:23:07 +0000 (18:23 -0500)]
staging: vt6656: fix C99 // comments in main_usb.c

Resolved 'do not use C99 // comments' checkpatch errors.
Many warnings about odd indentation were left.

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: fixed C99 // comments in two headers
Andres More [Thu, 31 Jan 2013 20:57:19 +0000 (15:57 -0500)]
staging: vt6656: fixed C99 // comments in two headers

Cleared 'do not use C99 // comments' checkpatch error in device.h and
device_cfg.h

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: cleared C99 // comments in datarate.c
Andres More [Thu, 31 Jan 2013 20:20:42 +0000 (15:20 -0500)]
staging: vt6656: cleared C99 // comments in datarate.c

Cleared 'do not use C99 // comments' checkpatch error, several warnings
about code indentation and camel casing were not resolved.

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: fixed C99 // comments
Andres More [Thu, 31 Jan 2013 20:40:14 +0000 (15:40 -0500)]
staging: vt6656: fixed C99 // comments

Cleared 'do not use C99 // comments' checkpatch errors in two headers.
Several obvious comments were removed.

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: cleared 'do not use C99 // comments' checkpatch errors
Andres More [Thu, 31 Jan 2013 19:55:58 +0000 (14:55 -0500)]
staging: vt6656: cleared 'do not use C99 // comments' checkpatch errors

Switched // comments into respective /**/ ones

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: vt6656: cleared 'do not use C99 // comments' checkpatch errors
Andres More [Thu, 31 Jan 2013 19:33:19 +0000 (14:33 -0500)]
staging: vt6656: cleared 'do not use C99 // comments' checkpatch errors

switched all // comments on file to respective /**/

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_mio_cs: convert to auto attach
H Hartley Sweeten [Thu, 31 Jan 2013 00:38:02 +0000 (17:38 -0700)]
staging: comedi: ni_mio_cs: convert to auto attach

Convert this pcmcia driver to the comedi auto attach mechanism.

This allows getting rid of the "hack" needed to pass the pcmcia_device
pointer from the pcmcia_driver to the comedi_driver.

We still need the boardinfo because ni_mio_common.c uses it. Cleanup
ni_getboardtype() so it returns a pointer to the boardinto instead
of the index.

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>
11 years agostaging: comedi: ni_labpc_cs: convert to auto attach
H Hartley Sweeten [Thu, 31 Jan 2013 00:08:05 +0000 (17:08 -0700)]
staging: comedi: ni_labpc_cs: convert to auto attach

Convert this pcmcia driver to the comedi auto attach mechanism.

This allows getting rid of the "hack" needed to pass the pcmcia_device
pointer from the pcmcia_driver to the comedi_driver.

We still need the boardinfo because the ni_labpc driver uses it. But
we can get rid of the duplicate that allowed attaching with the driver
name.

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>
11 years agostaging: comedi: ni_daq_dio24: remove some unnecessary includes
H Hartley Sweeten [Wed, 30 Jan 2013 23:48:15 +0000 (16:48 -0700)]
staging: comedi: ni_daq_dio24: remove some unnecessary includes

This driver does not use anything from the interrupt.h, slab.h,
and ioport.h headers. Don't bother including them.

For aesthetic reasons, move the include of the comedi specific
8255.h header to the end of the includes.

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>
11 years agostaging: comedi: ni_daq_dio24: convert to auto attach
H Hartley Sweeten [Wed, 30 Jan 2013 23:47:01 +0000 (16:47 -0700)]
staging: comedi: ni_daq_dio24: convert to auto attach

Convert this pcmcia driver to the comedi auto attach mechanism.

This allows getting rid of the "hack" needed to pass the pcmcia_device
pointer from the pcmcia_driver to the comedi_driver as well as the
now unnecessary boardinfo.

Check the call to subdev_8255_init() for success. That function does
a kzalloc and could return -ENOMEM.

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>
11 years agostaging: comedi: ni_daq_dio24: cleanup dio24_detach
H Hartley Sweeten [Wed, 30 Jan 2013 23:46:39 +0000 (16:46 -0700)]
staging: comedi: ni_daq_dio24: cleanup dio24_detach

Simplify the call to subdev_8255_cleanup() to remove the
need for a local variable.

This driver only attaches to pcmcia devices so the test for
thisboard != pcmcia_bustype will always fail. Remove the test
and the unreachable release_region().

This driver also never does a request_irq() so remove the
free_irq().

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>
11 years agostaging: comedi: ni_daq_dio24: remove '#undef LABPC_DEBUG'
H Hartley Sweeten [Wed, 30 Jan 2013 23:46:16 +0000 (16:46 -0700)]
staging: comedi: ni_daq_dio24: remove '#undef LABPC_DEBUG'

The LABPC_DEBUG define is not used in this driver. Just remove the

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>
11 years agostaging: comedi: ni_daq_dio24: remove comedi private data
H Hartley Sweeten [Wed, 30 Jan 2013 23:45:55 +0000 (16:45 -0700)]
staging: comedi: ni_daq_dio24: remove comedi private data

The comedi private data, struct dio24_private, is not used in
the driver. Remove it and the kzalloc.

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>
11 years agostaging: comedi: ni_daq_dio24: remove the '#ifdef incomplete' code
H Hartley Sweeten [Wed, 30 Jan 2013 23:45:32 +0000 (16:45 -0700)]
staging: comedi: ni_daq_dio24: remove the '#ifdef incomplete' code

All the '#ifdef incomplete' code deals with interrupt support in
this driver. For now just remove all this #if'defed out code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_daq_dio24: remove thisboard macro
H Hartley Sweeten [Wed, 30 Jan 2013 23:45:09 +0000 (16:45 -0700)]
staging: comedi: ni_daq_dio24: remove thisboard macro

The 'thisboard' macro relies on a local variable having a specific
name and yields a pointer derived from that local variable.

Replace the macro with a local variable and use the comedi_board()
helper to get the 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>
11 years agostaging: comedi: ni_daq_dio24: move comedi_driver declaration
H Hartley Sweeten [Wed, 30 Jan 2013 23:44:47 +0000 (16:44 -0700)]
staging: comedi: ni_daq_dio24: move comedi_driver declaration

Move the comedi_driver declaration down in the file. This removes
the need for the forward declarations.

For aesthetic reasons, add some whitespace to the declaration.

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>
11 years agostaging: comedi: ni_daq_dio24: remove pcmcia_device private data
H Hartley Sweeten [Wed, 30 Jan 2013 23:44:25 +0000 (16:44 -0700)]
staging: comedi: ni_daq_dio24: remove pcmcia_device private data

The private data, struct local_info_t, is not being used in the
driver. Remove it as well as the kzalloc/kfree.

Also, don't set the 'pcmcia_cur_dev' variable unless the pcmcia
probe is successful.

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>
11 years agostaging: comedi: ni_daq_dio24: cleanup pcmcia probe/remove
H Hartley Sweeten [Wed, 30 Jan 2013 23:43:48 +0000 (16:43 -0700)]
staging: comedi: ni_daq_dio24: cleanup pcmcia probe/remove

Absorb the code from dio24_config() into the probe function,
dio24_cs_attach() and properly return the error code when the
probe fails. This also gets rid of an unnecessary forward
declaration.

For aesthetic reasons, move the remove functio, dio24_cs_detach(),
so it's after the probe function.

Remove a number of dev_{level} noise messages in the probe/remove
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>
11 years agostaging: comedi: ni_daq_dio24: remove pcmcia_driver suspend/resume
H Hartley Sweeten [Wed, 30 Jan 2013 23:43:22 +0000 (16:43 -0700)]
staging: comedi: ni_daq_dio24: remove pcmcia_driver suspend/resume

The pcmcia_driver suspend and resume functions in this driver
don't do anything. Since they are optional 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>
11 years agostaging: comedi: ni_daq_dio24: remove 'stop' from private pcmcia data
H Hartley Sweeten [Wed, 30 Jan 2013 23:42:31 +0000 (16:42 -0700)]
staging: comedi: ni_daq_dio24: remove 'stop' from private pcmcia data

The pcmcia_driver suspend and remove functions set the 'stop' variable
and the resume function clears it. Nothing in the comedi_driver code
uses the 'stop' variable.

Just remove it so we can get rid of the suspend/resume.

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>
11 years agostaging: comedi: ni_daq_dio24: remove dio24_release()
H Hartley Sweeten [Wed, 30 Jan 2013 23:42:06 +0000 (16:42 -0700)]
staging: comedi: ni_daq_dio24: remove dio24_release()

This function simply calls pcmcia_disable_device(). Remove it and
just call pcmcia_disable_device() where needed.

Also, remove a couple unnecessary 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>
11 years agostaging: comedi: ni_daq_dio24: cleanup pcmcia_driver
H Hartley Sweeten [Wed, 30 Jan 2013 23:41:45 +0000 (16:41 -0700)]
staging: comedi: ni_daq_dio24: cleanup pcmcia_driver

For aesthetic reasons, reorder the pcmcia_driver variables and
add some whitespace.

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>
11 years agostaging: comedi: ni_daq_dio24: move MODULE_* info to end of file
H Hartley Sweeten [Wed, 30 Jan 2013 23:41:21 +0000 (16:41 -0700)]
staging: comedi: ni_daq_dio24: move MODULE_* info to end of file

For aesthetic reasons, move all the MODULE_* information to the end
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>
11 years agostaging/xgifb: remove unused variables
Peter Huewe [Sun, 3 Feb 2013 03:08:46 +0000 (04:08 +0100)]
staging/xgifb: remove unused variables

XGI_P3cc is unused and the assignment without side effects -> remove;
Data can be simply replaced by the Temp variable, which was changed to
temp in order to make checkpatch happy.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove redundant if statement
Peter Huewe [Sun, 3 Feb 2013 03:08:45 +0000 (04:08 +0100)]
staging/xgifb: Remove redundant if statement

The code checks twice for if (pVBInfo->VBInfo & SetCRT2ToTV) without any
changes in between -> we can remove the second check.
And while at it we can also save the temp variable and use tempbx
directly.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unused variables
Peter Huewe [Sun, 3 Feb 2013 03:08:44 +0000 (04:08 +0100)]
staging/xgifb: Remove unused variables

Pindex and Pdata are unused -> remove
tempbx is unused -> remove

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unused variable and dead assignment
Peter Huewe [Sun, 3 Feb 2013 03:08:43 +0000 (04:08 +0100)]
staging/xgifb: Remove unused variable and dead assignment

modeflag is unused in XGI_SetSeqRegs, XGI_GetTVInfo,
  XGI_SetLCDRegs, XGI_GetRatePtrCRT2 -> remove

resinfo is unused in XGI_PreSetGroup1, XGI_SetGroup1, XGI_SetGroup2,
  XGI_SetLCDRegs -> remove

push1,push2 are unused in XGI_SetLCDRegs -> remove

CRT1Index is unused in XGI_PreSetGroup1, XGI_SetLockRegs,
  XGI_SetLCDRegs -> remove

tempcx in XGI_PreSetGroup1 only holds the values 4,5,6
  -> change its type to u8

crt2crtc is unused in XGI_SetGroup2 -> remove

CRT2Index is unused in XGI_GetVCLK2Ptr -> remove.

Assignment to i is dead in XGI_SetSeqRegs since it is not used before
  the next assignment -> remove the dead assignment.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unused variable
Peter Huewe [Sun, 3 Feb 2013 03:08:42 +0000 (04:08 +0100)]
staging/xgifb: Remove unused variable

Index is not used here -> remove.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/xgifb: Remove unused variables and dead assignments
Peter Huewe [Sun, 3 Feb 2013 03:08:41 +0000 (04:08 +0100)]
staging/xgifb: Remove unused variables and dead assignments

The variables A,HBS and VBS are never read in XGIfb_mode_rate_to_ddata
and the assignment has no side effects -> so we can simply remove them.
Removing them causes VT, HT and cr_data3 to be unused -> remove them as well
and remove the assignmens to cr_data which are shadowed by a different
assignment a few lines later.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoiio:max1363 remove some functions left after merge
Jonathan Cameron [Sat, 2 Feb 2013 10:47:08 +0000 (10:47 +0000)]
iio:max1363 remove some functions left after merge

merge commit 17cb3be61b45d716f6b21a9380925493413ce0ed
seems to have resulted in two functions that were removed in
4389fbec5b8fd0577c1e854ff5d7139329558c20 reappearing.

Spotted due to a build kicking out

drivers/iio/adc/max1363.c:1486:12: warning: 'max1363_register_buffered_funcs_and_init' defined but not used
drivers/iio/adc/max1363.c:1521:13: warning: 'max1363_buffer_cleanup' defined but not used

This patch just removes them again.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: don't expose comedi_proc_{init,cleanup}
H Hartley Sweeten [Wed, 30 Jan 2013 22:25:31 +0000 (15:25 -0700)]
staging: comedi: don't expose comedi_proc_{init,cleanup}

These functions are only used by the comedi core. Move the
prototypes to comedi_internal.h so they are not exposed to
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>
11 years agostaging: comedi: don't expose comedi_device_{attach,detach}
H Hartley Sweeten [Wed, 30 Jan 2013 22:25:06 +0000 (15:25 -0700)]
staging: comedi: don't expose comedi_device_{attach,detach}

These functions are only used by the comedi core. Move the
prototypes to comedi_internal.h so they are not exposed to
the comedi drivers.

Tidy up comedi_internal.h a bit so that all the internal stuff
in drivers.c is grouped.

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>
11 years agostaging: comedi: tidy up the general purpose driver functions
H Hartley Sweeten [Wed, 30 Jan 2013 22:24:38 +0000 (15:24 -0700)]
staging: comedi: tidy up the general purpose driver functions

Group all the general comedi driver register/config/attach
prototypes into one place in comedidev.h.

Reorder the functions in drivers.c a bit so they are in a more
logical usage order (bottom to top).

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>
11 years agostaging: comedi: ni_daq_700: convert to auto attach
H Hartley Sweeten [Wed, 30 Jan 2013 22:24:13 +0000 (15:24 -0700)]
staging: comedi: ni_daq_700: convert to auto attach

Convert this pcmcia driver to the comedi auto attach mechanism.

This allows getting rid of the "hack" needed to pass the pcmcia_device
pointer from the pcmcia_driver to the comedi_driver.

We can also get rid of the boardinfo since it was only used to
provide the "name" that was used with the manual 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>
11 years agostaging: comedi: das08_cs: convert to auto attach
H Hartley Sweeten [Wed, 30 Jan 2013 22:23:50 +0000 (15:23 -0700)]
staging: comedi: das08_cs: convert to auto attach

Convert this pcmcia driver to the comedi auto attach mechanism.

This allows getting rid of the "hack" needed to pass the pcmcia_device
pointer from the pcmcia_driver to the comedi_driver.

We still need the boardinfo because the das08 driver uses it. But we
can get rid of the duplicate that allowed attaching with the driver
name.

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>
11 years agostaging: comedi: cb_das16_cs: convert to auto attach
H Hartley Sweeten [Wed, 30 Jan 2013 22:23:27 +0000 (15:23 -0700)]
staging: comedi: cb_das16_cs: convert to auto attach

Convert this pcmcia driver to the comedi auto attach mechanism.

This allows getting rid of the "hack" needed to pass the pcmcia_device
pointer from the pcmcia_driver to the comedi_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>
11 years agostaging: comedi: allow pcmcia drivers to auto attach
H Hartley Sweeten [Wed, 30 Jan 2013 22:23:06 +0000 (15:23 -0700)]
staging: comedi: allow pcmcia drivers to auto attach

Introduce some helper functions to allow converting the comedi
pcmcia drivers to the comedi auto_attach mechanism.

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>
11 years agostaging: comedi: conditionally build in PCMCIA driver support
H Hartley Sweeten [Wed, 30 Jan 2013 22:22:44 +0000 (15:22 -0700)]
staging: comedi: conditionally build in PCMCIA driver support

Separate the comedi_pcmcia_* functions out of drivers.c into a new
source file, comedi_pcmcia.c. This allows conditionally building
support for comedi pcmcia drivers into the comedi core without the
need for the #if'defery. Fix the Kconfig and Makefile appropriately.

Group all the comedi_pcmcia_* prototypes into one place in comedidev.h.
Protect these prototypes with an #ifdef so that building a comedi
pcmcia driver without PCMCIA support will cause a build error. This
will normally not happen as long as the comedi pcmcia driver is placed
in the proper group in the Kconfig.

Remove the #include <pcmcia/*.h> from drivers.c. These includes are only
needed by the comedi pcmcia driver support code and the pcmcia drivers.
The include should occur in those files.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: conditionally build in PCI driver support
H Hartley Sweeten [Wed, 30 Jan 2013 22:22:21 +0000 (15:22 -0700)]
staging: comedi: conditionally build in PCI driver support

Separate the comedi_pci_* functions out of drivers.c into a new
source file, comedi_pci.c. This allows conditionally building
support for comedi PCI drivers into the comedi core. Fix the
Kconfig and Makefile appropriately.

Group all the comedi_pci_* prototypes and related defines into one
place in comedidev.h. Protect these prototypes with an #ifdef and
provide some dummy functions so that the mixed ISA/PCI comedi
drivers will still build correctly.

Remove the #include <linux/pci.h> from comedidev.h and drivers.c. This
include is only needed by the comedi PCI driver support code and the
PCI drivers. The include should occur in those files.

Also, remove the #include <linux/pci.h> from a couple non-PCI drivers
since it's not needed.

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>
11 years agostaging: comedi: conditionally build in USB driver support
H Hartley Sweeten [Wed, 30 Jan 2013 22:21:49 +0000 (15:21 -0700)]
staging: comedi: conditionally build in USB driver support

Separate the comedi_usb_* functions out of drivers.c into a new
source file, comedi_usb.c. This allows conditionally building
support for comedi USB drivers into the comedi core without the
need for the #if'defery. Fix the Kconfig and Makefile appropriately.
For aesthetic reasons, add some whitespace to the Makefile to keep
everything lined up.

Group all the comedi_usb_* prototypes into one place in comedidev.h.
Protect these prototypes with an #ifdef so that building a comedi
usb driver without USB support will cause a build error. This will
normally not happen as long as the comedi USB driver is placed in
the proper group in the Kconfig.

Remove the #include<linux/usb.h> from comedidev.h and drivers.c. This
include is only needed by the comedi USB driver support code and the
USB drivers. The include should occur in those files.

Removing the include of usb.h exposed a couple drivers that need
<linux/interrupt.h> and <linux/sched.h>. Add the missing includes.

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>
11 years agostaging: vt6656: Fix URB submitted while active warning.
Malcolm Priestley [Wed, 30 Jan 2013 20:07:29 +0000 (20:07 +0000)]
staging: vt6656: Fix URB submitted while active warning.

This error happens because PIPEnsControlOut and PIPEnsControlIn unlock the
spin lock for delay, letting in another thread.

The patch moves the current MP_SET_FLAG to before filling
of sUsbCtlRequest for pControlURB and clears it in event of failing.

Any thread calling either function while fMP_CONTROL_READS or fMP_CONTROL_WRITES
flags set will return STATUS_FAILURE.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # 3.8
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Fix compiler warning
Peter Hurley [Wed, 30 Jan 2013 21:18:50 +0000 (16:18 -0500)]
staging/fwserial: Fix compiler warning

Fix:
drivers/staging/fwserial/fwserial.c:581:3: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t'

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Annotate rcu pointers with __rcu
Peter Hurley [Wed, 30 Jan 2013 22:44:16 +0000 (17:44 -0500)]
staging/fwserial: Annotate rcu pointers with __rcu

Fixes these sparse warnings:
drivers/staging/fwserial/fwserial.c:430:16: sparse: incompatible types in comparison expression (different address spaces)
drivers/staging/fwserial/fwserial.c:699:30: sparse: incompatible types in comparison expression (different address spaces)
drivers/staging/fwserial/fwserial.c:802:16: sparse: incompatible types in comparison expression (different address spaces)
drivers/staging/fwserial/fwserial.c:898:16: sparse: incompatible types in comparison expression (different address spaces)
drivers/staging/fwserial/fwserial.c:1842:14: sparse: incompatible types in comparison expression (different address spaces)

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zsmalloc: remove unused pool name
Seth Jennings [Wed, 30 Jan 2013 15:36:52 +0000 (09:36 -0600)]
staging: zsmalloc: remove unused pool name

zs_create_pool() currently takes a name argument which is
never used in any useful way.

This patch removes it.

Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Acked-by: Nitin Gupta <ngupta@vflare.org>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ISA DMA drivers should depend on ISA_DMA_API
Geert Uytterhoeven [Wed, 30 Jan 2013 12:00:09 +0000 (13:00 +0100)]
staging: comedi: ISA DMA drivers should depend on ISA_DMA_API

m68k allmodconfig:

  CC [M]  drivers/staging/comedi/drivers/pcl812.o
drivers/staging/comedi/drivers/pcl812.c: In function â€˜pcl812_ai_cmd’:
drivers/staging/comedi/drivers/pcl812.c:736: error: implicit declaration of function â€˜set_dma_mode’
drivers/staging/comedi/drivers/pcl812.c:736: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/pcl812.c:736: error: (Each undeclared identifier is reported only once
drivers/staging/comedi/drivers/pcl812.c:736: error: for each function it appears in.)
drivers/staging/comedi/drivers/pcl812.c:737: error: implicit declaration of function â€˜claim_dma_lock’
drivers/staging/comedi/drivers/pcl812.c:738: error: implicit declaration of function â€˜clear_dma_ff’
drivers/staging/comedi/drivers/pcl812.c:739: error: implicit declaration of function â€˜set_dma_addr’
drivers/staging/comedi/drivers/pcl812.c:740: error: implicit declaration of function â€˜set_dma_count’
drivers/staging/comedi/drivers/pcl812.c:741: error: implicit declaration of function â€˜release_dma_lock’
drivers/staging/comedi/drivers/pcl812.c:742: error: implicit declaration of function â€˜enable_dma’
drivers/staging/comedi/drivers/pcl812.c: In function â€˜interrupt_pcl812_ai_dma’:
drivers/staging/comedi/drivers/pcl812.c:883: error: implicit declaration of function â€˜disable_dma’
drivers/staging/comedi/drivers/pcl812.c:884: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/pcl812.c: In function â€˜pcl812_ai_poll’:
drivers/staging/comedi/drivers/pcl812.c:947: error: implicit declaration of function â€˜get_dma_residue’
make[2]: *** [drivers/staging/comedi/drivers/pcl812.o] Error 1
  CC [M]  drivers/staging/comedi/drivers/pcl816.o
drivers/staging/comedi/drivers/pcl816.c: In function â€˜interrupt_pcl816_ai_mode13_dma’:
drivers/staging/comedi/drivers/pcl816.c:359: error: implicit declaration of function â€˜disable_dma’
drivers/staging/comedi/drivers/pcl816.c:366: error: implicit declaration of function â€˜set_dma_mode’
drivers/staging/comedi/drivers/pcl816.c:366: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/pcl816.c:366: error: (Each undeclared identifier is reported only once
drivers/staging/comedi/drivers/pcl816.c:366: error: for each function it appears in.)
drivers/staging/comedi/drivers/pcl816.c:367: error: implicit declaration of function â€˜claim_dma_lock’
drivers/staging/comedi/drivers/pcl816.c:369: error: implicit declaration of function â€˜set_dma_addr’
drivers/staging/comedi/drivers/pcl816.c:372: error: implicit declaration of function â€˜set_dma_count’
drivers/staging/comedi/drivers/pcl816.c:378: error: implicit declaration of function â€˜release_dma_lock’
drivers/staging/comedi/drivers/pcl816.c:379: error: implicit declaration of function â€˜enable_dma’
drivers/staging/comedi/drivers/pcl816.c: In function â€˜pcl816_ai_cmd’:
drivers/staging/comedi/drivers/pcl816.c:629: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/pcl816.c:631: error: implicit declaration of function â€˜clear_dma_ff’
drivers/staging/comedi/drivers/pcl816.c: In function â€˜pcl816_ai_poll’:
drivers/staging/comedi/drivers/pcl816.c:679: error: implicit declaration of function â€˜get_dma_residue’
make[2]: *** [drivers/staging/comedi/drivers/pcl816.o] Error 1
  CC [M]  drivers/staging/comedi/drivers/pcl818.o
drivers/staging/comedi/drivers/pcl818.c: In function â€˜interrupt_pcl818_ai_mode13_dma’:
drivers/staging/comedi/drivers/pcl818.c:547: error: implicit declaration of function â€˜disable_dma’
drivers/staging/comedi/drivers/pcl818.c:550: error: implicit declaration of function â€˜set_dma_mode’
drivers/staging/comedi/drivers/pcl818.c:550: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/pcl818.c:550: error: (Each undeclared identifier is reported only once
drivers/staging/comedi/drivers/pcl818.c:550: error: for each function it appears in.)
drivers/staging/comedi/drivers/pcl818.c:551: error: implicit declaration of function â€˜claim_dma_lock’
drivers/staging/comedi/drivers/pcl818.c:552: error: implicit declaration of function â€˜set_dma_addr’
drivers/staging/comedi/drivers/pcl818.c:555: error: implicit declaration of function â€˜set_dma_count’
drivers/staging/comedi/drivers/pcl818.c:561: error: implicit declaration of function â€˜release_dma_lock’
drivers/staging/comedi/drivers/pcl818.c:562: error: implicit declaration of function â€˜enable_dma’
drivers/staging/comedi/drivers/pcl818.c: In function â€˜pcl818_ai_mode13dma_int’:
drivers/staging/comedi/drivers/pcl818.c:886: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/pcl818.c:888: error: implicit declaration of function â€˜clear_dma_ff’
make[2]: *** [drivers/staging/comedi/drivers/pcl818.o] Error 1
  CC [M]  drivers/staging/comedi/drivers/das16.o
drivers/staging/comedi/drivers/das16.c: In function â€˜das16_cmd_exec’:
drivers/staging/comedi/drivers/das16.c:644: error: implicit declaration of function â€˜claim_dma_lock’
drivers/staging/comedi/drivers/das16.c:645: error: implicit declaration of function â€˜disable_dma’
drivers/staging/comedi/drivers/das16.c:648: error: implicit declaration of function â€˜clear_dma_ff’
drivers/staging/comedi/drivers/das16.c:650: error: implicit declaration of function â€˜set_dma_addr’
drivers/staging/comedi/drivers/das16.c:654: error: implicit declaration of function â€˜set_dma_count’
drivers/staging/comedi/drivers/das16.c:655: error: implicit declaration of function â€˜enable_dma’
drivers/staging/comedi/drivers/das16.c:656: error: implicit declaration of function â€˜release_dma_lock’
drivers/staging/comedi/drivers/das16.c: In function â€˜disable_dma_on_even’:
drivers/staging/comedi/drivers/das16.c:845: error: implicit declaration of function â€˜get_dma_residue’
drivers/staging/comedi/drivers/das16.c: In function â€˜das16_attach’:
drivers/staging/comedi/drivers/das16.c:1197: error: implicit declaration of function â€˜set_dma_mode’
drivers/staging/comedi/drivers/das16.c:1197: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/das16.c:1197: error: (Each undeclared identifier is reported only once
drivers/staging/comedi/drivers/das16.c:1197: error: for each function it appears in.)
make[2]: *** [drivers/staging/comedi/drivers/das16.o] Error 1
  CC [M]  drivers/staging/comedi/drivers/das1800.o
drivers/staging/comedi/drivers/das1800.c: In function â€˜das1800_flush_dma_channel’:
drivers/staging/comedi/drivers/das1800.c:555: error: implicit declaration of function â€˜disable_dma’
drivers/staging/comedi/drivers/das1800.c:559: error: implicit declaration of function â€˜clear_dma_ff’
drivers/staging/comedi/drivers/das1800.c:562: error: implicit declaration of function â€˜get_dma_residue’
drivers/staging/comedi/drivers/das1800.c: In function â€˜das1800_flush_dma’:
drivers/staging/comedi/drivers/das1800.c:586: error: implicit declaration of function â€˜claim_dma_lock’
drivers/staging/comedi/drivers/das1800.c:603: error: implicit declaration of function â€˜release_dma_lock’
drivers/staging/comedi/drivers/das1800.c: In function â€˜das1800_handle_dma’:
drivers/staging/comedi/drivers/das1800.c:622: error: implicit declaration of function â€˜set_dma_addr’
drivers/staging/comedi/drivers/das1800.c:624: error: implicit declaration of function â€˜set_dma_count’
drivers/staging/comedi/drivers/das1800.c:625: error: implicit declaration of function â€˜enable_dma’
drivers/staging/comedi/drivers/das1800.c: In function â€˜das1800_init_dma’:
drivers/staging/comedi/drivers/das1800.c:1424: error: implicit declaration of function â€˜set_dma_mode’
drivers/staging/comedi/drivers/das1800.c:1424: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/das1800.c:1424: error: (Each undeclared identifier is reported only once
drivers/staging/comedi/drivers/das1800.c:1424: error: for each function it appears in.)
make[2]: *** [drivers/staging/comedi/drivers/das1800.o] Error 1
  CC [M]  drivers/staging/comedi/drivers/dt282x.o
drivers/staging/comedi/drivers/dt282x.c: In function â€˜dt282x_ao_dma_interrupt’:
drivers/staging/comedi/drivers/dt282x.c:328: error: implicit declaration of function â€˜disable_dma’
drivers/staging/comedi/drivers/dt282x.c: In function â€˜prep_ai_dma’:
drivers/staging/comedi/drivers/dt282x.c:416: error: implicit declaration of function â€˜set_dma_mode’
drivers/staging/comedi/drivers/dt282x.c:416: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/dt282x.c:416: error: (Each undeclared identifier is reported only once
drivers/staging/comedi/drivers/dt282x.c:416: error: for each function it appears in.)
drivers/staging/comedi/drivers/dt282x.c:417: error: implicit declaration of function â€˜claim_dma_lock’
drivers/staging/comedi/drivers/dt282x.c:418: error: implicit declaration of function â€˜clear_dma_ff’
drivers/staging/comedi/drivers/dt282x.c:419: error: implicit declaration of function â€˜set_dma_addr’
drivers/staging/comedi/drivers/dt282x.c:420: error: implicit declaration of function â€˜set_dma_count’
drivers/staging/comedi/drivers/dt282x.c:421: error: implicit declaration of function â€˜release_dma_lock’
drivers/staging/comedi/drivers/dt282x.c:423: error: implicit declaration of function â€˜enable_dma’
drivers/staging/comedi/drivers/dt282x.c: In function â€˜prep_ao_dma’:
drivers/staging/comedi/drivers/dt282x.c:439: error: â€˜DMA_MODE_WRITE’ undeclared (first use in this function)
drivers/staging/comedi/drivers/dt282x.c: In function â€˜dt282x_interrupt’:
drivers/staging/comedi/drivers/dt282x.c:471: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/dt282x.c: In function â€˜dt282x_ai_cmd’:
drivers/staging/comedi/drivers/dt282x.c:690: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/dt282x.c: In function â€˜dt282x_ao_cmd’:
drivers/staging/comedi/drivers/dt282x.c:938: error: â€˜DMA_MODE_WRITE’ undeclared (first use in this function)
make[2]: *** [drivers/staging/comedi/drivers/dt282x.o] Error 1
  CC [M]  drivers/staging/comedi/drivers/ni_at_a2150.o
drivers/staging/comedi/drivers/ni_at_a2150.c: In function â€˜a2150_interrupt’:
drivers/staging/comedi/drivers/ni_at_a2150.c:237: error: implicit declaration of function â€˜claim_dma_lock’
drivers/staging/comedi/drivers/ni_at_a2150.c:238: error: implicit declaration of function â€˜disable_dma’
drivers/staging/comedi/drivers/ni_at_a2150.c:241: error: implicit declaration of function â€˜clear_dma_ff’
drivers/staging/comedi/drivers/ni_at_a2150.c:249: error: implicit declaration of function â€˜get_dma_residue’
drivers/staging/comedi/drivers/ni_at_a2150.c:286: error: implicit declaration of function â€˜set_dma_addr’
drivers/staging/comedi/drivers/ni_at_a2150.c:287: error: implicit declaration of function â€˜set_dma_count’
drivers/staging/comedi/drivers/ni_at_a2150.c:288: error: implicit declaration of function â€˜enable_dma’
drivers/staging/comedi/drivers/ni_at_a2150.c:290: error: implicit declaration of function â€˜release_dma_lock’
drivers/staging/comedi/drivers/ni_at_a2150.c: In function â€˜a2150_attach’:
drivers/staging/comedi/drivers/ni_at_a2150.c:794: error: implicit declaration of function â€˜set_dma_mode’
drivers/staging/comedi/drivers/ni_at_a2150.c:794: error: â€˜DMA_MODE_READ’ undeclared (first use in this function)
drivers/staging/comedi/drivers/ni_at_a2150.c:794: error: (Each undeclared identifier is reported only once
drivers/staging/comedi/drivers/ni_at_a2150.c:794: error: for each function it appears in.)
make[2]: *** [drivers/staging/comedi/drivers/ni_at_a2150.o] Error 1

Make PCL816, PCL818, DAS16, DAS1800, DT282X, and NI_AT_A2150 depend on
ISA_DMA_API to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: cleanup all board minors on module exit
Ian Abbott [Mon, 28 Jan 2013 17:07:39 +0000 (17:07 +0000)]
staging: comedi: cleanup all board minors on module exit

The comedi core module optionally allocates some legacy board minor
devices on module load and cleans these up on module exit.  These are
used for manual configuration of comedi boards (for those low-level
comedi drivers that support manual configuration - mainly for ISA
boards).  Other board minor devices are created and destroyed
dynamically in response to bus device probe and remove requests.  The
ioctl used for manual configuration (attachment) and removal
(detachment) of devices is COMEDI_DEVCONFIG, but that works for any
board minor device, including those that were originally created
dynamically.

If the COMEDI_DEVCONFIG ioctl is used to manually detach an
automatically created and attached device, commit
7d3135af399e92cf4c9bbc5f86b6c140aab3b88c ("staging: comedi: prevent
auto-unconfig of manually configured devices") ensures that the board
minor will no longer be automatically detached and destroyed by a bus
device remove request.  From that point on the board minor behaves more
like one of the comedi "legacy" board minors.  (There would be some
justification for destroying the board minor instead, but I'd rather
leave that decision until removal of board minors has been
made safer than it currently is.)  Although the board minor behaves more
like a legacy board minor, it is not currently cleaned up on module
exit.  In fact, the module exit code will bug out because this board
minor has not been cleaned up.

Change comedi_cleanup_legacy_minors() (called from the module exit code,
and from the module init code on error) to clean up all board minors.
Rename the function to comedi_cleanup_board_minors() to reflect the
change in functionality.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: disallow COMEDI_DEVCONFIG on non-board minors
Ian Abbott [Mon, 28 Jan 2013 16:14:31 +0000 (16:14 +0000)]
staging: comedi: disallow COMEDI_DEVCONFIG on non-board minors

Comedi has two sorts of minor devices:
(a) normal board minor devices in the range 0 to
COMEDI_NUM_BOARD_MINORS-1 inclusive; and
(b) special subdevice minor devices in the range COMEDI_NUM_BOARD_MINORS
upwards that are used to open the same underlying comedi device as the
normal board minor devices, but with non-default read and write
subdevices for asynchronous commands.

The special subdevice minor devices get created when a board supporting
asynchronous commands is attached to a normal board minor device, and
destroyed when the board is detached from the normal board minor device.
One way to attach or detach a board is by using the COMEDI_DEVCONFIG
ioctl.  This should only be used on normal board minors as the special
subdevice minors are too ephemeral.  In particular, the change
introduced in commit 7d3135af399e92cf4c9bbc5f86b6c140aab3b88c ("staging:
comedi: prevent auto-unconfig of manually configured devices") breaks
horribly for special subdevice minor devices.

Since there's no legitimate use for the COMEDI_DEVCONFIG ioctl on a
special subdevice minor device node, disallow it and return -ENOTTY.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Fix endian issue in unit directory
Peter Hurley [Tue, 29 Jan 2013 14:10:30 +0000 (09:10 -0500)]
staging/fwserial: Fix endian issue in unit directory

Reported-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: add diagnostic for buffer overflow
Peter Hurley [Tue, 29 Jan 2013 03:34:43 +0000 (22:34 -0500)]
staging/fwserial: add diagnostic for buffer overflow

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Remove reference to removed constant
Peter Hurley [Tue, 29 Jan 2013 03:34:42 +0000 (22:34 -0500)]
staging/fwserial: Remove reference to removed constant

FWSERIAL_TTY_START_MINOR was removed. The minor_start is allocated
by tty_alloc_driver().

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Don't use deprecated alloc_tty_driver()
Peter Hurley [Tue, 29 Jan 2013 03:34:41 +0000 (22:34 -0500)]
staging/fwserial: Don't use deprecated alloc_tty_driver()

Use tty_alloc_driver() instead.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Factor unstable stats/debug/status info to debugfs
Peter Hurley [Tue, 29 Jan 2013 03:34:40 +0000 (22:34 -0500)]
staging/fwserial: Factor unstable stats/debug/status info to debugfs

Add the following file hierarchy to debugfs:

  <debugfs>-+
            +- firewire_serial -+- <unit> -+- peers
                                |          +- stats
                                |
                                +- <unit> -+- peers
                                           +- stats

The 'peers' file (read-only) contains status and configuration
info for attached peers for the given fwserial unit.

The 'stats' file (read-only) contains statistics and data profiling
information for each tty port for the given fwserial unit.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Cleanup /proc/tty/driver/ file
Peter Hurley [Tue, 29 Jan 2013 03:34:39 +0000 (22:34 -0500)]
staging/fwserial: Cleanup /proc/tty/driver/ file

Factor out extra stats, data profiles, debugging info and peer info
from procfs file in preparation for using debugfs instead.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Create loop device the 'tty' way
Peter Hurley [Tue, 29 Jan 2013 03:34:38 +0000 (22:34 -0500)]
staging/fwserial: Create loop device the 'tty' way

Register a second tty driver to create loopback devices for
each firewire node. Note that the loopback devices are numbered
from 0; the tty->index is transformed when used to index the
port table.

Remove the hack that previously enabled this.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Fix sparse build warnings
Peter Hurley [Tue, 29 Jan 2013 03:34:37 +0000 (22:34 -0500)]
staging/fwserial: Fix sparse build warnings

Reported-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Release port regardless of unplug response code
Peter Hurley [Tue, 29 Jan 2013 03:34:36 +0000 (22:34 -0500)]
staging/fwserial: Release port regardless of unplug response code

After sending the unplug response, release the port even if an
error occurred.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Only reset port status for attached peers
Peter Hurley [Tue, 29 Jan 2013 03:34:35 +0000 (22:34 -0500)]
staging/fwserial: Only reset port status for attached peers

When a port has been reserved in an attempt to connect to a peer
but that attempt does not succeed, releasing the port should not
reset the port line status. Although resetting is functionally
harmless, it can appear as if a remote peer dropped carrier to a
port it was not attached to (which can be confusing).

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Drop suggestion for helper fn integration
Peter Hurley [Tue, 29 Jan 2013 01:57:49 +0000 (20:57 -0500)]
staging/fwserial: Drop suggestion for helper fn integration

The firewire core does not require or want the suggested helper fns;
drop suggestion from TODO file.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Assume firmware is OHCI-complaint
Peter Hurley [Tue, 29 Jan 2013 01:57:48 +0000 (20:57 -0500)]
staging/fwserial: Assume firmware is OHCI-complaint

Devices which are OHCI v1.0/ v1.1/ v1.2-draft compliant or
RFC 2734 compliant are required by specification to support
max_rec of 8 (512 bytes) or more. Accept reported value.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Fold constant MAX_ASYNC_PAYLOAD
Peter Hurley [Tue, 29 Jan 2013 01:57:47 +0000 (20:57 -0500)]
staging/fwserial: Fold constant MAX_ASYNC_PAYLOAD

Since peer->max_payload is now limited to 1394-2008 spec maximum
of 4096, the port->max_payload limit can now be simplified.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Simplify max payload calculation
Peter Hurley [Tue, 29 Jan 2013 01:57:46 +0000 (20:57 -0500)]
staging/fwserial: Simplify max payload calculation

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Refer to fw_device as "node"
Peter Hurley [Tue, 29 Jan 2013 01:57:45 +0000 (20:57 -0500)]
staging/fwserial: Refer to fw_device as "node"

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/fwserial: Remove bandwidth limit logic
Peter Hurley [Tue, 29 Jan 2013 01:57:44 +0000 (20:57 -0500)]
staging/fwserial: Remove bandwidth limit logic

Self-limiting asynchronous bandwidth (via reducing the payload)
is not necessary and does not work, because
 1) asynchronous traffic will absorb all available bandwidth (less that
    being used for isochronous traffic)
 2) isochronous arbitration always wins.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging:ozwpan: Fix following warning.
Rupesh Gujare [Tue, 29 Jan 2013 17:00:55 +0000 (17:00 +0000)]
staging:ozwpan: Fix following warning.

The patch ae926051d7eb: "staging: ozwpan: Added USB HCD
implementation" from Feb 20, 2012, leads to the following warning:
drivers/staging/ozwpan/ozhcd.c:1094 oz_hcd_heartbeat()
 warn: what is this condition about? 'ep->buffered_units * 50'

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: nvec: cleanup the string mess
Marc Dietrich [Sun, 27 Jan 2013 16:43:43 +0000 (17:43 +0100)]
staging: nvec: cleanup the string mess

Replace the various command strings by named constants.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: nvec: fix mouse suspend/resume calls
Marc Dietrich [Sun, 27 Jan 2013 16:43:42 +0000 (17:43 +0100)]
staging: nvec: fix mouse suspend/resume calls

The EC command for enable/disable is not an EC command. Instead it needs
to be send to the mouse.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: nvec: move toggle global event reporting to its own function
Marc Dietrich [Sun, 27 Jan 2013 16:43:41 +0000 (17:43 +0100)]
staging: nvec: move toggle global event reporting to its own function

Cleanup toggle of global event reporting by moving it to its own function.
This simplifies the following cleanup.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zsmalloc: Fix TLB coherency and build problem
Minchan Kim [Mon, 28 Jan 2013 01:00:08 +0000 (10:00 +0900)]
staging: zsmalloc: Fix TLB coherency and build problem

Recently, Matt Sealey reported he fail to build zsmalloc caused by
using of local_flush_tlb_kernel_range which are architecture dependent
function so !CONFIG_SMP in ARM couldn't implement it so it ends up
build error following as.

  MODPOST 216 modules
  LZMA    arch/arm/boot/compressed/piggy.lzma
  AS      arch/arm/boot/compressed/lib1funcs.o
ERROR: "v7wbi_flush_kern_tlb_range"
[drivers/staging/zsmalloc/zsmalloc.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
make: *** Waiting for unfinished jobs....

The reason we used that function is copy method by [1]
was really slow in ARM but at that time.

More severe problem is ARM can prefetch speculatively on other CPUs
so under us, other TLBs can have an entry only if we do flush local
CPU. Russell King pointed that. Thanks!
We don't have many choices except using flush_tlb_kernel_range.

My experiment in ARMv7 processor 4 core didn't make any difference with
zsmapbench[2] between local_flush_tlb_kernel_range and flush_tlb_kernel_range
but still page-table based is much better than copy-based.

* bigger is better.

1. local_flush_tlb_kernel_range: 3918795 mappings
2. flush_tlb_kernel_range : 3989538 mappings
3. copy-based: 635158 mappings

This patch replace local_flush_tlb_kernel_range with
flush_tlb_kernel_range which are avaialbe in all architectures
because we already have used it in vmalloc allocator which are
generic one so build problem should go away and performane loss
shoud be void.

[1] f553646, zsmalloc: add page table mapping method
[2] https://github.com/spartacus06/zsmapbench

Cc: stable@vger.kernel.org
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Konrad Rzeszutek Wilk <konrad@darnok.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Reported-by: Matt Sealey <matt@genesi-usa.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/omapdrm: Use kmemdup rather than duplicating its implementation
Peter Huewe [Fri, 25 Jan 2013 23:40:13 +0000 (00:40 +0100)]
staging/omapdrm: Use kmemdup rather than duplicating its implementation

Found with coccicheck.
The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Rob Clark <rob@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agoStaging: zcache: remove unnecessary braces in zcache-main.c
Ryo Munakata [Sat, 26 Jan 2013 10:50:53 +0000 (19:50 +0900)]
Staging: zcache: remove unnecessary braces in zcache-main.c

This fixes a checkpatch.pl issue of
'braces {} are not necessary for single statement blocks'

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/csr: Use kmemdup rather than duplicating its implementation
Peter Huewe [Fri, 25 Jan 2013 23:19:19 +0000 (00:19 +0100)]
staging/csr: Use kmemdup rather than duplicating its implementation

Found with coccicheck.
The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: zsmalloc: make CLASS_DELTA relative to PAGE_SIZE
Seth Jennings [Fri, 25 Jan 2013 17:46:18 +0000 (11:46 -0600)]
staging: zsmalloc: make CLASS_DELTA relative to PAGE_SIZE

Right now ZS_SIZE_CLASS_DELTA is hardcoded to be 16.  This
creates 254 classes for systems with 4k pages. However, on
PPC64 with 64k pages, it creates 4095 classes which is far
too many.

This patch makes ZS_SIZE_CLASS_DELTA relative to PAGE_SIZE
so that regardless of the page size, there will be the same
number of classes.

Acked-by: Nitin Gupta <ngupta@vflare.org>
Acked-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Acked-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging/comedi/adl_pci8164: Don't assign string
Peter Huewe [Mon, 28 Jan 2013 23:36:39 +0000 (00:36 +0100)]
staging/comedi/adl_pci8164: Don't assign string

Assigning a string is really bad,
and since we only have 1 char strings here we
can simply use a char to store the value and change the format specifier.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: simplify comedi_set_hw_dev()
Ian Abbott [Tue, 29 Jan 2013 16:20:17 +0000 (16:20 +0000)]
staging: comedi: simplify comedi_set_hw_dev()

Since `get_device()` and `put_device()` can take a NULL device
parameter, `comedi_set_hw_dev()` can be simplified to always call
`get_device()` for the new, possibly NULL hardware device, and
`put_device()` for the old, possibly NULL hardware device.  As long as
we do it in that order, there shouldn't be any problem with
`kref_release()` getting called unexpectedly when the new hardware
device is the old hardware device.

Simplify `comedi_set_hw_dev()` and update the comment because the
function is used for additional purposes since the old comment was
written.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: don't override read/write subdevice if not supported
Ian Abbott [Tue, 29 Jan 2013 14:05:58 +0000 (14:05 +0000)]
staging: comedi: don't override read/write subdevice if not supported

For comedi devices that support asynchronous commands on some of their
subdevices, the comedi core creates extra device files for each of those
subdevices of the form "/dev/comedi%i_subd%i".  These use the same
comedi device as the corresponding "/dev/comedi%i" but override the
default "read" and "write" subdevice for the device.  Currently it
overrides both the read and write subdevice, but it only makes sense to
override the "read" subdevice if the subdevice supports "read" commands,
and to override the "write" subdevice if the subdevice supports "write"
commands.

In `comedi_alloc_subdevice_minor()`, only set `info->read_subdevice`
non-NULL if the subdevice has the `SDF_CMD_READ` flag set, and only set
`info->write_subdevice` non-NULL if the subdevice has the
`SDF_CMD_WRITE` flag set.  (`comedi_read_subdevice(info)` will use the
device's default read subdevice if `info->read_subdevice` is NULL.
`comedi_write_subdevice(info)` will use the device's default write
subdevice if `info->write_subdevice` is NULL.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11 years agostaging: comedi: ni_labpc_cs: remove '#undef LABPC_DEBUG'
H Hartley Sweeten [Sat, 26 Jan 2013 01:38:23 +0000 (18:38 -0700)]
staging: comedi: ni_labpc_cs: remove '#undef LABPC_DEBUG'

The LABPC_DEBUG define is not used in any of the code. Just
remove the #undef.

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>
11 years agostaging: comedi: ni_labpc_cs: cleanup the boardinfo declaration
H Hartley Sweeten [Sat, 26 Jan 2013 01:38:04 +0000 (18:38 -0700)]
staging: comedi: ni_labpc_cs: cleanup the boardinfo declaration

For aesthetic reasons, reformat the boardinfo declaration and
add some whitespace. Remove all the information that is set to
'0' as this is the default.

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>
11 years agostaging: comedi: ni_labpc_cs: remove thisboard macro
H Hartley Sweeten [Sat, 26 Jan 2013 01:37:41 +0000 (18:37 -0700)]
staging: comedi: ni_labpc_cs: remove thisboard macro

The 'thisboard' macro relies on a local variable having a specific
name and yields a pointer derived from that local variable.

Replace the macro with a local variable and use the comedi_board()
helper to get the 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>
11 years agostaging: comedi: ni_labpc_cs: move comedi_driver declaration
H Hartley Sweeten [Sat, 26 Jan 2013 01:37:27 +0000 (18:37 -0700)]
staging: comedi: ni_labpc_cs: move comedi_driver declaration

Move the comedi_driver declaration down in the file. This removes
the need for the forward declaration.

For aesthetic reasons, add some whitespace to the declaration and
remove the unnecessary '&' before the function names. They are
already addresses.

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>
11 years agostaging: comedi: ni_labpc_cs: remove pcmcia_device private data
H Hartley Sweeten [Sat, 26 Jan 2013 01:37:06 +0000 (18:37 -0700)]
staging: comedi: ni_labpc_cs: remove pcmcia_device private data

The private data, struct local_info_t, is not being used in the
driver. Remove it as well as the kzalloc/kfree.

Also, don't set the 'pcmcia_cur_dev' variable unless the pcmcia
configuration is successful.

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>
11 years agostaging: comedi: ni_labpc_cs: cleanup labpc_cs_attach()
H Hartley Sweeten [Sat, 26 Jan 2013 01:36:50 +0000 (18:36 -0700)]
staging: comedi: ni_labpc_cs: cleanup labpc_cs_attach()

Absorb the code from labpc_config() into this function and properly
return the error if the configuration fails.

Also, remove the dev_dbg() function trace message.

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>
11 years agostaging: comedi: ni_labpc_cs: move pcmcia_driver functions
H Hartley Sweeten [Sat, 26 Jan 2013 01:36:33 +0000 (18:36 -0700)]
staging: comedi: ni_labpc_cs: move pcmcia_driver functions

For aesthetic reasons, move all the pcmcia_driver functions so they
are near the pcmcia_driver declaration. This also removes 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>
11 years agostaging: comedi: ni_labpc_cs: remove pcmcia_driver suspend/resume
H Hartley Sweeten [Sat, 26 Jan 2013 01:36:16 +0000 (18:36 -0700)]
staging: comedi: ni_labpc_cs: remove pcmcia_driver suspend/resume

The pcmcia_driver suspend and resume functions in this driver
don't do anything. Since they are optional 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>
11 years agostaging: comedi: ni_labpc_cs: remove 'stop' from private pcmcia data
H Hartley Sweeten [Sat, 26 Jan 2013 01:35:55 +0000 (18:35 -0700)]
staging: comedi: ni_labpc_cs: remove 'stop' from private pcmcia data

The pcmcia_driver suspend and remove functions set the 'stop' variable
and the resume function clears it. Nothing in the comedi_driver code
uses the 'stop' variable.

Just remove it so we can get rid of the suspend/resume.

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>
11 years agostaging: comedi: ni_labpc_cs: remove labpc_release()
H Hartley Sweeten [Sat, 26 Jan 2013 01:35:39 +0000 (18:35 -0700)]
staging: comedi: ni_labpc_cs: remove labpc_release()

The function simply calls pcmcia_disable_device(). Remove it and
just call pcmcia_disable_device() where needed.

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>
11 years agostaging: comedi: ni_labpc_cs: cleanup pcmcia_driver
H Hartley Sweeten [Sat, 26 Jan 2013 01:35:22 +0000 (18:35 -0700)]
staging: comedi: ni_labpc_cs: cleanup pcmcia_driver

For aesthetic reasons, reorder the pcmcia_driver variables and
add some whitespace.

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>
11 years agostaging: comedi: ni_labpc_cs: move MODULE_* info to end of file
H Hartley Sweeten [Sat, 26 Jan 2013 01:35:06 +0000 (18:35 -0700)]
staging: comedi: ni_labpc_cs: move MODULE_* info to end of file

For aesthetic reasons, move all the MODULE_* information to the end
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>
11 years agostaging: comedi: ni_mio_cs: cleanup the boardinfo declaration
H Hartley Sweeten [Sat, 26 Jan 2013 00:35:55 +0000 (17:35 -0700)]
staging: comedi: ni_mio_cs: cleanup the boardinfo declaration

For aesthetic reasons, reformat the boardinfo declaration and
add some whitespace. Remove all the information that is set to
'0' as this is the default.

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>
11 years agostaging: comedi: ni_mio_cs: cleanup mio_cs_attach()
H Hartley Sweeten [Sat, 26 Jan 2013 00:35:37 +0000 (17:35 -0700)]
staging: comedi: ni_mio_cs: cleanup mio_cs_attach()

Remove the DPRINTK() function trace message as well as the #if 0'ed
out debug code that dumps the board "fingerprint".

Remove the need for the local variable that holds the link->irq
passed to request_irq(). Also, return the error code from that
function instead of assuming -EINVAL. Use the dev->board_name for
the resource string passed to request_irq() instead of the open
coded string "ni_mio_cs".

For aesthetic reasons, add some whitespace to the initializatio
of the devpriv values.

Just return the result of ni_E_init() instead of checking it for
an error, returning the error, or returning "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>