Anton Vorontsov [Sat, 26 May 2012 13:20:22 +0000 (06:20 -0700)]
pstore/ram: Factor ramoops_get_next_prz() out of ramoops_pstore_read()
This will help make code clearer when we'll add support for other
message types.
The patch also changes return value from -EINVAL to 0 in case of
end-of-records. The exact value doesn't matter for pstore (it should
be just <= 0), but 0 feels more correct.
Anton Vorontsov [Sat, 26 May 2012 13:20:19 +0000 (06:20 -0700)]
pstore: Add console log messages support
Pstore doesn't support logging kernel messages in run-time, it only
dumps dmesg when kernel oopses/panics. This makes pstore useless for
debugging hangs caused by HW issues or improper use of HW (e.g.
weird device inserted -> driver tried to write a reserved bits ->
SoC hanged. In that case we don't get any messages in the pstore.
Therefore, let's add a runtime logging support: PSTORE_TYPE_CONSOLE.
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> Acked-by: Kees Cook <keescook@chromium.org> Acked-by: Colin Cross <ccross@android.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Anton Vorontsov [Sat, 26 May 2012 13:07:49 +0000 (06:07 -0700)]
pstore/ram: Should update old dmesg buffer before reading
Without the update, we'll only see the new dmesg buffer after the
reboot, but previously we could see it right away. Making an oops
visible in pstore filesystem before reboot is a somewhat dubious
feature, but removing it wasn't an intentional change, so let's
restore it.
For this we have to make persistent_ram_save_old() safe for calling
multiple times, and also extern it.
staging: comedi: Kconfig: cleanup depends on logic
All of the config options for comedi depend on COMEDI being
selected. Wrap everything in an 'if COMEDI/endif' block and
remove all the individual 'depends on COMEDI' in the Kconfig.
Also, remove the redundant && ISA/PCI/PCMCIA/USB for the if
blocks with those driver types.
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 check for PCI_SUPPORT_VER1
This symbol is not defined in the kernel. It appears to be left
over from the 2.4 kernel.
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>
Peter Meerwald [Fri, 8 Jun 2012 16:06:45 +0000 (18:06 +0200)]
iio: add mcp4725 I2C DAC driver
v5:
* fix warnings (Jonathan Cameron)
v4:
* remove unused indio_dev pointer in mcp4725_data (Jonathan Cameron)
* use u16 instead of unsigned short in mcp4725_data (Jonathan Cameron)
* #include mcp4725.h from linux/iio/dac/
v3:
* move from staging to drivers/iio
* switch to chan_spec
* dev_get_drvdata() -> dev_to_iio_dev()
* annotate probe() and remove() with __devinit and __devexit
v2 (based on comments from Jonathan Cameron and Lars-Peter Clausen):
* did NOT switch to chan_spec yet
* rebase to staging-next tree, update iio header locations
* dropped dac.h #include, not needed
* strict_strtol() -> kstrtol()
* call iio_device_unregister() in remove()
* everything in one patch
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter [Fri, 8 Jun 2012 06:54:32 +0000 (09:54 +0300)]
iio: frequency: adf4350: using an uninitialized variable
GCC complains that we use an uninitialized variable if the user passes
an invalid parameter to adf4350_read(). I decided that we should return
-EINVAL instead in that case.
However, when I looked up at adf4350_write() it returned -ENODEV for
that condition. In the end, I decided the -EINVAL was the right thing
and I change adf4350_write() to match.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sparse complains about this:
drivers/iio/frequency/adf4350.c:58:29: warning: Initializer entry defined twice
drivers/iio/frequency/adf4350.c:59:10: also defined here
It looks like '|' was intended here instead of ','.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Access the individual comedi_subdevices using a pointer instead
of directly accessing as an array. This is how the rest of the
comedi core accesses them.
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: 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>
staging:iio:ad7298: Fix linker error due to missing IIO kfifo buffer
The ad7298 drivers buffer implementation uses the IIO kfifo buffer, so it needs
to select IIO_KFIFO_BUF. Otherwise (if no other driver selects the symbol) the
following linker error will occur:
drivers/built-in.o: In function `ad7298_register_ring_funcs_and_init':
(.text+0x245cf2): undefined reference to `iio_kfifo_allocate'
drivers/built-in.o: In function `ad7298_register_ring_funcs_and_init':
(.text+0x245d7d): undefined reference to `iio_kfifo_free'
drivers/built-in.o: In function `ad7298_ring_cleanup':
(.text+0x245dcd): undefined reference to `iio_kfifo_free'
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>
Randy Dunlap [Mon, 11 Jun 2012 23:35:50 +0000 (16:35 -0700)]
staging/comedi: fix build for USB not enabled
Calls to optional subsystems cannot be made indiscriminately.
Enclose all of the usb helper functions inside
#if IS_ENABLED(CONFIG_USB)
to fix these build errors.
(The pci helper functions are OK since there are stubs in
linux/pci.h for the called functions when PCI is not enabled.
Possibly the same could be done for the called USB functions.)
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Frank Mori Hess <fmhess@users.sourceforge.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>