Merge tag 'iio-for-3.11b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Second round of IIO new stuff and cleanups for the 3.11 cycle.
1) Pressure sensor support in the st sensors driver - LPS331AP currently.
2) Graduation of generic interrupt from staging with some related cleanup.
3) A number of platform_set_drvdata on remove removals.
4) 2 conditional build changes to prevent device tree structures from being
built in when device tree isn't enabled. These just save a bit of space
rather than being strictly required at the moment.
5) A couple of strict_strtoul -> kstrtoul conversions.
iio:trigger:interrupt fix formatting of rsize variable in name
The name includes irq_res->start which of type resource_size_t not integer.
We could in theory use %pa for this but then it would be in hex and also
that causes a warning about incorrect types anyway. Hence just
use the irq local variable we assigned the line above.
Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Aldo Iljazi [Thu, 6 Jun 2013 19:52:12 +0000 (22:52 +0300)]
Staging: ft1000-pcmcia: ft1000_dnld.c: fixed four checkpatch
Fixed four checkpatch error complains, specifically:
ft1000_dnld.c:512: ERROR: space prohibited after that '&' (ctx:WxW)
ft1000_dnld.c:514: ERROR: space prohibited after that '&' (ctx:WxW)
ft1000_dnld.c:694: ERROR: space prohibited before that close parenthesis ')'
ft1000_dnld.c:713: ERROR: space prohibited before that close parenthesis ')'
Jiang Liu [Thu, 6 Jun 2013 16:07:31 +0000 (00:07 +0800)]
zram: use atomic64_xxx() to replace zram_stat64_xxx()
Use atomic64_xxx() to replace open-coded zram_stat64_xxx().
Some architectures have native support of atomic64 operations,
so we can get rid of the spin_lock() in zram_stat64_xxx().
On the other hand, for platforms use generic version of atomic64
implement, it may cause an extra save/restore of the interrupt
flag. So it's a tradeoff.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiang Liu [Thu, 6 Jun 2013 16:07:30 +0000 (00:07 +0800)]
zram: optimize memory operations with clear_page()/copy_page()
Some architectures provides architecture-specific, optimized version of
clear_page()/copy_page(), which may have better performance than
memset()/memcpy(). So use clear_page()/copy_page() to optimize zram
performance if possible.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiang Liu [Thu, 6 Jun 2013 16:07:26 +0000 (00:07 +0800)]
zram: avoid access beyond the zram device
Function valid_io_request() should verify the entire request are within
the zram device address range. Otherwise it may cause invalid memory
access when accessing/modifying zram->meta->table[index] because the
'index' is out of range. Then it may access non-exist memory, randomly
modify memory belong to other subsystems, which is hard to track down.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiang Liu [Thu, 6 Jun 2013 16:07:24 +0000 (00:07 +0800)]
zram: destroy all devices on error recovery path in zram_init()
On error recovery path of zram_init(), it leaks the zram device object
causing the failure. So change create_device() to free allocated
resources on error path.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Acked-by: Minchan Kim <minchan@kernel.org> Acked-by: Jerome Marchand <jmarchan@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiang Liu [Thu, 6 Jun 2013 16:07:23 +0000 (00:07 +0800)]
zram: use zram->lock to protect zram_free_page() in swap free notify path
zram_slot_free_notify() is free-running without any protection from
concurrent operations. So there are race conditions between
zram_bvec_read()/zram_bvec_write() and zram_slot_free_notify(),
and possible consequences include:
1) Trigger BUG_ON(!handle) on zram_bvec_write() side.
2) Access to freed pages on zram_bvec_read() side.
3) Break some fields (bad_compress, good_compress, pages_stored)
in zram->stats if the swap layer makes concurrently call to
zram_slot_free_notify().
So enhance zram_slot_free_notify() to acquire writer lock on zram->lock
before calling zram_free_page().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jiang Liu [Thu, 6 Jun 2013 16:07:22 +0000 (00:07 +0800)]
zram: avoid invalid memory access in zram_exit()
Memory for zram->disk object may have already been freed after returning
from destroy_device(zram), then it's unsafe for zram_reset_device(zram)
to access zram->disk again.
We can't solve this bug by flipping the order of destroy_device(zram)
and zram_reset_device(zram), that will cause deadlock issues to the
zram sysfs handler.
So fix it by holding an extra reference to zram->disk before calling
destroy_device(zram).
Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Use a local variable for the 'reg' offset that is stored in the
comedi_subdevice 'private' pointer to minimize the number of casts.
Also, add local variables for the 'mask' and 'bits'.
The outputs only need to be updated if the 'mask' indicates that the
'bits' are changing. Move the update code into the main 'if (mask)'
block.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: pcmad: properly handle analog input encoding configuration
The comedi_config utility is used to attach to this board. One of the
configuration options passed by the user sets the analog input encoding
for straight binary or two's complement data. The hardware produces
straight binary data when jumpered for 5V unipolar inputs and two's
complement data when jumpered for +-10V bipolar inputs.
Use the configuration option to correctly set the comedi_subdevice
range_table.
We can then use a helper function to determine what the range is when
reading the analog inputs. This allows removing the 'twos_comp' variable
from the private data (which was actually never used).
Since the private data is now empty, remove it completely.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The comedi_config utility is used to attach to this board. One of the
configuration options passed by the user sets the analog input reference
for single-ended or differential inputs.
Use the configuration option to correctly set the comedi_subdevice flags
as well as the number of channels.
Remove the 'differential' variable from the private data. Its not used
by the 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>
staging: comedi: pcmad: remove need for boardinfo in pcmad_ai_insn_read()
The const boardinfo pointer is only used in this function to work out
the value needed to convert the data to its twos complement. Use the
comedi_subdevice 'maxdata' to do this conversion and remove the 'board'
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>
read_nic_*() functions are defined in r8192U_core.c.
They call internally usb_control_msg() to read the
nic registers and return the value read.
Following a remark made by Dan Carpenter, if usb_control_msg()
fails, the value returned will be invalid.
To accommodate for this, this patch changes the functions
to take a pointer as argument to set the value read and
return 0 on success and the error status on failure, so
that callers of read_nic_*() can check the return status.
Some other fixes introduced in read_nic_*() functions are:
The expressions (1<<EPROM_*_SHIFT) used to address and set
the individual bits of the eeprom register were replaced
with EPROM_*_BIT bitmasks to make the code more intuitive.
EPROM_*_BIT bitmasks were defined in r8192U_hw.h and
EPROM_*_SHIFT were removed.
In netdev_err(), which is called in case of failure,
the hardcoded function name in the error log message was
replaced with __func__ to reduce line size.
Also, from the error log message, it was omitted the word
"Timeout" and it is just reported the error code since the
failure can not only be due to timeout expiration but also
due to a memory allocation failure. In case of timeout
expiration, usb_start_wait_urb() prints an appropriate log
message when debug is enabled.
Finally, some minor fixes to the coding style were applied in
lines affected by the above changes, including the removal
of ifdef DEBUG_RX (the debugging of reads and writes of the
nic registers shall be done with explicit check on their
return status which will be added in a follow on patch).
Dan Carpenter [Thu, 6 Jun 2013 07:30:49 +0000 (10:30 +0300)]
Staging: rtl8192u: fix a reversed test
Sean MacLennan fixed this in the rtl8192e driver and we should fix
it here as well.
It's pretty harmless. This information comes from the firmware, if
we were to hit this bug we would read beyond the end of the array
once or twice before returning and update our statistics with bogus
data.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Lawniczak [Thu, 6 Jun 2013 16:10:47 +0000 (18:10 +0200)]
keucr: migrate printk to dev_dbg/info/warn/err
as per suggestion of checkpatch.pl; this resolves warnings like "Prefer
netdev_info .. then dev_info .. to printk".
Changed signature of function usb_stor_print_cmd in init.c to enable
usage of dev_err
Signed-off-by: Laura Lawniczak <laura.lawniczak@googlemail.com> Signed-off-by: Johannes Schilling <of82ecuq@cip.cs.fau.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Thu, 6 Jun 2013 14:59:13 +0000 (22:59 +0800)]
staging/lustre/libcfs: cleanup linux-crypto
We don't need to implement crc32 and crc32pclmul on our own.
The crc32-pclmul support was merged into the 3.8 kernel in commit 78c37d1, no need to keep a local copy in Lustre anymore.
The crc32 implementation is identical to crypto-crc32. So drop
Lustre's private implementation and select kernel crypto in Kconfig.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Peng Tao <tao.peng@emc.com> Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: rtl8192u: replace macro rx_hal_is_cck_rate() in r8192U_core.c
This patch replaces macro rx_hal_is_cck_rate() with
the static inline function rx_hal_is_cck_rate().
This replacement was suggested by Dan Carpenter and
has the following benefits:
- improves code readability
- guarantees type safety
- improves code efficiency by enforcing the evaluation of
the simple boolean expression (!pdrvinfo->RxHT) to be
done before the evaluation of the more complex one
(pdrvinfo->RxRate == DESC90_RATE1M ||
pdrvinfo->RxRate == DESC90_RATE2M ||
pdrvinfo->RxRate == DESC90_RATE5_5M ||
pdrvinfo->RxRate == DESC90_RATE11M)
staging: rtl8192u: add spaces around ?:&&|| in r8192U_core.c
This patch fixes the following checkpatch errors:
ERROR: spaces required around that '?'
ERROR: spaces required around that ':'
ERROR: spaces required around that '&&'
ERROR: spaces required around that '||'
staging: comedi: pcmda12: rename the analog output (*insn_{read, write}) functions
For aesthetic reasons. rename these functions so they have namespace
associated with the driver. Also remove the unnecessary '&' when setting
the callbacks.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
'BITS' is a pretty generic name for a define. It's only used in
the board attach to set the subdevice 'maxdata' so instead of
renaming the define just open code the value and remove the define.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Refactor this function into two new functions in order to reduce the indent
levels and clean up the ugly line breaks that, unsuccessfully, try to keep
the lines < 80 chars.
The first function handles the irq for a specific asic.
The second function handles the irq for a specific subdevice that is
associated with the asic.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ben Chan [Tue, 4 Jun 2013 05:55:38 +0000 (22:55 -0700)]
staging: gdm72xx: WIMAX_GDM72XX should depend on either USB or MMC
The gdm72xx driver needs to have either the USB or SDIO implementation
enabled to provide useful functionalities, so the driver should depend
on either USB or MMC. This patch makes WIMAX_GDM72XX depend on either
USB or MMC.
Also, WIMAX_GDM72XX needs to be built as a module if its dependent
interface, either USB or MMC, is built as a module. This patch enforces
that in the WIMAX_GDM72XX_USB and WIMAX_GDM72XX_SDIO dependency.
Reported-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Ben Chan <benchan@chromium.org> Cc: Sage Ahn <syahn@gctsemi.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>