Binoy Jayan [Mon, 22 Aug 2016 04:39:42 +0000 (10:09 +0530)]
rtl8712: pwrctrl_priv: Replace semaphore lock with mutex
The semaphore 'lock' in 'pwrctrl_priv' is used as a simple mutex, so it
should be written as one. Semaphores are going away in the future.
_enter_pwrlock was using down_interruptible(), so the lock could be broken
by sending a signal. This could be a bug, because nothing checks the return
code here. Hence, using mutex_lock instead of the interruptible version.
Removing the now unused _enter_pwrlock and _down_sema.
Check for ethtool_ops structures that are only stored in the ethtool_ops
field of a net_device structure or passed as the second argument to
netdev_set_default_ethtool_ops. These contexts are declared const, so
ethtool_ops structures that have these properties can be declared as const
also.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
Oleg Drokin [Thu, 25 Aug 2016 17:50:59 +0000 (13:50 -0400)]
staging/lustre: Fix max_dirty_mb output in sysfs
%ul definitely was supposed to be %lu in the format string,
so we print long unsigned int value, not just unsigned int
with a letter l added at the end.
Arnd Bergmann [Mon, 29 Aug 2016 12:20:01 +0000 (14:20 +0200)]
staging: lustre: hide unused variable
After a code cleanup, we get a harmless warning about a variable
that is unused when CONFIG_FS_POSIX_ACL is disabled:
drivers/staging/lustre/lustre/llite/xattr.c: In function 'll_xattr_get_common':
drivers/staging/lustre/lustre/llite/xattr.c:312:24: error: unused variable 'lli' [-Werror=unused-variable]
This puts the variable declaration into the same #ifdef.
Arnd Bergmann [Mon, 29 Aug 2016 12:20:00 +0000 (14:20 +0200)]
staging: lustre: fix unstable pages tracking
A patch to change to page accounting code (in v4.8-rc1) conflicts with
a change to lustre (in staging-next for v4.9), and fortunately gets
detected using a gcc warning:
In file included from /git/arm-soc/include/linux/mm.h:1001:0,
from /git/arm-soc/include/linux/highmem.h:7,
from /git/arm-soc/drivers/staging/lustre/lustre/osc/../../include/linux/libcfs/linux/libcfs.h:46,
from /git/arm-soc/drivers/staging/lustre/lustre/osc/../../include/linux/libcfs/libcfs.h:36,
from /git/arm-soc/drivers/staging/lustre/lustre/osc/osc_cl_internal.h:45,
from /git/arm-soc/drivers/staging/lustre/lustre/osc/osc_page.c:40:
drivers/staging/lustre/lustre/osc/osc_page.c: In function 'unstable_page_accounting':
include/linux/vmstat.h:117:2: error: array subscript is above array bounds [-Werror=array-bounds]
atomic_long_add(x, &vm_zone_stat[item]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:117:2: error: array subscript is above array bounds [-Werror=array-bounds]
atomic_long_add(x, &vm_zone_stat[item]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This changes the function to use the correct interface for accounting in the
"node" rather than the "zone".
Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: d806f30e639b ("staging: lustre: osc: revise unstable pages accounting") Fixes: 11fb998986a7 ("mm: move most file-based accounting to the node") Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Currently it is not possible to send LNet traffic between
two nodes using infiniband hardware that have different
page sizes for the case when RDMA fragments are used.
When two nodes establish a connection they tell the other
node the maximum number of RDMA fragments they support.
The issue is that the units are pages, and 256 64K pages
corresponds to 16MB of data, whereas a 4K page system is
limited to messages with 1MB of data. The solution is to
report over the wire the maximum number of fragments in
4K unites regardless of the native page size. The recipient
then uses its native page size to translate into the
maximum number of pages sized fragments it can send to
the other node.
staging/lustre/llite: changes to avoid cache corruption
ll_find_alias is responsible for getting alias for inode
which can be reused. Directories are assumed to have unique
alias, where in case of non-directories there can be multiple
aliases. In case of lustre there can be two type of aliases
i.e. discon_alias and invalid_alias. Usage of discon_alias in
case of non-directories may corrupt dcache and leads to kernel
crash. Changes made to avoid use of discon_alias in case of
non-directories.
staging/lustre: avoid clearing i_nlink for inodes in use
The patch removes find_cbdata callbacks and clear_nlink
from dentry_iput path, since this piece of code makes
a few races possible.
The test case reproduces one of the possible races
described in LU-7925:
1) two hard links are created for the same file
2) the test calls stat(2) for link #1
3) in the middle of 2) the test opens and closes link #2
4) in the middle of 2) the test drops the ldlm locks and
forces dentry reclaim via vm.drop_caches=2
5) in the middle of 2) ll_d_iput() clears i_nlink for
the inode
6) the initial stat(2) continues and copies the wrong
i_nlink value into st_nlink
Signed-off-by: Andrew Perepechko <andrew.perepechko@seagate.com>
Seagate-bug-id: MRP-3271
Reviewed-on: http://review.whamcloud.com/19164
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7925 Reviewed-by: Wally Wang <wang@cray.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alexander Boyko [Wed, 24 Aug 2016 15:11:52 +0000 (11:11 -0400)]
staging/lustre/mdc: fix panic at mdc_free_open()
Assertion was happened for open request when rq_replay is set
to 1.
ASSERTION(mod->mod_open_req->rq_replay == 0)
But this situation is not fatal for client, and could happened
when mdc_close() failed.
The fix allow to free such requests. If mdc_close fail, MDS doesn`t
receive close request from client. And in a worst case client would
be evicted.
The test recreates issue when mdc_close failed and
client asserts:
ASSERTION( mod->mod_open_req->rq_replay == 0 ) failed
Signed-off-by: Alexander Boyko <alexander.boyko@seagate.com>
Seagate-bug-id: MRP-3156
Reviewed-on: http://review.whamcloud.com/17495
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5282 Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Daeseok Youn [Mon, 22 Aug 2016 01:43:59 +0000 (10:43 +0900)]
staging: dgnc: check the type of print before calling
The dgnc_maxcps_room() function must be called only for print device.
The if-statement for checking print device checks before calling
dgnc_maxcps_room() and also this function doesn't need to have any
data except channel_t.
The function icn_writecmd() was used to copy from userspace and also
from the kernelspace. Add another argument to the function to have two
separate pointers, one for the userspace and one for the kernelspace.
Based on the value of user as passed from the caller we use one of
the two pointers.
Sudip Mukherjee [Mon, 22 Aug 2016 16:34:55 +0000 (22:04 +0530)]
staging: i4l: act2000: remove unused macro
The macro EVAL_PLCI and MAKE_PLCI are not being used. Remove them.
But keep the comment preceding them as it contains information
regarding message format.
Sudip Mukherjee [Mon, 22 Aug 2016 16:34:54 +0000 (22:04 +0530)]
staging: i4l: act2000: remove unused argument
The macro EVAL_NCCI was only being used in capi.c and the argument
controller was not used. Remove the argument and at the same time
remove the variable which now becomes unused.
Sudip Mukherjee [Tue, 23 Aug 2016 14:13:21 +0000 (19:43 +0530)]
staging: i4l: icn: use memdup_user
Its better to use memdup_user which does the same thing which this
code has implemented. Also removed a related warning as we will be
warned if allocation fails.
Merge tag 'iio-for-4.9a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into work-testing
Jonathan writes:
First round of new features, device support and cleanups for IIO in the 4.9 cycle.
Device support
* ak8974
- New driver and bindings for this 2009 vintage magnetometer (it was very
popular back then!)
* atlas-ph-sensor
- ORP sensor support(I had to look up what one of these was)
* cio-dac
- New driver for Measurement Computing DAC boards
* dmard06
- New driver for Domintech DMARDO6 accelerometer. Also vendor prefix.
* dmard09
- New driver for Domintech DMARD09 accelerometer.
* maxim-thermocouple
- max6675 and max31855 new driver
* mt6577 auxdac
- new driver for this Mediatek chip mt2701, mt6577 and mt8173 have this
hardware.
* ti-adc161s626
- new driver for this TI single channel differential ADC.
* vcnl4000
- support vcnl4010 and vcnl4020 which are compatible for all features
currently supported by this driver.
New features
* Core
- Allow retrieving of underlying iio_dev from a callback buffer handle.
This is needed to allow client drivers to perform operations such as
configuring the trigger used.
* hid-sensors
- asynchronous resume support to avoid really long resume times.
* kxcjk-1013
- add the mysterious KIOX000A ACPI id seen in the wild.
* Tools
- lsiio now enumerates processed as well as raw channels.
Cleanup
* ad7298
- use iio_device_claim_direct_mode and friends to simplify locking around
mode switching and drop some boilerplate.
* ad7793
- use iio_device_claim_direct_mode and friends to simplify locking around
mode switching and drop some boilerplate.
* ade7854
- checkpatch fixups (alignment of parameters)
* atlas-ph-sensor
- use iio_device_claim_direct_mode and friends to simplify locking around
mode switching and drop some boilerplate.
- Switch to REGCACHE_NONE as there are no useful register to cache.
* bma180
- use iio_device_claim_direct_mode and friends to simplify locking around
mode switching and drop some boilerplate.
* hdc100x
- Add mention of the HDC1000 and HDC1008 to the Kconfig help text.
* isl29018
- Add driver specific prefixes to defines and function names.
- Remove excessive logging.
- Drop newlines which add nothing to readability.
- General tidying up of comments.
- Drop I2C_CLASS_HWMON as irrelevant to driver.
* isl29028
- Add driver specific prefixes to defines, enums and function names.
- Drop comma's from available attribute output as not ABI compliant.
- Drop I2C_CLASS_HWMON as irrelevant to driver.
* kxsd9
- devicetree bindings.
* mag3110
- This one wasn't locking to protect against mode switches during
raw_reads. Use the iio_claim_direct_mode function to fix this buglet.
* maxim-theromcouple
- Fix missing selects for triggered buffer support in Kconfig.
* nau7802
- Use complete instead of complete_all as only one completion at a time.
* sx9500
- Use complete instead of complete_all as only one completion at a time.
* us5182d
- Add a missing error code asignment instead of checking the result of
an already checked statement.
* vcnl4000
- Use BIT macro where appropriate.
- Refactor return codes in read_raw callback.
- Add some missing locking for concurrent accesses to the device.
James Simmons [Mon, 22 Aug 2016 16:57:43 +0000 (12:57 -0400)]
staging: lustre: mdc: fix NULL pointer dereference in mdc_adjust_dirpages
The function mdc_adjust_dirpages is only called on platforms which
don't have pages 4K in size which is why kbuild only reported this
for platforms like the Alpha. The problem was a typo in ordering of
variables in the beginning of a while loop. We were accessing the
dp pointer before it was kmapped.
Signed-off-by: James Simmons <jsimmons@infradead.org> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Some platforms power off sensor hubs during S3 suspend, which will require
longer time to resume. This hurts system resume time, so resume
asynchronously.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Zhiyong Tao [Thu, 18 Aug 2016 07:11:36 +0000 (15:11 +0800)]
iio: adc: mt2701: Add Mediatek auxadc driver for mt2701.
Add Mediatek auxadc driver based on iio.
It will register a device in iio and support iio.
So thermal can read auxadc channel to sample data by iio device.
It is tested successfully on mt2701 platform.
Mt8173 and mt6577 platforms are not tested.
But the expectation is compatible.
Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Zhiyong Tao [Thu, 18 Aug 2016 07:11:35 +0000 (15:11 +0800)]
dt-bindings: auxadc: Add binding document for Mediatek auxadc.
The commit adds the device tree binding documentation for the mediatek
auxadc found on Mediatek MT2701.
Thermal gets auxadc sample data by iio device.
So the commit changes auxadc device tree binding documentation from
/soc/mediatek/auxadc.txt to /iio/adc/mt6577_auxadc.txt.
Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Alison Schofield [Thu, 18 Aug 2016 16:09:00 +0000 (09:09 -0700)]
iio: magnetometer: mag3110: claim direct mode during raw reads
Driver was checking for direct mode but not locking it. Use
claim/release helper functions to guarantee the device stays
in direct mode during raw reads.
Signed-off-by: Alison Schofield <amsfield22@gmail.com> Cc: Daniel Baluta <daniel.baluta@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Quentin Lambert [Fri, 12 Aug 2016 14:15:18 +0000 (16:15 +0200)]
staging: rts5208/ms.c: add missing releases in mg_get_local_EKB and mg_get_ICV
mg_get_local_EKB and mg_get_ICV used to return with an error code before
releasing all resources. This patch add a jump to the appropriate label
ensuring that the resources are properly released before returning.
Colin Ian King [Thu, 14 Jul 2016 10:21:28 +0000 (11:21 +0100)]
staging: rtl8723au: hal: check BT_Active and BT_State with correct bit pattern
BT_Active and BT_State are being masked with 0x00ffffff so it the subsequent
comparisons with 0xffffffff are therefore a buggy check. Instead, check them
against 0x00ffffff.
Unfortunately I couldn't find a datasheet or hardware to see if 0xffffffff
is an expected invalid bit pattern that should be checked before BT_Active and
BT_State are masked with 0x00ffffff, so for now, this fix seems like the least
risky approach.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Nipun Gupta [Wed, 29 Jun 2016 17:14:39 +0000 (22:44 +0530)]
fsl-mc: add helper macro to determine if a device is of fsl_mc type
Add a helper macro to return if a device has a bus type of fsl_mc.
This makes the bus driver code more readable and provides a way for
drivers like the SMMU driver to easily check the bus type.
Binoy Jayan [Wed, 8 Jun 2016 07:40:55 +0000 (13:10 +0530)]
staging: r8723au: Remove unused semaphores
The semaphores xmit_sema, terminate_xmitthread_sema, tx_retevt and
io_req have no users, hence remove all references to them.
Semaphores are going away in the future.
Larry Finger [Sun, 5 Jun 2016 19:11:19 +0000 (14:11 -0500)]
staging: r8188eu: Fix scheduling while atomic splat
Commit fadbe0cd5292851608e2e01b91d9295fa287b9fe ("staging: rtl8188eu:
Remove rtw_zmalloc(), wrapper for kzalloc()") changed all allocation
calls to be GFP_KERNEL even though the original wrapper was testing
to determine if the caller was in atomic mode. Most of the mistakes
were corrected with commit 33dc85c3c667209c930b2dac5ccbc2a365e06b7a
("staging: r8188eu: Fix scheduling while atomic error introduced in
commit fadbe0cd"); however, two kzalloc calls were missed as the
call only happens when the driver is shutting down.
Larry Finger [Sun, 5 Jun 2016 15:20:59 +0000 (10:20 -0500)]
staging: r8188eu: Remove some false positives from kmemleak
When this driver preallocates some SKBs, kmemleak is unable to find that
allocated memory when it scans. When the driver is unloaded, that memory
is released; therefore, the report is a false positive.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Sat, 4 Jun 2016 01:17:37 +0000 (20:17 -0500)]
staging: r8712u: Handle some false positives from kmemleak
When this driver preallocates some URBs, kmemleak is unable to find that
allocated memory when it scans. When the driver is unloaded, that memory
is reclaimed, therefore, the report is a false positive.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Larry Finger [Sat, 4 Jun 2016 01:17:36 +0000 (20:17 -0500)]
staging: r8712u: Fix leak of skb
There are two types of messages queued for RX. The major type, which does
I/O on the device, was being handled properly. The skbs that communicated
with the firmware were being leaked.
While rewriting the code that sets up the skb, it was possible to remove
the private variable indicating that the old skb could be reused.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Compiling the rtlwifi drivers for ARM with gcc -Wextra warns about lots of
incorrect code that results from 'char' being unsigned here, e.g.
staging/rtl8192e/rtl8192e/r8192E_phy.c:1072:36: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtl8192e/r8192E_phy.c:1104:36: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtl8192e/rtl_core.c:1987:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtl8192e/rtl_dm.c:782:37: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192e/rtllib_softmac_wx.c:465:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]
This patch changes all uses of 'char' in this driver that refer to
8-bit integers to use 's8' instead, which is signed on all architectures.
Compiling the rtlwifi drivers for ARM with gcc -Wextra warns about lots of
incorrect code that results from 'char' being unsigned here, e.g.
staging/rtl8192u/r8192U_core.c:4150:16: error: comparison is always false due to limited range of data type [-Werror=type-limits]
staging/rtl8192u/r8192U_dm.c:646:50: error: comparison is always false due to limited range of data type [-Werror=type-limits]
This patch changes all uses of 'char' in this driver that refer to
8-bit integers to use 's8' instead, which is signed on all architectures.
Binoy Jayan [Mon, 6 Jun 2016 04:38:06 +0000 (10:08 +0530)]
rtl8188eu: pwrctrl_priv: Replace semaphore 'lock' with mutex
The semaphore 'lock' in pwrctrl_priv is a simple mutex, so it should
be written as one. Semaphores are going away in the future.
_enter_pwrlock was using down_interruptible(), so the lock could be broken
by sending a signal. This could be a bug, because nothing checks the return
code here. Hence, using mutex_lock instead of the interruptible version.
Also, remove the now unused wrappers _init_pwrlock, _enter_pwrlock,
_exit_pwrlock and _rtw_down_sema.
Colin Ian King [Mon, 15 Aug 2016 14:45:04 +0000 (15:45 +0100)]
staging: ks7010: don't print skb->dev->name if skb is null
A null pointer dereference will occur when skb is null and
skb->dev->name is printed. Replace the skb->dev->name with
plain text "ks_wlan" to fix this.
Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
wait_for_completion_interruptible_timeout return 0 on timeout and
-ERESTARTSYS if interrupted. The check for
!wait_for_completion_interruptible_timeout() would report an interrupt
as timeout. Further, while HZ/50 will work most of the time it could
fail for HZ < 50, so this is switched to msecs_to_jiffies(20).
Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository") Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>