staging: comedi: propogate error code from comedi_alloc_subdevices
comedi_alloc_subdevices can fail with -EINVAL or -ENOMEM. When it
does fail make sure to pass the proper error code back.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbott@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: remove the "Allocate the subdevice..." comments
These comments are redundant. The function name 'comedi_alloc_subdevices'
provides this information.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <ian@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: remove the comed_alloc_subdevices "allocation failed" messages
Remove all the "allocation failed" debug messages that are displayed
when the comedi_alloc_subdevices call fails.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbot <abbott@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: only set dev->n_subdevices when kcalloc succeedes
It's possible for the kcalloc in comedi_alloc_subdevices to fail.
Only set the dev->n_subdevices variable if the allocation is
successful.
Since the core sets dev->n_subdevices, remove all the places in the
drivers where this variable was getting set.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbott@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: sanity check num_subdevices parameter in comedi_alloc_subdevices
It's possible for a couple of the comedi drivers to incorrectly call
comedi_alloc_subdevices with num_subdevices = 0. Add a sanity check
before doing the kcalloc.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbot@mev.co.uk> Cc: Frank Mori Hess <kmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: change type of num_subdevices parameter to comedi_alloc_subdevices
The n_subdevices variable of struct comedi_device is an int type.
Change the type of the comedi_alloc_subdevices 'num_subdevices' from
an unsigned int to an int to match it.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbott@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ben Chan [Tue, 12 Jun 2012 18:23:32 +0000 (11:23 -0700)]
staging: gdm72xx: Simplify spinlock fix for gdm_usb_send_complete
This patch simplifies the previous patch (commit dd13c86b0dae86efdde98119ffd7348e80719ade) for fixing the spinlock
recursion issue on several call sites of gdm_usb_send_complete.
staging: comedi: export alloc_subdevices as comedi_alloc_subdevices
Move the inline alloc_subdevices() function from comedidev.h
to drivers.c and rename it to comedi_alloc_subdevices(). The
function is large enough to warrant being an exported symbol
rather than being an inline in every driver.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ben Chan [Thu, 7 Jun 2012 06:01:26 +0000 (23:01 -0700)]
staging: gdm72xx: Fix spinlock recursion on gdm_usb_send_complete
This patch fixes a spinlock recursion bug on several call sites of
gdm_usb_send_complete by not calling spin_lock_irqsave on
urb->context->tx_cxt->lock when the lock has already been acquired.
Joe Perches [Wed, 6 Jun 2012 21:46:44 +0000 (14:46 -0700)]
staging: wlags49_h2: remove direct declarations of KERN_<LEVEL> prefixes
Use the standard KERN_<LEVEL> #defines instead of "<.>"
Signed-off-by: Joe Perches <joe@perches.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Henk de Groot <pe1dnn@amsat.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Devendra Naga [Tue, 5 Jun 2012 19:42:06 +0000 (01:12 +0530)]
staging/wlan-ng: prsim2fw.c coding style cleanup
this patch fixes the coding style problems found by using checkpatch.pl
drivers/staging/wlan-ng/prism2fw.c:175: ERROR: "foo * bar" should be "foo *bar"
drivers/staging/wlan-ng/prism2fw.c:210: WARNING: line over 80 characters
drivers/staging/wlan-ng/prism2fw.c:596: WARNING: line over 80 characters
drivers/staging/wlan-ng/prism2fw.c:658: ERROR: "foo * bar" should be "foo *bar"
Devendra Naga [Tue, 5 Jun 2012 19:40:50 +0000 (01:10 +0530)]
staging/wlan-ng: cfg80211.c coding style cleanup
there are warnings that are reported by checkpatch.pl
fixed the following problems
drivers/staging/wlan-ng/cfg80211.c:130: WARNING: line over 80 characters
drivers/staging/wlan-ng/cfg80211.c:366: WARNING: line over 80 characters
drivers/staging/wlan-ng/cfg80211.c:543: WARNING: line over 80 characters
drivers/staging/wlan-ng/cfg80211.c:665: WARNING: line over 80 characters
drivers/staging/wlan-ng/cfg80211.c:692: WARNING: line over 80 characters
drivers/staging/wlan-ng/cfg80211.c:735: WARNING: line over 80 characters
Adnan Ali [Tue, 29 May 2012 14:21:20 +0000 (15:21 +0100)]
Staging: rts5139: sd_cprm: fix coding style and deprecation issues
This commit fixes coding style and deprecation issues which
includes long lines, braces with single statments in if condition
and deprecated min() function.
Signed-off-by: Adnan Ali <adnan.ali@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Julia Lawall [Wed, 6 Jun 2012 21:41:36 +0000 (23:41 +0200)]
drivers/staging/comedi/drivers/me4000.c: adjust suspicious bit operation
TRIG_ROUND_NEAREST is 0, so a bit-and with it is always false. The
value TRIG_ROUND_MASK covers the bits of the TRIG_ROUND constants, so
first pick those bits and then make the test using ==.
The same is done for TRIG_ROUND_UP for symmetry, even though bit-and would
be sufficient in this case.
This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Make the comedi sysfs functions a bit more concise by shortening
some of the verbose variable names and reusing some of the
variables that were used for intermediate calculations.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Mori Hess <fmhess@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This code is used by some combination of the CONFIG_COMEDI_DAS08_CS,
CONFIG_COMEDI_DAS08_ISA, and CONFIG_COMEDI_DAS08_PCI and contains a lot
of conditional compilation.
Remove most of the conditional compilation, relying on the compiler to
optimize out unused static functions and data. Use the '__maybe_unused'
tag for those functions that cause compiler warnings as a result of
this.
Also change the DO_COMEDI_DRIVER_REGISTER macro from a conditionally
defined macro to a manifest constant macro to allow it to be tested
outside the preprocessor (although this is not currently needed).
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Bolle [Fri, 8 Jun 2012 10:22:46 +0000 (12:22 +0200)]
staging: Delete if_strip.h
Commit f80a3f62383bf673c310926d55142d51f118926d ("Staging: strip: delete
the driver") left if_strip.h unused: nothing in the tree includes it
anymore. It is still exported, but since nothing in the kernel uses
struct MetricomAddress, that seems pointless. Delete this header too.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Minchan Kim [Fri, 8 Jun 2012 06:39:27 +0000 (15:39 +0900)]
staging: zram: remove special handle of uncompressed page
xvmalloc can't handle PAGE_SIZE page so that zram have to
handle it specially but zsmalloc can do it so let's remove
unnecessary special handling code.
Quote from Nitin
"I think page vs handle distinction was added since xvmalloc could not
handle full page allocation. Now that zsmalloc allows full page
allocation, we can just use it for both cases. This would also allow
removing the ZRAM_UNCOMPRESSED flag. The only downside will be slightly
slower code path for full page allocation but this event is anyways
supposed to be rare, so should be fine."
2. change pages_expand with bad_compress so it can count
bad compression(above 75%) ratio.
3. remove zobj_header which is for back-reference for defragmentation
because firstly, it's not used at the moment and zsmalloc can't handle
bigger size than PAGE_SIZE so zram can't do it any more without redesign.
Minchan Kim [Fri, 8 Jun 2012 06:39:26 +0000 (15:39 +0900)]
staging: zram: fix random data read
fd1a30de makes a bug that it uses (struct page *) as zsmalloc's handle
although it's a uncompressed page so that it can access random page,
return random data or even crashed by get_first_page in zs_map_object.
Minchan Kim [Fri, 8 Jun 2012 06:39:25 +0000 (15:39 +0900)]
staging: zsmalloc: zsmalloc: use unsigned long instead of void *
We should use unsigned long as handle instead of void * to avoid any
confusion. Without this, users may just treat zs_malloc return value as
a pointer and try to deference it.
This patch passed compile test(zram, zcache and ramster) and zram is
tested on qemu.
changelog
* from v2
- remove hval pointed out by Nitin
- based on next-20120607
* from v1
- change zcache's zv_create return value
- baesd on next-20120604
Cc: Dan Magenheimer <dan.magenheimer@oracle.com> Acked-by: Seth Jennings <sjenning@linux.vnet.ibm.com> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Minchan Kim <minchan@kernel.org> Acked-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Andy Gross [Thu, 24 May 2012 16:43:32 +0000 (11:43 -0500)]
staging: omapdrm: Fix error paths during dmm init
Failures during the dmm probe can cause the kernel to crash. Moved
the spinlock to a global and moved list initializations immediately
after the allocation of the dmm private structure.
Signed-off-by: Andy Gross <andy.gross@ti.com> Reviewed-by: Rob Clark <rob.clark@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Miguel Gómez [Thu, 7 Jun 2012 08:24:56 +0000 (10:24 +0200)]
Staging: ipack/devices/ipoctal: remove error_flag field from ipoctal struct.
Remove the error_flag field from the ipoctal structure, as the error code
is handled through the tty abstraction. Remove the values definition as well.
Signed-off-by: Miguel Gómez <magomez@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The configuration of the communication channel is handled by the tty
abstraction, so the ipoctal_config structure has become useless and it's
only used to store values that are never accesed. Remove it.
Signed-off-by: Miguel Gómez <magomez@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The raw data reading process (ak8975_read_axis) sets the
single measurement mode to take a sample and once the
conversion is completed the device enters into power-down
mode automatically, therefore there is no need to enable
a flag for this to happen.
iio: iio_enum_available_read: Prevent possible buffer overflow
Use scnprint instead of snprintf, because snprintf returns the number of bytes
that would have been written to the buffer if there was enough space, and as a
result writing to buf[len-1] might cause a access beyond the buffers limits.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Staging: ipack/devices/ipoctal: avoid kernel oops when uninstalling
When uninstalling a device, there is a loop of calls that produces, at the end,
two calls to __ipoctal_remove() function with the same ipack_device argument.
The first time works fine, but the second will fail in tty_unregister_driver()
To avoid this situation, the call to __ipoctal_remove() it is done only from the
ipack bus driver and not from the ipack device driver.
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Staging: ipack: delete the call to remove() in ipack_driver_register
When a bus driver calls ipack_driver_register(), it should manages the returning
NULL value to undo all the operations it did before this call, and print the
corresponding trace.
It is not a task for the ipack driver to call the remove() function here.
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Staging: ipack/bridges/tpci200: removed check of tpci200->slots[dev->slot].dev
When ipack_device_register() is called, the variable
tpci200->slots[dev->slot].dev has not assigned a value and it gives an error
when the mezzanine driver is reading a register from the board for the match()
function, as all the I/O functions call check_slot().
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To perform the installation of a mezzanine it was needed to write on these
files, now it is not needed at all as the device model is properly implemented.
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The IIO DAC drivers are in a reasonably good shape. They all make use of channel
spec and non of them provides non-documented sysfs attributes. Code style should
be OK as well, both checkpatch and coccicheck only report trivial issues.
staging:iio:dac:ad5791: Move private structs and defines from header to C file
The header for this driver contains some private structs and defines, which do
not have to be shared between multiple source files, as well as the platform
data struct for this driver, which has to be shared with other source files.
Since there is no need to expose those private structs and defines move them to
the source file.