]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/log
mirror_ubuntu-zesty-kernel.git
7 years agostaging: vc04_services: add HAS_DMA dependancy
Greg Kroah-Hartman [Thu, 17 Nov 2016 08:39:59 +0000 (09:39 +0100)]
staging: vc04_services: add HAS_DMA dependancy

We need DMA for this, otherwise the build breaks, so fix this up.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Lee Jones <lee@kernel.org>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: clarify firmware dependency
Arnd Bergmann [Wed, 16 Nov 2016 15:39:06 +0000 (16:39 +0100)]
staging: vc04_services: clarify firmware dependency

The raspberrypi-firmware driver may be built as a loadable module,
which causes a link-time failure if the vc04_services driver is
built-in during compile-testing:

drivers/staging/vc04_services/vchiq.o: In function `vchiq_probe':
vchiq_connected.c:(.text.vchiq_probe+0x2c): undefined reference to `rpi_firmware_get'
drivers/staging/vc04_services/vchiq.o: In function `vchiq_platform_init':
vchiq_connected.c:(.text.vchiq_platform_init+0x1f0): undefined reference to `rpi_firmware_property'

This extends the dependency list to ensure the firmware is either
reachable, or completely disabled in case of compile-testing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: remove duplicate mutex_lock_interruptible
Arnd Bergmann [Wed, 16 Nov 2016 15:39:05 +0000 (16:39 +0100)]
staging: vc04_services: remove duplicate mutex_lock_interruptible

The driver tries to redefine mutex_lock_interruptible as an open-coded
mutex_lock_killable, but that definition clashes with the normal
mutex_lock_interruptible definition when CONFIG_DEBUG_LOCK_ALLOC
is set:

staging/vc04_services/interface/vchiq_arm/vchiq_killable.h:67:0: error: "mutex_lock_interruptible" redefined [-Werror]
 #define mutex_lock_interruptible mutex_lock_interruptible_killable
include/linux/mutex.h:161:0: note: this is the location of the previous definition

This simply removes the private implementation and uses the
normal mutex_lock_killable directly.

We could do the same for the down_interruptible_killable here, but
it's better to just remove the semaphores entirely from the driver,
which also takes care of that.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wilc1000: simplify vif[i]->ndev accesses
Arnd Bergmann [Wed, 16 Nov 2016 15:07:10 +0000 (16:07 +0100)]
staging: wilc1000: simplify vif[i]->ndev accesses

With gcc-7, I got a new warning for this driver:

wilc1000/linux_wlan.c: In function 'wilc_netdev_cleanup':
wilc1000/linux_wlan.c:1224:15: error: 'vif[1]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
wilc1000/linux_wlan.c:1224:15: error: 'vif[0]' may be used uninitialized in this function [-Werror=maybe-uninitialized]

A closer look at the function reveals that it's more complex than
it needs to be, given that based on how the device is created
we always get

netdev_priv(vif->ndev) == vif

Based on this assumption, I found a few other places in the same file
that can be simplified. That code appears to be a relic from times
when the assumption above was not valid.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge tag 'iio-for-4.10c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Wed, 16 Nov 2016 16:20:40 +0000 (17:20 +0100)]
Merge tag 'iio-for-4.10c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Third set of IIO new device support, features and cleanup for the 4.10 cycle.

Includes Peter Rosin's interesting drivers for a comparator. First complex
use we have had with an analog front end made from discrete components.

Brian Masney's work on moving the tsl2583 driver out of staging also
feature extensively!

New Drivers
* DAC based on a digital potentiometer
  - New driver for the use of a dpot as a DAC. Includes bindings and Axentia
  entry in vendor prefixes.
* Envelope detector baed on DAC and a comparator including device tree
  bindings.

Staging Graduation
* tsl2583.

Core new features
- Core provision for _available attributes.   This one had been stalled for
  a long time until Peter picked it up and ran with it!
- In kernel interface helpers to retrieve available info from channels.

Driver new features
* mcp4531
  - Add range of available raw values (used for the dpot dac driver).

Driver cleanups and fixes for issues introduced
* ad7766
  - Testing the wrong variable following devm_regulator_bulk_get introduced
  with the driver earlier in this cycle.
* ad9832
  - Fix a wrong ordering in the probe introduced in the previous set of
    patches.  A use before allocation bug.
* cros_ec_sensors
  - Testing for an error in a u8 will never work.
* mpu3050
  - Remove duplicate initializer for the module owner.
  - Add missing i2c dependency.
  - Inform the i2c mux core how it is used - step one in implifying device
  tree bindings.
* st-sensors
  - Get rid of large number of uninformative defines in favour of putting the
  constants where they are relevant. It is clear what they are from where
  they are used.
