staging: vt6656: use free_netdev instead of kfree

use free_netdev() instead of kfree(pDevice->apdev)

Signed-off-by: Hema Prathaban <hemaklnce@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: ni_labpc: fix build when VIRT_TO_BUS is not defined

After merging the final tree, the next-20130424 build (powerpc
allyesconfig) failed like this:

drivers/staging/comedi/drivers/ni_labpc.c: In function 'labpc_ai_cmd':
drivers/staging/comedi/drivers/ni_labpc.c:980:9: error:
    implicit declaration of function 'virt_to_bus'
   [-Werror=implicit-function-declaration]

The virt_to_bus() is only needed for the ISA DMA support in this driver.

On powerpc, CONFIG_COMEDI_NI_LABPC_ISA cannot be enabled due to the
depends on VIRT_TO_BUS but the PCI driver, ni_labpc_pci, can be enabled.
That driver uses the ni_labpc driver for the common support code shared
by the ISA, PCI, and PCMCIA boards.

The ISA specific support, and the optional ISA DMA support, are currently
still in the common ni_labpc driver. The ISA specific code is protected
by #if IS_ENABLED(CONFIG_COMEDI_NI_LABPC_ISA) and the ISA DMA support
is protected by #ifdef CONFIG_ISA_DMA_API. This allows the ISA support
to be enabled on architectures that support VIRT_TO_BUS and optionally
enables ISA DMA support if ISA_DMA_API is enabled.

Unfortunately, the ISA DMA code uses virt_to_bus(). This results in
the build failure for architectures that enable ISA_DMA_API but do not
have VIRT_TO_BUS.

Add a new member to the private data, dma_addr, to hold the phys_addr_t
returned by virt_to_bus() and initialize it in the ISA specific
labpc_attach().

For architectures that enable ISA_DMA_API but not VIRT_TO_BUS, this
will fix the build error. This is also safe for architectures the
enable both options but don't enable COMEDI_NI_LABPC_ISA because the
dma channel (devpriv->dma_chan) is only initialized in the ISA
specific labpc_attach().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: allow buffer resize if previous resize failed

When a comedi device is successfully attached, those subdevices that
support asynchronous commands will have had buffers allocated
successfully.  It is possible to resize the buffers afterwards, but if
the resize fails the subdevice is left with no buffer
(`s->async->prealloc_buf == NULL`).  Currently, this also causes any
subsequent attempts to resize the buffer to fail with an error, which
seems like a bad idea.

Remove the check in `resize_async_buffer()` that causes the resize to
fail if the subdevice currently has no buffer (presumably due to the
failure of a previous resize attempt).  Callers of
`resize_async_buffer()` have already checked that the subdevice is
allowed to have a buffer.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: work without HAS_DMA

The core "comedi" module and the "mite" helper module for NI PCI devices
both have calls to `dma_alloc_coherent()` and `dma_free_coherent()`.
Those functions are only available if `CONFIG_HAS_DMA` is defined.

Apart from the "mite" module, the functions are only called for comedi
drivers that set `s->async_dma_dir` (where `s` is a pointer to a `struct
comedi_subdevice`) to anything other than `DMA_NONE`.

Change local helper functions `__comedi_buf_alloc()` and
`__comedi_buf_free()` to only call `dma_alloc_coherent()` and
`dma_free_coherent()` if `CONFIG_HAS_DMA` is defined.

Change the "Kconfig" to make the following configuration options depend
on `HAS_DMA`:

`COMEDI_MITE` - builds the "mite" module.
`COMEDI_NI_6527` - selects `COMEDI_MITE`.
`COMEDI_NI_65XX` - selects `COMEDI_MITE`.
`COMEDI_NI_670X` - selects `COMEDI_MITE`.
`COMEDI_NI_LABPC_PCI` - selects `COMEDI_MITE`.
`COMEDI_NI_PCIDIO` - selects `COMEDI_MITE`.
`COMEDI_NI_TIOCMD` - selects `COMEDI_MITE`.
`COMEDI_NI_660X` - selects `COMEDI_NI_TIOCMD`,
                   sets `s->async_dma_dir`.
`COMEDI_NI_PCIMIO` - selects `COMEDI_NI_TIOCMD`,
                     sets `s->async_dma_dir`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: ni_mio_common: only do counter commands for ni_pcimio

"ni_mio_common.c" holds common code included by "ni_pcimio.c",
"ni_atmio.c" and "ni_mio_cs.c", including a common initialization
function `ni_E_init()`.  Amongst other things, this initializes some
counter subdevices to support comedi instructions and asynchronous
commands.  However, even though it sets up the handlers to support
asynchronous commands on these subdevices, the handlers will return an
error unless the `PCIDMA` macro is defined (which is defined only in
"ni_pcimio.c").  If the `PCIDMA` macro is not defined, the comedi core
will needlessly allocate buffers to support the asynchronous commands.
Also, `s->async_dma_dir` is set to `DMA_BIDIRECTIONAL`, causing the
physical pages for the buffers to be allocated using
`dma_alloc_coherent()`.

If the comedi core cannot call `dma_alloc_coherent()` because
`CONFIG_HAS_DMA` is not defined, it will fail to allocate the buffers,
which ultimately causes `ni_E_init()` to fail.

Avoid the wastage and prevent the failure by only setting up
asynchronous command support for the counter subdevices if the `PCIDMA`
macro is defined.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: complain if dma buffer allocation not supported

When allocating a buffer to support asynchronous comedi commands, if a
DMA coherent buffer was requested but `CONFIG_HAS_DMA` is undefined,
bail out of local helper function `__comedi_buf_alloc()` with an error
message.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: nvec: remove inline marking of EXPORT_SYMBOL functions

EXPORT_SYMBOL and inline directives are contradictory to each other.
The patch fixes this inconsistency.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Denis Efremov <yefremov.denis@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: nvec: add missing module aliases

Keyboard and mouse drivers were missing MODULE_ALIAS
definitions. This fixes auto module loading of these
drivers.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: nvec: implement unregistering of notifiers

This implements the unregistering of notifiers so kernel modules
can be unloaded.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: nvec: cleanup childs on remove

Disable device functions and unregister notifier if available. The
serio device must not be "kzallocated". Otherwise serio_unregister_port
will fail because the device is already freed.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
usb: gadget: zero: fix error return code in zero_bind()

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Introduced by commit cf9a08ae5aece88987bbeee8eb0dd0ebb5015815
(usb: gadget: convert source sink and loopback to new function interface)

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: musb: omap2430: add missing platform_device_put() on error in omap2430_probe()

Add the missing platform_device_put() before return from
omap2430_probe() in the error handling case.

Introduced by commit ca784be36cc725bca9b526eba342de7550329731
(usb: start using the control module driver)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Correct typo "supperspeed" to "superspeed".

Tidy up kernel-doc content for USB GADGET. No functional change.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Add a couple kernel-doc lines to prevent warnings.

No functional change.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: gadget: atmel_usba_udc: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: gadget: bcm63xx_udc: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: gadget: dummy_hcd: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: gadget: f_uac2: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Acked-by: Jaswinder Singh <jaswinder.singh@linaro.org>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: gadget: imx_udc: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Darius Augulis <augulis.darius@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
usb: gadget: pxa25x_udc: Remove redundant platform_set_drvdata()

Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>