* tsl2583
  - Fix unused function warning when CONFIG_PM disabled and remove the
  ifdefs in favour of __maybe_unused.
  - Refactor taos_chip_on  to only read relevant registers.
  - Make sure calibscale and integration time are being set.
  - Verify chip is in ready to be used before calibration.
  - Remove some repeated checks for chip status (it's protected by a mutex
  so can't change until it's released)
  - Change current state storage from a tristate enum to a boolean seeing as
  only two values are actually used now.
  - Drop a redundant write to the control regiser in taos_probe (it's a noop)
  - Drop the FSF mailing address.
  - Clean up logging to not use hard coded function names (use __func__
  instead).
  - Cleanup up variable and function name prefixes.
  - Alignment of #define fixes.
  - Fix comparison between signed and unsigned integer warnings.
  - Add some newlines in favour of readability.
  - Combine the two sysfs ABI docs that somehow ended up in different places.
  - Fix multiline comment syntax.
  - Move a code block to inside an else statement as it makes more sense there.
  - Change tsl2583_als_calibrate to return 0 rather than a value nothing
  reads.
  - Drop some pointless brackets
  - Don't assume 32bit unsigned int.
  - Change to a per device instance lux table.
  - Add missing tsl2583 to the list of supported devices in the intro comments.
  - Improve commment on clearing of interrupts.
  - Drop some uninformative comments.
  - Drop a memset call that doesn't do anything useful any more.
  - Don't initialize some return variables that are always set.
  - Add Brian Masney as a module author after all these changes.

7 years agoStaging: ks7010: Use preffered kernel types
Punit Vara [Tue, 15 Nov 2016 12:57:23 +0000 (18:27 +0530)]
Staging: ks7010: Use preffered kernel types

Replace uint8_t, uint16_t and uint32_t with preferred kernel types
u8, u16 and u32 respectively suggested by checkpatch.pl

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: xgifb: vb_table.h Preferred space around
Walt Feasel [Tue, 15 Nov 2016 10:36:45 +0000 (05:36 -0500)]
staging: xgifb: vb_table.h Preferred space around

Make suggested modification from checkpatch in reference
to: CHECK: spaces preferred around that '+'

Signed-off-by: Walt Feasel <waltfeasel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: xgifb: vb_table.h Blank line after declarations
Walt Feasel [Tue, 15 Nov 2016 10:36:44 +0000 (05:36 -0500)]
staging: xgifb: vb_table.h Blank line after declarations

Make suggested modification from checkpatch in reference
to: CHECK: Please use a blank line after
function/struct/union/enum declarations

Signed-off-by: Walt Feasel <waltfeasel@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: ni_mio_common: remove variable 'dl' in ni_ai_insn_read()
Ian Abbott [Mon, 14 Nov 2016 20:16:23 +0000 (20:16 +0000)]
staging: comedi: ni_mio_common: remove variable 'dl' in ni_ai_insn_read()

In `ni_ai_insn_read()`, local variable `dl` is declared as `unsigned
long`, but `unsigned int` will do.  Get rid of it and use local variable
`d` instead.  (That used to be `unsigned short`, but has been `unsigned
int` since kernel version 3.18.)

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: ni_mio_common: fix E series ni_ai_insn_read() data
Ian Abbott [Mon, 14 Nov 2016 20:16:22 +0000 (20:16 +0000)]
staging: comedi: ni_mio_common: fix E series ni_ai_insn_read() data

Commit 0557344e2149 ("staging: comedi: ni_mio_common: fix local var for
32-bit read") changed the type of local variable `d` from `unsigned
short` to `unsigned int` to fix a bug introduced in
commit 9c340ac934db ("staging: comedi: ni_stc.h: add read/write
callbacks to struct ni_private") when reading AI data for NI PCI-6110
and PCI-6111 cards.  Unfortunately, other parts of the function rely on
the variable being `unsigned short` when an offset value in local
variable `signbits` is added to `d` before writing the value to the
`data` array:

d += signbits;
   data[n] = d;

The `signbits` variable will be non-zero in bipolar mode, and is used to
convert the hardware's 2's complement, 16-bit numbers to Comedi's
straight binary sample format (with 0 representing the most negative
voltage).  This breaks because `d` is now 32 bits wide instead of 16
bits wide, so after the addition of `signbits`, `data[n]` ends up being
set to values above 65536 for negative voltages.  This affects all
supported "E series" cards except PCI-6143 (and PXI-6143). Fix it by
ANDing the value written to the `data[n]` with the mask 0xffff.

Fixes: 0557344e2149 ("staging: comedi: ni_mio_common: fix local var for 32-bit read")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org>
----
Needs backporting to stable kernels 3.18 onwards.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: comedi: ni_mio_common: fix M Series ni_ai_insn_read() data mask
Ian Abbott [Mon, 14 Nov 2016 20:16:21 +0000 (20:16 +0000)]
staging: comedi: ni_mio_common: fix M Series ni_ai_insn_read() data mask

For NI M Series cards, the Comedi `insn_read` handler for the AI
subdevice is broken due to ANDing the value read from the AI FIFO data
register with an incorrect mask.  The incorrect mask clears all but the
most significant bit of the sample data.  It should preserve all the
sample data bits.  Correct it.

Fixes: 817144ae7fda ("staging: comedi: ni_mio_common: remove unnecessary use of 'board->adbits'")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: Added new line after declaration
Yamanappagouda Patil [Tue, 15 Nov 2016 08:40:47 +0000 (14:10 +0530)]
staging: rtl8192e: Added new line after declaration

Fixed checkpatch.pl "Missing a blank line after declarations" warnings.

Signed-off-by: Yamanappagouda Patil <goudapatilk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: rtl8192e: Fixed coding style wornings on Block comments.
Yamanappagouda Patil [Tue, 15 Nov 2016 08:24:53 +0000 (13:54 +0530)]
staging: rtl8192e: Fixed coding style wornings on Block comments.

Fixed checkpatch.pl warnings related to Block comments in
staging/rtl8192e/*.c files.

Signed-off-by: Yamanappagouda Patil <goudapatilk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: fsl-mc: include: mc: Kernel type 'int' preferred over 's16'
Shiva Kerdel [Tue, 15 Nov 2016 08:30:03 +0000 (09:30 +0100)]
Staging: fsl-mc: include: mc: Kernel type 'int' preferred over 's16'

After following a discussion about the used integer types Dan Carpenter
pointed out that 'int' types should be used over the current change to
's16'. The reason for this is to have an upper bound instead of overflowing
the 's16' so we could still remove devices.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Suggested-by: Stuart Yoder <stuart.yoder@nxp.com>
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: mdc: manage number of modify RPCs in flight
Gregoire Pichon [Thu, 10 Nov 2016 15:51:13 +0000 (10:51 -0500)]
staging: lustre: mdc: manage number of modify RPCs in flight

This patch is the main client part of a new feature that supports
multiple modify metadata RPCs in parallel. Its goal is to improve
metadata operations performance of a single client, while maintening
the consistency of MDT reply reconstruction and MDT recovery
mechanisms.

It allows to manage the number of modify RPCs in flight within
the client obd structure and to assign a virtual index (the tag) to
each modify RPC to help server side cleaning of reply data.

The mdc component uses this feature to send multiple modify RPCs
in parallel.

Signed-off-by: Gregoire Pichon <gregoire.pichon@bull.net>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5319
Reviewed-on: http://review.whamcloud.com/14374
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: hsm: Use file lease to implement migration
Henri Doreau [Thu, 10 Nov 2016 17:30:31 +0000 (12:30 -0500)]
staging: lustre: hsm: Use file lease to implement migration

Implement non-blocking migration based on exclusive open instead of
group lock. Implemented exclusive close operation to atomically put
a lease, swap two layouts and close a file. This allows race-free
migrations.

Make the caller responsible for retrying on failure (EBUSY, EAGAIN)
in non-blocking mode.

In blocking mode, allow applications to trigger layout swaps using a
grouplock they already own, to prevent race conditions between the
actual data copy and the layout swap. Updated lfs accordingly. File
leases are also taken in blocking mode, so that lfs migrate can issue
a warning if an application attempts to open a file that is being
migrated and gets blocked.

Timestamps (atime/mtime) are set from userland, after the layout swap
is performed, to prevent conflicts with the grouplock.

lli_trunc_sem is taken/released in the vvp_io layer, under the DLM
lock. This re-ordering fixes the original issue between truncate and
migrate.

Signed-off-by: Henri Doreau <henri.doreau@cea.fr>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4840
Reviewed-on: http://review.whamcloud.com/10013
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lnet: add offset for selftest brw
Liang Zhen [Thu, 10 Nov 2016 17:31:04 +0000 (12:31 -0500)]
staging: lustre: lnet: add offset for selftest brw

In current lnet selftest, both client and server side bulk have
no offset and we can only test page aligned IO, this patch changed
this:

- user can set brw offset by lst add_test ... brw off=OFFSET ...
- offset is only effective on client side so far
- to simply implementation, offset needs to be eight bytes aligned

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5718
Reviewed-on: http://review.whamcloud.com/12496
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lmv: lock necessary part of lmv_add_target
wang di [Thu, 10 Nov 2016 17:30:38 +0000 (12:30 -0500)]
staging: lustre: lmv: lock necessary part of lmv_add_target

Release lmv_init_mutex once the new target is added
into lmv_tgt_desc, so lmv_obd_connect will not be
serialized.

New target should be allowed to added to fld client
lists, so FLD can always choose new added target to
do the FLD lookup request, and also remove some noise
error messages in this process.

Signed-off-by: wang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6713
Reviewed-on: http://review.whamcloud.com/15269
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: ptlrpc: mbits is sent within ptlrpc_body
Liang Zhen [Thu, 10 Nov 2016 17:30:33 +0000 (12:30 -0500)]
staging: lustre: ptlrpc: mbits is sent within ptlrpc_body

ptlrpc is using rq_xid as matchbits of bulk data, which means it
has to change rq_xid for bulk resend to avoid several bulk data
landing into the same buffer from different resends.

This patch uses one of reserved __u64 of ptlrpc_body to transfer
mbits to peer, matchbits is now separated from xid. With this change,
ptlrpc can keep rq_xid unchanged on resend, it only updates matchbits
for bulk data.

This protocol change is only applied if both sides of connection have
OBD_CONNECT_BULK_MBITS, otherwise, ptlrpc still uses old approach and
update xid while resending bulk.

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3534
Reviewed-on: http://review.whamcloud.com/15421
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: obd: rename obd_unpackmd() to md_unpackmd()
John L. Hammond [Thu, 10 Nov 2016 17:30:32 +0000 (12:30 -0500)]
staging: lustre: obd: rename obd_unpackmd() to md_unpackmd()

obd_unpackmd() is only implemented by LMV so move it from OBD
operations to OBD MD operations and update the prototype to reflex
the actual usage. Remove the unused function obd_free_memmd().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5814
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-on: http://review.whamcloud.com/13737
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: clio: get rid of cl_req
Jinshan Xiong [Thu, 10 Nov 2016 17:30:42 +0000 (12:30 -0500)]
staging: lustre: clio: get rid of cl_req

Implement cl_req_attr_set with a cl_object operation.
Get rid of cl_req and related function and data structures.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6943
Reviewed-on: http://review.whamcloud.com/15833
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: llite: tar restore fails for HSM released files.
Aditya Pandit [Thu, 10 Nov 2016 17:30:45 +0000 (12:30 -0500)]
staging: lustre: llite: tar restore fails for HSM released files.

If you create a file, archive and release it, it keeps only a
link and all information in xattr. If you tar the file
with --xattr you will store the same striping information and link
information in the tar. If you delete the file, the file and archive
state does not make sense. Now if you restore the file using tar
with xattr having the RELEASED flag turned on, then it is not correct
because this is a new file. Hence ignoring the HSM xattr and masking
out the "RELEASED" flag for the files, which are not archived.

Signed-off-by: Aditya Pandit <panditadityashreesh@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6214
Reviewed-on: http://review.whamcloud.com/16060
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lmv: revalidate the dentry for striped dir
wang di [Thu, 10 Nov 2016 17:30:40 +0000 (12:30 -0500)]
staging: lustre: lmv: revalidate the dentry for striped dir

If there are bad stripe during striped dir revalidation,
most likely due the race between close(unlink) and
getattr, then let's revalidate the dentry, instead of
return error, like normal directory.

Signed-off-by: wang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6831
Reviewed-on: http://review.whamcloud.com/15720
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7078
Reviewed-on: http://review.whamcloud.com/16382
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: obdclass: remove structure holes to reduce memory
Andreas Dilger [Thu, 10 Nov 2016 17:30:49 +0000 (12:30 -0500)]
staging: lustre: obdclass: remove structure holes to reduce memory

Fix the alignment of fields in commonly-used structures to reduce
memory usage on the client and server.  Structures fixed:

ptlrpc_reply_state: reduced by 8 bytes
obd_device:         reduced by 16 bytes
niobuf_local:       reduced by 8 bytes

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3281
Reviewed-on: http://review.whamcloud.com/16692
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: obd: Remove dead code in precleanup
Henri Doreau [Thu, 10 Nov 2016 17:30:47 +0000 (12:30 -0500)]
staging: lustre: obd: Remove dead code in precleanup

There used to be several pre-cleanup phases, but
only OBD_CLEANUP_EXPORTS is actually used.  Thus
remove the whole notion of precleanup phases.

Signed-off-by: Henri Doreau <henri.doreau@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7034
Reviewed-on: http://review.whamcloud.com/16061
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: ptlrpc: Move IT_* definitions to lustre_idl.h
Ben Evans [Thu, 10 Nov 2016 17:30:50 +0000 (12:30 -0500)]
staging: lustre: ptlrpc: Move IT_* definitions to lustre_idl.h

Put IT_* definitions into an enum, as they're sent over the wire,
adjust calls, print statements, etc. to use the new enum.

Signed-off-by: Ben Evans <bevans@cray.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6746
Reviewed-on: http://review.whamcloud.com/16228
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: misc: clean up DFID related error messages
Andreas Dilger [Thu, 10 Nov 2016 17:30:59 +0000 (12:30 -0500)]
staging: lustre: misc: clean up DFID related error messages

Improve the error messages related to DFID output and parsing
for usage in userspace.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1606
Reviewed-on: http://review.whamcloud.com/6156
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: osc: Remove remains of osc_ast_guard
Oleg Drokin [Thu, 10 Nov 2016 17:30:58 +0000 (12:30 -0500)]
staging: lustre: osc: Remove remains of osc_ast_guard

osc_ast_guard has been removed by the clio simplification.
Remove the last lock class definition.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7148
Reviewed-on: http://review.whamcloud.com/16392
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: idl: clean up file attribute flags
Andreas Dilger [Thu, 10 Nov 2016 17:31:05 +0000 (12:31 -0500)]
staging: lustre: idl: clean up file attribute flags

Remove unused file attribute flag LUSTRE_BFLAG_UNCOMMITTED_WRITES
that was used internally on the client at one point.

Add flags from the kernel which may be useful in the near future.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5017
Reviewed-on: http://review.whamcloud.com/10274
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: llite: lookup master inode by ilookup5_nowait
wang di [Thu, 10 Nov 2016 17:30:43 +0000 (12:30 -0500)]
staging: lustre: llite: lookup master inode by ilookup5_nowait

Do not lookup master inode by ilookup5, instead it should
use ilookup5_nowait, otherwise it will cause dead lock,

1. Client1 send chmod req to the MDT0, then on MDT0, it
   enqueues master and all of its slaves lock, (mdt_attr_set()
   ->mdt_lock_slaves()), after gets master and stripe0 lock,
   it will send the enqueue request(for stripe1) to MDT1, then
   MDT1 finds the lock has been granted to client2. Then MDT1
   sends blocking ast to client2.

2. At the same time, client2 tries to unlink the striped
   dir (rm -rf striped_dir), and during lookup, it will hold
   the master inode of the striped directory, whose inode state
   is NEW, then tries to revalidate all of its slaves,
   (ll_prep_inode()->ll_iget()->ll_read_inode2()->
   ll_update_inode().). And it will be blocked on the server
   side because of 1.

3. Then the client get the blocking_ast request, cancel the
   lock, but being blocked by ilookup5 in ll_md_blocking_ast(),
   because the inode state is still NEW.

Signed-off-by: wang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5344
Reviewed-on: http://review.whamcloud.com/16066
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: ptlrpc: race at req processing
Alexander Boyko [Thu, 10 Nov 2016 17:30:41 +0000 (12:30 -0500)]
staging: lustre: ptlrpc: race at req processing

Fix: 5c689e689baa ("staging/lustre/ptlrpc: race at req processing")
decreased the race window, but does not remove it. Disable rq_resend
right after MSG_REPLAY flag set. Import lock protects two threads
from race between set/clear MSG_REPLAY and rq_resend flags.

Signed-off-by: Alexander Boyko <alexander_boyko@xyratex.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5554
Xyratex-bug-id: MRP-1888
Reviewed-on: http://review.whamcloud.com/10735
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: nrs: serialize executions of nrs_policy_stop
Henri Doreau [Thu, 10 Nov 2016 17:30:44 +0000 (12:30 -0500)]
staging: lustre: nrs: serialize executions of nrs_policy_stop

Do not release nrs_lock in nrs_policy_stop0 to prevent op_policy_stop()
from being executed concurrently.

Signed-off-by: Henri Doreau <henri.doreau@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7096
Reviewed-on: http://review.whamcloud.com/16214
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: osc: osc_extent should hold refcount to osc_object
Jinshan Xiong [Thu, 10 Nov 2016 17:30:54 +0000 (12:30 -0500)]
staging: lustre: osc: osc_extent should hold refcount to osc_object

To avoid a race that osc_extent and osc_object destroy happens on the
same time, which causes kernel crash.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7164
Reviewed-on: http://review.whamcloud.com/16433
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: llite: clear dir stripe md in ll_iget
wang di [Thu, 10 Nov 2016 17:30:52 +0000 (12:30 -0500)]
staging: lustre: llite: clear dir stripe md in ll_iget

If ll_iget fails during inode initialization, especially
during striped directory lookup after creation failed,
then it should clear stripe MD before make_bad_inode(),
because make_bad_inode() will reset the i_mode, which
can cause ll_clear_inode() skip freeing those stripe MD.

Signed-off-by: wang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7230
Reviewed-on: http://review.whamcloud.com/16677
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: mgc: IR log failure should not stop mount
wang di [Thu, 10 Nov 2016 17:30:39 +0000 (12:30 -0500)]
staging: lustre: mgc: IR log failure should not stop mount

If clients or other targets can not get IR config lock
or lock, the mount should continue, instead of failing.
Because timeout mechanism will handle the recovery anyway.

Signed-off-by: wang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6906
Reviewed-on: http://review.whamcloud.com/15728
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: ldlm: improve lock timeout messages
John L. Hammond [Thu, 10 Nov 2016 17:30:53 +0000 (12:30 -0500)]
staging: lustre: ldlm: improve lock timeout messages

In ldlm_expired_completion_wait() remove the useless LCONSOLE_WARN()
message and upgrade the LDLM_DEBUG() statement to LDLM_ERROR().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7296
Reviewed-on: http://review.whamcloud.com/16824
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: ptlrpc: reset imp_replay_cursor
Hongchao Zhang [Thu, 10 Nov 2016 17:30:57 +0000 (12:30 -0500)]
staging: lustre: ptlrpc: reset imp_replay_cursor

At client side, the replay cursor using to speed up the lookup
of committed open requests in its obd_import should be resetted
for normal connection (not reconnection) during recovery.

Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6802
Reviewed-on: http://review.whamcloud.com/17351
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: llite: ll_write_begin/end not passing on errors
Hiroya Nozaki [Thu, 10 Nov 2016 17:31:00 +0000 (12:31 -0500)]
staging: lustre: llite: ll_write_begin/end not passing on errors

Because of a implementation of generic_perform_write(), write(2)
may return 0 with no errno even if EDQUOT or ENOSPC actually
happened in it. This patch fixes the issue with setting a proper
errno to ci_result.

Signed-off-by: Hiroya Nozaki <nozaki.hiroya@jp.fujitsu.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6732
Reviewed-on: http://review.whamcloud.com/15302
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: mdc: remove console spew from mdc_ioc_fid2path
Andreas Dilger [Thu, 10 Nov 2016 17:30:56 +0000 (12:30 -0500)]
staging: lustre: mdc: remove console spew from mdc_ioc_fid2path

In some cases with a very long pathname, such as with sanity.sh
test_154c, mdc_ioc_fid2path() would spew long debug messages to
the log, because libcfs_debug_vmsg2() refuses to log messages over
one page in size.

Truncate the debug message to only log the last 512 characters
of the pathname, which is sufficient for most debugging, saves a
bit of space in the debug log, and will prevent the debug logging
from printing to the console in the first place.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1095
Reviewed-on: http://review.whamcloud.com/17078
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: hsm: prevent migration of HSM archived files
John L. Hammond [Thu, 10 Nov 2016 17:31:03 +0000 (12:31 -0500)]
staging: lustre: hsm: prevent migration of HSM archived files

The reference copytool cannot handle migration of HSM archive
files. In the MDT migration path check for HSM attributes and fail if
they are present. In the LMV layer allow creation of volatile files
with any MDT index. Add a test to sanity-hsm to ensure that attempting
to migrate an HSM archive file is handled safely.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6866
Reviewed-on: http://review.whamcloud.com/17511
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: llite: support SELinux context labelling
Andrew Wellington [Thu, 10 Nov 2016 17:30:46 +0000 (12:30 -0500)]
staging: lustre: llite: support SELinux context labelling

SELinux contexts are applied by the kernel if mount options are
not binary. As we don't use any binary mount options in Lustre,
remove the binary mount option flag.

Signed-off-by: Andrew Wellington <andrew.wellington@anu.edu.au>
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6950
Reviewed-on: http://review.whamcloud.com/15840
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Sebastien Buisson <sebastien.buisson@bull.net>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: osc: Do not merge extents with partial pages
Jinshan Xiong [Thu, 10 Nov 2016 17:30:55 +0000 (12:30 -0500)]
staging: lustre: osc: Do not merge extents with partial pages

After range lock is introduced to Lustre, it's possible for
multiple threads to submit osc_extents with partial pages, and
finally I/O engine may try to merge these extents, which will
end up with assert in osc_build_rpc().

In this patch, osc_extent::oe_no_merge is introduced, and this flag
is set if osc_extent submitted via osc_io_submit() includes partial
pages. This flag is used by I/O engine to stop merging this kind
of extents.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6666
Reviewed-on: http://review.whamcloud.com/15468
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: statahead: lock leaks if statahead file recreated
Lai Siyao [Thu, 10 Nov 2016 17:30:51 +0000 (12:30 -0500)]
staging: lustre: statahead: lock leaks if statahead file recreated

During statahead file may be recreated, though this is rare case,
current code will leak the lock, this patch will release lock in
this case.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7232
Reviewed-on: http://review.whamcloud.com/16841
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: osc: fix max_dirty_mb tunable setting limit
Gregoire Pichon [Thu, 10 Nov 2016 17:30:48 +0000 (12:30 -0500)]
staging: lustre: osc: fix max_dirty_mb tunable setting limit

The OSC tunable max_dirty_mb must be set to a value strictly lower
than 2048, as it is assumed by OSS in ofd_grant_alloc() routine.

Signed-off-by: Gregoire Pichon <gregoire.pichon@bull.net>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7218
Reviewed-on: http://review.whamcloud.com/16652
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: ldlm: pl_recalc time handling is wrong
Arnd Bergmann [Thu, 10 Nov 2016 15:21:20 +0000 (16:21 +0100)]
staging: lustre: ldlm: pl_recalc time handling is wrong

James Simmons reports:
> The ldlm_pool field pl_recalc_time is set to the current
> monotonic clock value but the interval period is calculated
> with the wall clock. This means the interval period will
> always be far larger than the pl_recalc_period, which is
> just a small interval time period. The correct thing to
> do is to use monotomic clock current value instead of the
> wall clocks value when calculating recalc_interval_sec.

This broke when I converted the 32-bit get_seconds() into
ktime_get_{real_,}seconds() inconsistently. Either
one of those two would have worked, but mixing them
does not.

Staying with the original intention of the patch, this
changes the ktime_get_seconds() calls into ktime_get_real_seconds(),
using real time instead of mononic time.

Cc: stable@vger.kernel.org # v4.4+
Fixes: 8f83409cf238 ("staging/lustre: use 64-bit time for pl_recalc")
Reported-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging/lustre/osc: indent an if statement
Dan Carpenter [Thu, 10 Nov 2016 12:50:51 +0000 (15:50 +0300)]
staging/lustre/osc: indent an if statement

We accidentally removed a tab here.  Let's add it back, and some curly
braces as well since this is a muti-line indent.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lov: init LOV stripe type beforehand
Bobi Jam [Thu, 10 Nov 2016 17:30:34 +0000 (12:30 -0500)]
staging: lustre: lov: init LOV stripe type beforehand

When lu_object_alloc() reaches to LOV object init, we need initialize
its stripe type beforehand, so that if something wrong in the conf
buffer, the object chain need to be traversed to free what has been
allocated, with LOV object type be set as LLT_EMPTY, and when the LOV
part is reached, it won't panic without knowing what stripe type it
is.

This patch also improves debug messages in lsm_unpackmd_common(), and
does not return error if the LOV device is still processing config
log while trying to verify a layout buffer.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6744
Reviewed-on: http://review.whamcloud.com/15362
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: lustre: lov: avoid infinite loop in lsm_alloc_plain()
John L. Hammond [Thu, 10 Nov 2016 17:30:37 +0000 (12:30 -0500)]
staging: lustre: lov: avoid infinite loop in lsm_alloc_plain()

In lsm_alloc_plain() use a signed loop index to avoid an infinite loop
in the error path.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6872
Reviewed-on: http://review.whamcloud.com/15644
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: fsl-mc: include: mc: Kernel type 's32' preferred over 'int32_t'
Shiva Kerdel [Fri, 11 Nov 2016 11:21:18 +0000 (12:21 +0100)]
Staging: fsl-mc: include: mc: Kernel type 's32' preferred over 'int32_t'

Follow the kernel type preferrences of using 's32' over 'int32_t'.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Acked-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: fsl-mc: include: mc: Kernel type 's16' preferred over 'int16_t'
Shiva Kerdel [Fri, 11 Nov 2016 11:21:17 +0000 (12:21 +0100)]
Staging: fsl-mc: include: mc: Kernel type 's16' preferred over 'int16_t'

Follow the kernel type preferrences of using 's16' over 'int16_t'.

Signed-off-by: Shiva Kerdel <shiva@exdev.nl>
Acked-by: Stuart Yoder <stuart.yoder@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoStaging: ks7010: Prefer using the BIT macro
Punit Vara [Mon, 14 Nov 2016 09:13:35 +0000 (14:43 +0530)]
Staging: ks7010: Prefer using the BIT macro

Replace all occurences of (1<<x) by BIT(x) in the file
ks7010_sdio.h to get rid of checkpatch.pl "CHECK" output "Prefer
using BIT macro".

Signed-off-by: Punit Vara <punitvara@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: dgnc: re-arrange functions for removing forward declarations
Daeseok Youn [Fri, 11 Nov 2016 07:55:44 +0000 (16:55 +0900)]
staging: dgnc: re-arrange functions for removing forward declarations

Re-arrange the functions for removing forward declarations in dgnc_driver.c

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoRevert "Staging: vme: Use BIT macro for bit field definitions."
Greg Kroah-Hartman [Mon, 14 Nov 2016 14:44:57 +0000 (15:44 +0100)]
Revert "Staging: vme: Use BIT macro for bit field definitions."

This reverts commit d4ef13130ee00432c6e9077ebcf8396f7ca8fb6a.

It's wrong :(

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Anton Leshchenko <antonl1911@gmail.com>
Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
7 years agostaging: wlan-ng: use GENMASK macro in different defines of hfa384x.h
Sergio Paracuellos [Thu, 10 Nov 2016 18:16:39 +0000 (19:16 +0100)]
staging: wlan-ng: use GENMASK macro in different defines of hfa384x.h

This patch replace actual mask stuff using BIT macros with
or operators to make use of GENMASK macro which simplifies
code clearity and readibility.

It applies for defines included in hfa384x.h header file.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wlan-ng: use GENMASK macro in different defines of p80211hdr.h
Sergio Paracuellos [Thu, 10 Nov 2016 18:16:40 +0000 (19:16 +0100)]
staging: wlan-ng: use GENMASK macro in different defines of p80211hdr.h

This patch replace actual mask stuff using BIT macros with
or operators to make use of GENMASK macro which simplifies
code clearity and readibility.

It applies for defines included in p80211hdr.h header file.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wlan-ng: use GENMASK macro in define of p80211netdev.h
Sergio Paracuellos [Thu, 10 Nov 2016 18:16:41 +0000 (19:16 +0100)]
staging: wlan-ng: use GENMASK macro in define of p80211netdev.h

This patch replace actual mask stuff using BIT macros with
or operators to make use of GENMASK macro which simplifies
code clearity and readibility.

It applies for defines included in p80211netdev.h header file.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: wlan-ng: use GENMASK macro in two bitwise operations in prism2sta.c
Sergio Paracuellos [Thu, 10 Nov 2016 18:16:42 +0000 (19:16 +0100)]
staging: wlan-ng: use GENMASK macro in two bitwise operations in prism2sta.c

This patch replace actual mask stuff using BIT macros with
or operators to make use of GENMASK macro which simplifies
code clearity and readibility.

It applies for two bitwise operations included in prism2sta.c source file.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: fix ifnullfree.cocci warnings
kbuild test robot [Fri, 11 Nov 2016 15:31:46 +0000 (23:31 +0800)]
staging: vc04_services: fix ifnullfree.cocci warnings

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c:65:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: fix array_size.cocci warnings
kbuild test robot [Fri, 11 Nov 2016 08:10:20 +0000 (16:10 +0800)]
staging: vc04_services: fix array_size.cocci warnings

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:193:39-40: WARNING: Use ARRAY_SIZE

 Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element

Semantic patch information:
 This makes an effort to find cases where ARRAY_SIZE can be used such as
 where there is a division of sizeof the array by the sizeof its first
 element or by any indexed element or the element type. It replaces the
 division of the two sizeofs by ARRAY_SIZE.

Generated by: scripts/coccinelle/misc/array_size.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: fix returnvar.cocci warnings
kbuild test robot [Fri, 11 Nov 2016 08:10:20 +0000 (16:10 +0800)]
staging: vc04_services: fix returnvar.cocci warnings

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1788:16-22: Unneeded variable: "status". Return "VCHIQ_SUCCESS" on line 1824

 Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agostaging: vc04_services: fix setup_timer.cocci warnings
kbuild test robot [Fri, 11 Nov 2016 08:10:20 +0000 (16:10 +0800)]
staging: vc04_services: fix setup_timer.cocci warnings

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1817:2-12: Use setup_timer function for function on line 1818.

 Use setup_timer function instead of initializing timer with the function
 and data fields
Generated by: scripts/coccinelle/api/setup_timer.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge 4.9-rc5 into staging-next
Greg Kroah-Hartman [Mon, 14 Nov 2016 07:53:56 +0000 (08:53 +0100)]
Merge 4.9-rc5 into staging-next

We want the staging/iio fixes in here as well to resolve issues and
merge problems.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoLinux 4.9-rc5
Linus Torvalds [Sun, 13 Nov 2016 18:32:32 +0000 (10:32 -0800)]
Linux 4.9-rc5

7 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sun, 13 Nov 2016 18:28:53 +0000 (10:28 -0800)]
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull KVM fixes from Paolo Bonzini:
 "ARM fixes.  There are a couple pending x86 patches but they'll have to
  wait for next week"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: arm/arm64: vgic: Kick VCPUs when queueing already pending IRQs
  KVM: arm/arm64: vgic: Prevent access to invalid SPIs
  arm/arm64: KVM: Perform local TLB invalidation when multiplexing vcpus on a single CPU

7 years agoMerge branch 'media-fixes' (patches from Mauro)
Linus Torvalds [Sun, 13 Nov 2016 18:26:05 +0000 (10:26 -0800)]
Merge branch 'media-fixes' (patches from Mauro)

Merge media fixes from Mauro Carvalho Chehab:
 "This contains two patches fixing problems with my patch series meant
  to make USB drivers to work again after the DMA on stack changes.

  The last patch on this series is actually not related to DMA on stack.
  It solves a longstanding bug affecting module unload, causing
  module_put() to be called twice. It was reported by the user who
  reported and tested the issues with the gp8psk driver with the DMA
  fixup patches. As we're late at -rc cycle, maybe you prefer to not
  apply it right now. If this is the case, I'll add to the pile of
  patches for 4.10.

  Exceptionally this time, I'm sending the patches via e-mail, because
  I'm on another trip, and won't be able to use the usual procedure
  until Monday. Also, it is only three patches, and you followed already
  the discussions about the first one"

* emailed patches from Mauro Carvalho Chehab <mchehab@osg.samsung.com>:
  gp8psk: Fix DVB frontend attach
  gp8psk: fix gp8psk_usb_in_op() logic
  dvb-usb: move data_mutex to struct dvb_usb_device

7 years agoMerge tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Sun, 13 Nov 2016 18:24:08 +0000 (10:24 -0800)]
Merge tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc fixes from Greg KH:
 "Here are three small driver fixes for some reported issues for
  4.9-rc5.

  One for the hyper-v subsystem, fixing up a naming issue that showed up
  in 4.9-rc1, one mei driver fix, and one fix for parallel ports,
  resolving a reported regression.

  All have been in linux-next with no reported issues"

* tag 'char-misc-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  ppdev: fix double-free of pp->pdev->name
  vmbus: make sysfs names consistent with PCI
  mei: bus: fix received data size check in NFC fixup

7 years agoMerge tag 'driver-core-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 13 Nov 2016 18:22:07 +0000 (10:22 -0800)]
Merge tag 'driver-core-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
 "Here are two driver core fixes for 4.9-rc5.

  The first resolves an issue with some drivers not liking to be unbound
  and bound again (if CONFIG_DEBUG_TEST_DRIVER_REMOVE is enabled), which
  solves some reported problems with graphics and storage drivers. The
  other resolves a smatch error with the 4.9-rc1 driver core changes
  around this feature.

  Both have been in linux-next with no reported issues"

* tag 'driver-core-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  driver core: fix smatch warning on dev->bus check
  driver core: skip removal test for non-removable drivers

7 years agoMerge tag 'staging-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Sun, 13 Nov 2016 18:13:33 +0000 (10:13 -0800)]
Merge tag 'staging-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/IIO fixes from Grek KH:
 "Here are a few small staging and iio driver fixes for reported issues.

  The last one was cherry-picked from my -next branch to resolve a build
  warning that Arnd fixed, in his quest to be able to turn
  -Wmaybe-uninitialized back on again. That patch, and all of the
  others, have been in linux-next for a while with no reported issues"

* tag 'staging-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  iio: maxim_thermocouple: detect invalid storage size in read()
  staging: nvec: remove managed resource from PS2 driver
  Revert "staging: nvec: ps2: change serio type to passthrough"
  drivers: staging: nvec: remove bogus reset command for PS/2 interface
  staging: greybus: arche-platform: fix device reference leak
  staging: comedi: ni_tio: fix buggy ni_tio_clock_period_ps() return value
  staging: sm750fb: Fix bugs introduced by early commits
  iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation.
  iio: orientation: hid-sensor-rotation: Add PM function (fix non working driver)
  iio: st_sensors: fix scale configuration for h3lis331dl
  staging: iio: ad5933: avoid uninitialized variable in error case

7 years agoMerge tag 'usb-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Sun, 13 Nov 2016 18:10:46 +0000 (10:10 -0800)]
Merge tag 'usb-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB / PHY fixes from Greg KH:
 "Here are a number of small USB and PHY driver fixes for 4.9-rc5

  Nothing major, just small fixes for reported issues, all of these have
  been in linux-next for a while with no reported issues"

* tag 'usb-4.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  USB: cdc-acm: fix TIOCMIWAIT
  cdc-acm: fix uninitialized variable
  drivers/usb: Skip auto handoff for TI and RENESAS usb controllers
  usb: musb: remove duplicated actions
  usb: musb: da8xx: Don't print phy error on -EPROBE_DEFER
  phy: sun4i: check PMU presence when poking unknown bit of pmu
  phy-rockchip-pcie: remove deassert of phy_rst from exit callback
  phy: da8xx-usb: rename the ohci device to ohci-da8xx
  phy: Add reset callback for not generic phy
  uwb: fix device reference leaks
  usb: gadget: u_ether: remove interrupt throttling
  usb: dwc3: st: add missing <linux/pinctrl/consumer.h> include
  usb: dwc3: Fix error handling for core init

7 years agoMerge branch 'for-linus' of git://git.kernel.dk/linux-block
Linus Torvalds [Sun, 13 Nov 2016 18:09:04 +0000 (10:09 -0800)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-block

Pull more block fixes from Jens Axboe:
 "Since I mistakenly left out the lightnvm regression fix yesterday and
  the aoeblk seems adequately tested at this point, might as well send
  out another pull to make -rc5"

* 'for-linus' of git://git.kernel.dk/linux-block:
  aoe: fix crash in page count manipulation
  lightnvm: invalid offset calculation for lba_shift

7 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sun, 13 Nov 2016 18:07:08 +0000 (10:07 -0800)]
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "The megaraid_sas patch in here fixes a major regression in the last
  fix set that made all megaraid_sas cards unusable. It turns out no-one
  had actually tested such an "obvious" fix, sigh. The fix for the fix
  has been tested ...

  The next most serious is the vmw_pvscsi abort problem which basically
  means that aborts don't work on the vmware paravirt devices and error
  handling always escalates to reset.

  The rest are an assortment of missed reference counting in certain
  paths and corner case bugs that show up on some architectures"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression
  scsi: qla2xxx: fix invalid DMA access after command aborts in PCI device remove
  scsi: qla2xxx: do not queue commands when unloading
  scsi: libcxgbi: fix incorrect DDP resource cleanup
  scsi: qla2xxx: Fix scsi scan hang triggered if adapter fails during init
  scsi: scsi_dh_alua: Fix a reference counting bug
  scsi: vmw_pvscsi: return SUCCESS for successful command aborts
  scsi: mpt3sas: Fix for block device of raid exists even after deleting raid disk
  scsi: scsi_dh_alua: fix missing kref_put() in alua_rtpg_work()

7 years agoMerge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 13 Nov 2016 18:04:55 +0000 (10:04 -0800)]
Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux

Pull clk fixes from Stephen Boyd:
 "The typical collection of minor bug fixes in clk drivers. We don't
  have anything in the core framework here, just driver fixes.

  There's a boot fix for Samsung devices and a safety measure for qoriq
  to prevent CPUs from running too fast. There's also a fix for i.MX6Q
  to properly handle audio clock rates. We also have some "that's
  obviously wrong" fixes like bad NULL pointer checks in the MPP driver
  and a poor usage of __pa in the xgene clk driver that are fixed here"

* tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
  clk: mmp: pxa910: fix return value check in pxa910_clk_init()
  clk: mmp: pxa168: fix return value check in pxa168_clk_init()
  clk: mmp: mmp2: fix return value check in mmp2_clk_init()
  clk: qoriq: Don't allow CPU clocks higher than starting value
  clk: imx: fix integer overflow in AV PLL round rate
  clk: xgene: Don't call __pa on ioremaped address
  clk/samsung: Use CLK_OF_DECLARE_DRIVER initialization method for CLKOUT
  clk: rockchip: don't return NULL when failing to register ddrclk branch

7 years agogp8psk: Fix DVB frontend attach
Mauro Carvalho Chehab [Sat, 12 Nov 2016 14:46:28 +0000 (12:46 -0200)]
gp8psk: Fix DVB frontend attach

The DVB binding schema at the DVB core assumes that the frontend is a
separate driver.  Faling to do that causes OOPS when the module is
removed, as it tries to do a symbol_put_addr on an internal symbol,
causing craches like:

    WARNING: CPU: 1 PID: 28102 at kernel/module.c:1108 module_put+0x57/0x70
    Modules linked in: dvb_usb_gp8psk(-) dvb_usb dvb_core nvidia_drm(PO) nvidia_modeset(PO) snd_hda_codec_hdmi snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm snd_timer snd soundcore nvidia(PO) [last unloaded: rc_core]
    CPU: 1 PID: 28102 Comm: rmmod Tainted: P        WC O 4.8.4-build.1 #1
    Hardware name: MSI MS-7309/MS-7309, BIOS V1.12 02/23/2009
    Call Trace:
       dump_stack+0x44/0x64
       __warn+0xfa/0x120
       module_put+0x57/0x70
       module_put+0x57/0x70
       warn_slowpath_null+0x23/0x30
       module_put+0x57/0x70
       gp8psk_fe_set_frontend+0x460/0x460 [dvb_usb_gp8psk]
       symbol_put_addr+0x27/0x50
       dvb_usb_adapter_frontend_exit+0x3a/0x70 [dvb_usb]

From Derek's tests:
    "Attach bug is fixed, tuning works, module unloads without
     crashing. Everything seems ok!"

Reported-by: Derek <user.vdr@gmail.com>
Tested-by: Derek <user.vdr@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agogp8psk: fix gp8psk_usb_in_op() logic
Mauro Carvalho Chehab [Sat, 12 Nov 2016 14:46:27 +0000 (12:46 -0200)]
gp8psk: fix gp8psk_usb_in_op() logic

Commit bc29131ecb10 ("[media] gp8psk: don't do DMA on stack") fixed the
usage of DMA on stack, but the memcpy was wrong for gp8psk_usb_in_op().
Fix it.

From Derek's email:
    "Fix confirmed using 2 different Skywalker models with
     HD mpeg4, SD mpeg2."

Suggested-by: Johannes Stezenbach <js@linuxtv.org>
Fixes: bc29131ecb10 ("[media] gp8psk: don't do DMA on stack")
Tested-by: Derek <user.vdr@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agodvb-usb: move data_mutex to struct dvb_usb_device
Mauro Carvalho Chehab [Sat, 12 Nov 2016 14:46:26 +0000 (12:46 -0200)]
dvb-usb: move data_mutex to struct dvb_usb_device

The data_mutex is initialized too late, as it is needed for
each device driver's power control, causing an OOPS:

    dvb-usb: found a 'TerraTec/qanu USB2.0 Highspeed DVB-T Receiver' in warm state.
    BUG: unable to handle kernel NULL pointer dereference at           (null)
    IP: [<ffffffff846617af>] __mutex_lock_slowpath+0x6f/0x100 PGD 0
    Oops: 0002 [#1] SMP
    Modules linked in: dvb_usb_cinergyT2(+) dvb_usb
    CPU: 0 PID: 2029 Comm: modprobe Not tainted 4.9.0-rc4-dvbmod #24
    Hardware name: FUJITSU LIFEBOOK A544/FJNBB35 , BIOS Version 1.17 05/09/2014
    task: ffff88020e943840 task.stack: ffff8801f36ec000
    RIP: 0010:[<ffffffff846617af>]  [<ffffffff846617af>] __mutex_lock_slowpath+0x6f/0x100
    RSP: 0018:ffff8801f36efb10  EFLAGS: 00010282
    RAX: 0000000000000000 RBX: ffff88021509bdc8 RCX: 00000000c0000100
    RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff88021509bdcc
    RBP: ffff8801f36efb58 R08: ffff88021f216320 R09: 0000000000100000
    R10: ffff88021f216320 R11: 00000023fee6c5a1 R12: ffff88020e943840
    R13: ffff88021509bdcc R14: 00000000ffffffff R15: ffff88021509bdd0
    FS:  00007f21adb86740(0000) GS:ffff88021f200000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000000 CR3: 0000000215bce000 CR4: 00000000001406f0
    Call Trace:
       mutex_lock+0x16/0x25
       cinergyt2_power_ctrl+0x1f/0x60 [dvb_usb_cinergyT2]
       dvb_usb_device_init+0x21e/0x5d0 [dvb_usb]
       cinergyt2_usb_probe+0x21/0x50 [dvb_usb_cinergyT2]
       usb_probe_interface+0xf3/0x2a0
       driver_probe_device+0x208/0x2b0
       __driver_attach+0x87/0x90
       driver_probe_device+0x2b0/0x2b0
       bus_for_each_dev+0x52/0x80
       bus_add_driver+0x1a3/0x220
       driver_register+0x56/0xd0
       usb_register_driver+0x77/0x130
       do_one_initcall+0x46/0x180
       free_vmap_area_noflush+0x38/0x70
       kmem_cache_alloc+0x84/0xc0
       do_init_module+0x50/0x1be
       load_module+0x1d8b/0x2100
       find_symbol_in_section+0xa0/0xa0
       SyS_finit_module+0x89/0x90
       entry_SYSCALL_64_fastpath+0x13/0x94
    Code: e8 a7 1d 00 00 8b 03 83 f8 01 0f 84 97 00 00 00 48 8b 43 10 4c 8d 7b 08 48 89 63 10 4c 89 3c 24 41 be ff ff ff ff 48 89 44 24 08 <48> 89 20 4c 89 64 24 10 eb 1a 49 c7 44 24 08 02 00 00 00 c6 43 RIP  [<ffffffff846617af>] __mutex_lock_slowpath+0x6f/0x100 RSP <ffff8801f36efb10>
    CR2: 0000000000000000

So, move it to the struct dvb_usb_device and initialize it
before calling the driver's callbacks.

Reported-by: Jörg Otte <jrg.otte@gmail.com>
Tested-by: Jörg Otte <jrg.otte@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7 years agostaging: iio: tsl2583: move out of staging
Brian Masney [Sat, 12 Nov 2016 18:19:41 +0000 (13:19 -0500)]
staging: iio: tsl2583: move out of staging

Move tsl2580, tsl2581, tsl2583 driver out of staging into mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: add copyright and MODULE_AUTHOR
Brian Masney [Sat, 12 Nov 2016 18:19:40 +0000 (13:19 -0500)]
staging: iio: tsl2583: add copyright and MODULE_AUTHOR

Add Brian Masney's copyright to the header and to the MODULE_AUTHOR
for all of the staging cleanups that has been done to this driver.

The original MODULE_AUTHOR() did not have a space between his name and
email address. This patch also adds the missing space.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: remove unnecessary variable initialization
Brian Masney [Sat, 12 Nov 2016 18:19:39 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove unnecessary variable initialization

The ret variable in tsl2583_suspend() and tsl2583_resume() was
initialized to 0. This is not necessary so this patch removes the
initialization.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: remove unnecessary memset call
Brian Masney [Sat, 12 Nov 2016 18:19:38 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove unnecessary memset call

The entries in the lux table (als_device_lux) can be updated via sysfs
through the function in_illuminance_lux_table_store(). The last row in
the table must be terminated with values that are zero. The sysfs code
already ensures that the last row is all zeros. The call to memset to
clear out the table is not needed so this patch removes the unnecessary
call.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: remove comment for tsl2583_probe()
Brian Masney [Sat, 12 Nov 2016 18:19:37 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove comment for tsl2583_probe()

The comment for tsl2583_probe() does not provide any useful value.
This patch removes the comment.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: clarified comment about clearing interrupts
Brian Masney [Sat, 12 Nov 2016 18:19:36 +0000 (13:19 -0500)]
staging: iio: tsl2583: clarified comment about clearing interrupts

The comment that describes the code that clears the interrupt bit was
vague and didn't provide much value. This patch adds more detail about
why that bit needs to be cleared.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: add tsl2583 to list of supported devices in the header
Brian Masney [Sat, 12 Nov 2016 18:19:35 +0000 (13:19 -0500)]
staging: iio: tsl2583: add tsl2583 to list of supported devices in the header

The header only listed the tsl2580 and tsl2581 devices as supported by
this driver. This patch adds the tsl2583 since it is also supported by
this driver.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: move from a global to a per device lux table
Brian Masney [Sat, 12 Nov 2016 18:19:34 +0000 (13:19 -0500)]
staging: iio: tsl2583: move from a global to a per device lux table

The driver contains a global lux table that can be updated via sysfs.
Change this to a per device lux table so that multiple devices can be
hooked up to the same system with different lux tables.

There are 10 entries, plus 1 for the termination segment, set aside for
the entries in the lux table. When updating the lux table via sysfs,
only 9 entries, plus the terminator, could be added. This changes
the code to allow for the 10 entries, plus the terminator.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: don't assume an unsigned int is 32 bits
Brian Masney [Sat, 12 Nov 2016 18:19:33 +0000 (13:19 -0500)]
staging: iio: tsl2583: don't assume an unsigned int is 32 bits

in_illuminance_lux_table_store assumes that an unsigned int is 32 bits.
Replace this with sizeof(value[1]).

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: remove unnecessary parentheses
Brian Masney [Sat, 12 Nov 2016 18:19:32 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove unnecessary parentheses

in_illuminance_lux_table_store() contains some unnecessary parentheses.
This patch removes them since they provide no value.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: change tsl2583_als_calibrate() to return 0 on success
Brian Masney [Sat, 12 Nov 2016 18:19:31 +0000 (13:19 -0500)]
staging: iio: tsl2583: change tsl2583_als_calibrate() to return 0 on success

tsl2583_als_calibrate() returns the newly computed gain_trim if the
calibration was successful. This function is only called by
in_illuminance_calibrate_store() and the return value inside that
sysfs attribute is only checked to see if an error was returned.
This patch changes tsl2583_als_calibrate() to return 0 on success.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: moved code block inside else statement
Brian Masney [Sat, 12 Nov 2016 18:19:30 +0000 (13:19 -0500)]
staging: iio: tsl2583: moved code block inside else statement

The check for ch1lux > ch0lux inside tsl2583_get_lux is only valid if
the ratio is not equal to zero. Move the code block inside the else
statement. This does away with the need to initialize the variables to
zero.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: updated code comment to match what the code does
Brian Masney [Sat, 12 Nov 2016 18:19:29 +0000 (13:19 -0500)]
staging: iio: tsl2583: updated code comment to match what the code does

If channel 0 does not have any data, then the code sets the lux to zero.
The corresponding comment says that the last value is returned. This
updates the comment to correctly reflect what the code does. It also
clarifies the comment about why 0 is returned.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: fix multiline comment syntax
Brian Masney [Sat, 12 Nov 2016 18:19:28 +0000 (13:19 -0500)]
staging: iio: tsl2583: fix multiline comment syntax

The definition of the tsl2583_device_lux struct has a series of single
line comments. There are two other cases where the multiline comments
did not have an initial blank line. Change these comments to use the
proper multiline syntax.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: combine sysfs documentation
Brian Masney [Sat, 12 Nov 2016 18:19:27 +0000 (13:19 -0500)]
staging: iio: tsl2583: combine sysfs documentation

There are two separate files describing the tsl2583 sysfs attributes.
Combine the two files into one. Updated the name of the sysfs attributes
to match the current ABI.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: change newlines to improve readability
Brian Masney [Sat, 12 Nov 2016 18:19:26 +0000 (13:19 -0500)]
staging: iio: tsl2583: change newlines to improve readability

Add and remove newlines to improve code readability in preparation for
moving the driver out of staging.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: fix comparison between signed and unsigned integers
Brian Masney [Sat, 12 Nov 2016 18:19:25 +0000 (13:19 -0500)]
staging: iio: tsl2583: fix comparison between signed and unsigned integers

Fixed warning found by make W=2:

warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: fix alignment of #define values
Brian Masney [Sat, 12 Nov 2016 18:19:24 +0000 (13:19 -0500)]
staging: iio: tsl2583: fix alignment of #define values

Most of the values in the #defines have their values aligned on a single
column, but some do not. This changes the remaining defines to use
consistent alignment with the majority to improve code readability.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: unify function and variable prefix to tsl2583_
Brian Masney [Sat, 12 Nov 2016 18:19:23 +0000 (13:19 -0500)]
staging: iio: tsl2583: unify function and variable prefix to tsl2583_

Some functions and variables were prefixed with either taos, tsl258x,
taos2583, or tsl2583. Change everything to use the tsl2583 prefix since
that is the name of the .c file. The taos_settings member inside the
taos_settings struct was renamed to als_settings.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: cleaned up logging
Brian Masney [Sat, 12 Nov 2016 18:19:22 +0000 (13:19 -0500)]
staging: iio: tsl2583: cleaned up logging

There are several places in the code where the function name is
hardcoded in the log message. Use the __func__ constant string to build
the log message. This also clarifies some of the error messages to match
the code and ensures that the correct priority is used since the message
is already being changed.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: remove the FSF's mailing address
Brian Masney [Sat, 12 Nov 2016 18:19:21 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove the FSF's mailing address

Address warning from checkpatch:

CHECK: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already
includes a copy of the GPL.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: remove redundant write to the control register in taos_probe()
Brian Masney [Sat, 12 Nov 2016 18:19:20 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove redundant write to the control register in taos_probe()

taos_probe() calls i2c_smbus_write_byte() to select the control
register, however there are no subsequent calls to
i2c_smbus_read_byte(). The write call is unnecessary and is removed by
this patch.

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: change current chip state from a tristate to a bool
Brian Masney [Sat, 12 Nov 2016 18:19:19 +0000 (13:19 -0500)]
staging: iio: tsl2583: change current chip state from a tristate to a bool

The current chip state is represented as a tristate (working, suspended,
and unknown). The unknown state was not used. This patch changes the
chip state so that it is now represented as a single boolean value
(suspended).

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume
Brian Masney [Sat, 12 Nov 2016 18:19:18 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume

The device probing and the suspend/resume code checks a flag internal to
the driver that determines whether or not the chip is in a working
state. These checks are not needed. This patch removes the unnecessary
checks. It will do no harm to the hardware if the chip is
reinitialized if it is already powered on.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
7 years agostaging: iio: tsl2583: remove unnecessary chip status check in taos_get_lux
Brian Masney [Sat, 12 Nov 2016 18:19:17 +0000 (13:19 -0500)]
staging: iio: tsl2583: remove unnecessary chip status check in taos_get_lux

taos_get_lux checks to see if the chip is in a working state. This
check is not necessary since it is only called from tsl2583_read_raw
and in_illuminance_calibrate_store (via taos_als_calibrate). The chip
state is already checked by these functions.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>