platform/kernel/linux-rpi.git
5 years agovt: selection: allow functions to be called from inside kernel
Okash Khawaja [Wed, 17 Apr 2019 12:21:13 +0000 (13:21 +0100)]
vt: selection: allow functions to be called from inside kernel

This patch breaks set_selection() into two functions so that when
called from kernel, copy_from_user() can be avoided. The two functions
are called set_selection_user() and set_selection_kernel() in order to
be explicit about their purposes. This also means updating any
references to set_selection() and fixing for name change. It also
exports set_selection_kernel() and paste_selection().

These changes are used the following patch where speakup's selection
functionality calls into the above functions, thereby doing away with
parallel implementation.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Tested-by: Gregory Nowak <greg@gregn.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: greybus: power_supply: use struct_size() helper
Gustavo A. R. Silva [Wed, 17 Apr 2019 18:44:40 +0000 (13:44 -0500)]
staging: greybus: power_supply: use struct_size() helper

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes, in particular in the
context in which this code is being used.

So, replace code of the following form:

sizeof(*resp) + props_count * sizeof(struct gb_power_supply_props_desc)

with:

struct_size(resp, props, props_count)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: use help instead of ---help--- in Kconfig
Moses Christopher [Tue, 16 Apr 2019 17:08:58 +0000 (22:38 +0530)]
staging: comedi: use help instead of ---help--- in Kconfig

  - Resolve the following warning from the Kconfig,
    "WARNING: prefer 'help' over '---help---' for new help texts"

Signed-off-by: Moses Christopher <moseschristopherb@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtl8723bs: Avoid typedefs for structure
Bhanusree Pola [Fri, 19 Apr 2019 11:52:14 +0000 (17:22 +0530)]
Staging: rtl8723bs: Avoid typedefs for structure

Avoid typedefs for structure types to maintain kernel coding style.
Remove typedefs for _ODM_Phy_Dbg_Info and _ODM_Mac_Status_Info_.
This part is done by the following semantic patch:

<smpl>
@r1@
identifier i;
type t;
@@
typedef struct i {
...
}t;

@r2@
type r1.t;
identifier v;
@@
t v;

@script:python match@
i << r1.i;
x;
@@
coccinelle.x = i;

@r4@
identifier match.x;
type r1.t;
@@
- typedef struct x
+ struct x
{ ... }
- t
;

@r5@
type r1.t;
identifier r2.v, match.x;
@@
- t v;
+ struct x v;
</smpl>

Change Structure name _ODM_Phy_Dbg_Info and _ODM_Mac_Status_Info_ to maintain Linux kernel Coding Style.
Replace occurences of ODM_PHY_DBG_INFO_T to odm_phy_dbg_info and ODM_MAC_INFO to odm_mac_status_info.

Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci-phy: convert driver to use kernel regmap API's
Sergio Paracuellos [Wed, 17 Apr 2019 11:58:38 +0000 (13:58 +0200)]
staging: mt7621-pci-phy: convert driver to use kernel regmap API's

Instead of using writel and readl use regmap API which makes
the driver maintainability easier.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci-phy: add quirks for 'E2' revision using 'soc_device_attribute'
Sergio Paracuellos [Wed, 17 Apr 2019 11:58:37 +0000 (13:58 +0200)]
staging: mt7621-pci-phy: add quirks for 'E2' revision using 'soc_device_attribute'

Depending on revision of the chip, 'mt7621_bypass_pipe_rst' function
must be executed. Add better support for this using 'soc_device_match'
in driver probe function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci-phy: remove some unnecessary local variables
Sergio Paracuellos [Wed, 17 Apr 2019 11:58:36 +0000 (13:58 +0200)]
staging: mt7621-pci-phy: remove some unnecessary local variables

Device tree is not using child nodes anymore so the 'child_np' variable
can safely removed. This also simplifies the error path to be able to
directly return errors removing also the 'ret' variable.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci-phy: use 'platform_get_resource'
Sergio Paracuellos [Wed, 17 Apr 2019 11:58:35 +0000 (13:58 +0200)]
staging: mt7621-pci-phy: use 'platform_get_resource'

Driver is using 'of_address_to_resource' to get memory resources.
Make use of 'platform_get_resource' instead which is more accurate
for a platform driver. This also makes possible to delete a local
variable which is not needed anymore.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: fix spelling mistake: "nonprintabl" -> "non-printable"
Colin Ian King [Wed, 17 Apr 2019 12:00:47 +0000 (13:00 +0100)]
staging: rtl8723bs: fix spelling mistake: "nonprintabl" -> "non-printable"

There is a spelling mistake in an RT_TRACE message, fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtlwifi: fix spelling mistake "notity" -> "notify"
Colin Ian King [Wed, 17 Apr 2019 12:08:22 +0000 (13:08 +0100)]
staging: rtlwifi: fix spelling mistake "notity" -> "notify"

There are two spelling mistake in RT_TRACE messages. Fix them.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: dt9812: Call mutex_destroy() on private mutex
Ian Abbott [Wed, 17 Apr 2019 15:16:11 +0000 (16:16 +0100)]
staging: comedi: dt9812: Call mutex_destroy() on private mutex

`dt9812_detach()` is the Comedi "detach" handler for the dt9812 driver.
When it is called, the private data for the device is about to be freed.
The private data contains a mutex `devpriv->mut` that was initialized
when the private data was allocated.  Call `mutex_destroy()` to mark it
as invalid.

Also remove the calls to `mutex_lock()` and `mutex_unlock()` from
`dt9812_detach()` as the mutex is only being used around a call to
`usb_set_intfdata()` to clear the USB interface's driver data pointer.
The mutex lock seems redundant here, especially as it is about to be
destroyed.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: ni_usb6501: Call mutex_destroy() on private mutex
Ian Abbott [Wed, 17 Apr 2019 15:32:49 +0000 (16:32 +0100)]
staging: comedi: ni_usb6501: Call mutex_destroy() on private mutex

`ni6501_detach()` is the Comedi "detach" handler for the ni_usb6501
driver.  It is called when the private data for the device is about to
be freed.  The private data contains a mutex `devpriv->mut` that was
initialized when the private data was allocated.  Call `mutex_destroy()`
to mark it as invalid.

Also remove the calls to `mutex_lock()` and `mutex_unlock()` from
`ni6501_detach()`.  The only other locks of the mutex are by some of the
Comedi instruction handlers that cannot contend with the "detach"
handler for this mutex.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: usbdux: Call mutex_destroy() on private mutex
Ian Abbott [Wed, 17 Apr 2019 15:44:25 +0000 (16:44 +0100)]
staging: comedi: usbdux: Call mutex_destroy() on private mutex

`usbdux_detach()` is the Comedi "detach" handler for the usbdux driver.
When it is called, the private data for the device is about to be freed.
The private date contains a mutex `devpriv->mut` that was initialized
when the private data was allocated.  Call `mutex_destroy()` to mark it
as invalid.

The calls to `mutex_lock()` and `mutex_unlock()` are probably not
required, especially as the mutex is about to be destroyed, but leave
them alone for now.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: usbduxfast: Call mutex_destroy() on private mutex
Ian Abbott [Wed, 17 Apr 2019 15:50:09 +0000 (16:50 +0100)]
staging: comedi: usbduxfast: Call mutex_destroy() on private mutex

`usbduxfast_detach()` is the Comedi "detach" handler for the usbduxfast
driver.  When it is called, the private data for the device is about to
be freed.  The private date contains a mutex `devpriv->mut` that was
initialized when the private data was allocated.  Call `mutex_destroy()`
to mark it as invalid.

The calls to `mutex_lock()` and `mutex_unlock()` in
`usbduxfast_detach()` are probably not required, especially as the mutex
is about to be destroyed, but leave them alone for now.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: usbduxsigma: Call mutex_destroy() on private mutex
Ian Abbott [Wed, 17 Apr 2019 15:55:12 +0000 (16:55 +0100)]
staging: comedi: usbduxsigma: Call mutex_destroy() on private mutex

`usbduxsigma_detach()` is the Comedi "detach" handler for the
usbduxsigma driver.  When it is called, the private data for the device
is about to be freed.  The private date contains a mutex `devpriv->mut`
that was initialized when the private data was allocated.  Call
`mutex_destroy()` to mark it as invalid.

The calls to `mutex_lock()` and `mutex_unlock()` in
`usbduxsigma_detach()` are probably not required, especially as the
mutex is about to be destroyed, but leave them alone for now.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: configfs: Make mdev_link_list static
YueHaibing [Wed, 17 Apr 2019 14:58:58 +0000 (22:58 +0800)]
staging: most: configfs: Make mdev_link_list static

Fix sparse warning:

drivers/staging/most/configfs.c:34:18: warning:
 symbol 'mdev_link_list' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: hal: fix spelling mistake "singal" -> "signal"
Colin Ian King [Thu, 18 Apr 2019 12:20:41 +0000 (13:20 +0100)]
staging: rtl8723bs: hal: fix spelling mistake "singal" -> "signal"

There are multiple spelling mistakes in variable names, fix these.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vc04_services: handle kzalloc failure
Nicholas Mc Guire [Thu, 18 Apr 2019 23:31:08 +0000 (01:31 +0200)]
staging: vc04_services: handle kzalloc failure

The kzalloc here was being used without checking the return - if the
kzalloc fails return VCHIQ_ERROR. The call-site of
vchiq_platform_init_state() vchiq_init_state() was not responding
to an allocation failure so checks for != VCHIQ_SUCCESS
and pass VCHIQ_ERROR up to vchiq_platform_init() which then
will fail with -EINVAL.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Reported-by: kbuild test robot <lkp@intel.com>
Acked-By: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: Add lockdep_assert_held() calls for dev->attach_lock
Ian Abbott [Wed, 17 Apr 2019 14:39:30 +0000 (15:39 +0100)]
staging: comedi: Add lockdep_assert_held() calls for dev->attach_lock

There are not a lot of functions in the core comedi module that require
the R/W semaphore `attach_lock` in `struct comedi_device` to be locked
(although there are a few functions that require at least one of
`attach_lock` and `mutex` to be locked).  One function that requires the
caller to lock `attach_lock` is `comedi_device_detach_cleanup()` so add
a call to `lockdep_assert_held()` to check and document that.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: Add lockdep_assert_held() calls for dev->mutex
Ian Abbott [Wed, 17 Apr 2019 14:39:29 +0000 (15:39 +0100)]
staging: comedi: Add lockdep_assert_held() calls for dev->mutex

Lots of functions in the core comedi module expect the mutex in `struct
comedi_device` to be held, so add calls to `lockdep_assert_held()` to
check and document that.  An unusual case is the calls to
`lockdep_assert_held()` after successful return from
`comedi_alloc_board_minor()` which allocates a `struct comedi_device`
and returns with its mutex locked.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: don't release mutex too early in comedi_auto_config()
Ian Abbott [Wed, 17 Apr 2019 14:35:31 +0000 (15:35 +0100)]
staging: comedi: don't release mutex too early in comedi_auto_config()

`comedi_auto_config()` uses `dev->class_dev` for logging a kernel
message after releasing `dev->mutex`.  There is an unlikely possibility
that the Comedi device `dev` will have been removed by the
`COMEDI_DEVCONFIG` ioctl() command.  Keep hold of the mutex until the
kernel message has been sent to prevent that.  The function can call
`comedi_release_hardware_device()` on error.  In that case, the mutex
must be unlocked before that.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: Avoid GFP_KERNEL allocation from atomic context
Adham Abozaeid [Tue, 16 Apr 2019 23:17:07 +0000 (23:17 +0000)]
staging: wilc1000: Avoid GFP_KERNEL allocation from atomic context

txq_add_mgmt_pkt allocates memory while being called from atomic context
so needs to use GFP_ATOMIC

Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: dyna_pci10xx: Set number of AO channels to 1
Ian Abbott [Tue, 16 Apr 2019 13:37:48 +0000 (14:37 +0100)]
staging: comedi: dyna_pci10xx: Set number of AO channels to 1

The "dyna_pci10xx" driver supports the Dynalog India PCI-1050.  There
seems to be very little online information available about this card,
but as far as I can tell[*], it only has 1 AO (analog output) channel,
not 16 AO channels as reported in the Comedi subdevice information.
Besides, the Comedi "insn_write" handler for the AO subdevice takes no
account of channel numbers.  Change the `n_chans` member of the AO
subdevice structure to 1 to reflect this.

[*] The card is no longer mentioned on the manufacturer's web-site and I
couldn't find any archived page for the site on archive.org.  I found
part of a scientific paper which describes the card as having a single
channel D/A converter:
<http://shodhganga.inflibnet.ac.in/bitstream/10603/150646/15/15_chapter%205.pdf>.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: dyna_pci10xx: Don't bother configuring len_chanlist
Ian Abbott [Tue, 16 Apr 2019 13:37:47 +0000 (14:37 +0100)]
staging: comedi: dyna_pci10xx: Don't bother configuring len_chanlist

In the Comedi "attach" and "auto_attach" handlers that set up the Comedi
subdevices, there is no need to initialize the `len_chanlist` member of
Comedi subdevices that do not support Comedi asynchronous streaming
commands.  They can be left set to the initial zeroed out value and
the Comedi core will change the `len_chanlist` member to 1 afterwards in
that case.  The "dyna_pci10xx" driver currently sets the `len_chanlist`
members to the same value as the `n_chan` ("number of channels") member,
but this is unnecessary as none of them support asynchronous streaming.
Remove the initialization of `len_chanlist` from all the subdevices.
This will affect the information reported by the COMEDI_SUBDINFO ioctl
slightly.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: fieldbus: add TODO
Sven Van Asbroeck [Tue, 16 Apr 2019 15:56:18 +0000 (11:56 -0400)]
staging: fieldbus: add TODO

Add a TODO file which describes what needs to be done in order to
get the fieldbus_dev subsystem out of staging.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: fieldbus: support HMS Profinet IRT industrial controller
Sven Van Asbroeck [Tue, 16 Apr 2019 15:56:17 +0000 (11:56 -0400)]
staging: fieldbus: support HMS Profinet IRT industrial controller

The Anybus-S PROFINET IRT communication module provides instant integration
to any Ethernet based LAN via SMTP, FTP, HTTP as well as PROFINET and
Modbus-TCP. Additional protocols can be implemented on top of TCP/IP
or UDP using the transparent socket interface.

Official documentation:
https://www.anybus.com/docs/librariesprovider7/default-document-library
/manuals-design-guides/hms-hmsi-168-52.pdf

This implementation is an Anybus-S client driver, designed to be
instantiated by the Anybus-S bus driver when it discovers the Profinet
card.

If loaded successfully, the driver registers itself as a fieldbus_dev,
and userspace can access it through the fieldbus_dev interface.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodt-bindings: Add vendor prefix for arcx / Archronix
Sven Van Asbroeck [Tue, 16 Apr 2019 15:56:16 +0000 (11:56 -0400)]
dt-bindings: Add vendor prefix for arcx / Archronix

arcx Inc. is an engineering company which provides advanced
embedded systems and consulting services.

Archronix is a technology design and product engineering firm
specializing in hardware control systems and enabling software.
Clients include OEM's in the transportation, aerospace,
medical and commercial sectors.

Websites:
http://www.arcx.com/
http://www.archronix.com/

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agodt-bindings: anybus-controller: document devicetree binding
Sven Van Asbroeck [Tue, 16 Apr 2019 15:56:15 +0000 (11:56 -0400)]
dt-bindings: anybus-controller: document devicetree binding

This patch adds devicetree binding documentation for the
Arcx anybus controller.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: fieldbus: anybus-s: support the Arcx anybus controller
Sven Van Asbroeck [Tue, 16 Apr 2019 15:56:14 +0000 (11:56 -0400)]
staging: fieldbus: anybus-s: support the Arcx anybus controller

Add a driver for the Arcx anybus controller.

This device implements two Anybus-S hosts (buses),
and connects to the SoC via a parallel memory bus.
There is also a CAN power readout, unrelated to the Anybus,
modelled as a regulator.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: fieldbus: anybus-s: support HMS Anybus-S bus
Sven Van Asbroeck [Tue, 16 Apr 2019 15:56:13 +0000 (11:56 -0400)]
staging: fieldbus: anybus-s: support HMS Anybus-S bus

The Anybus-S/Anybus-M is a series of interchangeable fieldbus communication
modules featuring on board memory and processing power. All software and
hardware functionality required to communicate on the fieldbus is
incorporated in the module itself, allowing the application to focus on
other tasks.

Typical applications are frequency inverters, HMI and visualization
devices, instruments, scales, robotics, PLC’s and intelligent measuring
devices.

Official documentation:
https://www.anybus.com/docs/librariesprovider7/default-document-library/
manuals-design-guides/hms-hmsi-27-275.pdf

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: add Fieldbus Device subsystem.
Sven Van Asbroeck [Tue, 16 Apr 2019 15:56:12 +0000 (11:56 -0400)]
staging: add Fieldbus Device subsystem.

Fieldbus device (client) adapters allow data exchange with a PLC aka.
"Fieldbus Controller" over a fieldbus (Profinet, FLNet, etc.)

They are typically used when a Linux device wants to expose itself
as an actuator, motor, console light, switch, etc. over the fieldbus.

This framework is designed to provide a generic interface to Fieldbus
Devices from both the Linux Kernel and the userspace.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtl8723bs: Remove an unused struct tx_pending_t
Madhumitha Prabakaran [Mon, 15 Apr 2019 20:27:04 +0000 (15:27 -0500)]
Staging: rtl8723bs: Remove an unused struct tx_pending_t

Remove an unused struct tx_pending_t, as it is never used in
kernel tree.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtl8723bs: Remove typedef in struct ieee_param
Madhumitha Prabakaran [Mon, 15 Apr 2019 20:27:03 +0000 (15:27 -0500)]
Staging: rtl8723bs: Remove typedef in struct ieee_param

Remove typedef in struct ieee_param, as the struct that
has elements that can reasonably be directly accessed
should never be a typedef.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtl8723bs: Remove typedef in struct ieee_param_ex
Madhumitha Prabakaran [Mon, 15 Apr 2019 20:27:02 +0000 (15:27 -0500)]
Staging: rtl8723bs: Remove typedef in struct ieee_param_ex

Remove typedef in struct ieee_param_ex, as the struct that
has elements that can reasonably be directly accessed should
never be a typedef.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: pi433: add dependency to PA0, 1, 2 setting for output power level
Sidong Yang [Wed, 10 Apr 2019 05:09:06 +0000 (05:09 +0000)]
staging: pi433: add dependency to PA0, 1, 2 setting for output power level

When setting output power level called, the power level should be
checked by power amplifier level register and high power option. There
was todo about it. Add some variables for checking power level range.
The values that used for checking high power or minimum power are from
rf69 datasheets. The maximum power level is always same regardless of
mode.

Signed-off-by: Sidong Yang <realwakka@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: vc04_services: bcm2835-camera: Remove an exceptional &
Madhumitha Prabakaran [Thu, 4 Apr 2019 21:27:37 +0000 (16:27 -0500)]
Staging: vc04_services: bcm2835-camera: Remove an exceptional &

Remove an exceptional & on function names, otherwise they are used as
pointers without &.

Issue suggested using Coccinelle.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vt6655: upc: remove double blank lines
Cesar Santos [Thu, 4 Apr 2019 17:59:08 +0000 (14:59 -0300)]
staging: vt6655: upc: remove double blank lines

Fix checkpatch warning "CHECK: Please don't use multiple blank lines"
on upc.h

Signed-off-by: Cesar Santos <dev.cmsantos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci-phy: prevent use of uninitialized variable
Antti Keränen [Thu, 4 Apr 2019 12:44:17 +0000 (15:44 +0300)]
staging: mt7621-pci-phy: prevent use of uninitialized variable

Do not use uninitialized variable 'port' when printing an error message

Signed-off-by: Antti Keränen <detegr@gmail.com>
Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: ralink-gdma: Use struct_size() in kzalloc()
Gustavo A. R. Silva [Wed, 3 Apr 2019 20:50:43 +0000 (15:50 -0500)]
staging: ralink-gdma: Use struct_size() in kzalloc()

One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct foo {
    int stuff;
    struct boo entry[];
};

size = sizeof(struct foo) + count * sizeof(struct boo);
instance = kzalloc(size, GFP_KERNEL)

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

size = struct_size(instance, entry, count);

or

instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL)

Based on the above, replace gdma_dma_alloc_desc() with kzalloc() and
use the new struct_size() helper.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtlwifi: Cleanup crc16_ccitt()
Madhumitha Prabakaran [Thu, 4 Apr 2019 19:51:27 +0000 (14:51 -0500)]
Staging: rtlwifi: Cleanup crc16_ccitt()

crc16_ccitt() function does "BIT(0) << i" instead of "BIT(i)".
Using !! is slightly shorter than "foo ? 1: 0" and remove unnecessary
parentheses to make the code simple.

Issue suggested by Coccinelle.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtlwifi: Remove & on function name
Madhumitha Prabakaran [Thu, 4 Apr 2019 21:14:41 +0000 (16:14 -0500)]
Staging: rtlwifi: Remove & on function name

Function name is otherwise used as pointers without &.

Issue suggested by Coccinelle.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtlwifi: base: Remove set but not used variables
YueHaibing [Sat, 6 Apr 2019 03:12:25 +0000 (03:12 +0000)]
staging: rtlwifi: base: Remove set but not used variables

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/staging/rtlwifi/base.c: In function 'rtl_tx_agg_stop':
drivers/staging/rtlwifi/base.c:1733:23: warning:
 variable 'tid_data' set but not used [-Wunused-but-set-variable]

drivers/staging/rtlwifi/base.c: In function 'rtl_check_beacon_key':
drivers/staging/rtlwifi/base.c:2474:5: warning:
 variable 'ds_param_len' set but not used [-Wunused-but-set-variable]

drivers/staging/rtlwifi/base.c:2472:5: warning:
 variable 'ht_oper_len' set but not used [-Wunused-but-set-variable]

drivers/staging/rtlwifi/base.c:2470:5: warning:
 variable 'ht_cap_len' set but not used [-Wunused-but-set-variable]

They are never used and can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: hal: hal_com_phycfg: fixed a coding style issue
Gabriela Bittencourt [Sat, 6 Apr 2019 22:25:28 +0000 (19:25 -0300)]
Staging: hal: hal_com_phycfg: fixed a coding style issue

Added a blank line after declarations.

Signed-off-by: Gabriela Bittencourt <gabrielabittencourt00@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: remove redundant 'default n' from Kconfig
Bartlomiej Zolnierkiewicz [Fri, 12 Apr 2019 10:13:02 +0000 (12:13 +0200)]
staging: remove redundant 'default n' from Kconfig

'default n' is the default value for any bool or tristate Kconfig
setting so there is no need to write it explicitly.

Also since commit f467c5640c29 ("kconfig: only write '# CONFIG_FOO
is not set' for visible symbols") the Kconfig behavior is the same
regardless of 'default n' being present or not:

    ...
    One side effect of (and the main motivation for) this change is making
    the following two definitions behave exactly the same:

        config FOO
                bool

        config FOO
                bool
                default n

    With this change, neither of these will generate a
    '# CONFIG_FOO is not set' line (assuming FOO isn't selected/implied).
    That might make it clearer to people that a bare 'default n' is
    redundant.
    ...

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: axis-fifo: Add elaborate description in Kconfig
Moses Christopher [Sat, 13 Apr 2019 16:29:03 +0000 (21:59 +0530)]
staging: axis-fifo: Add elaborate description in Kconfig

  - The Xilinx AXI-Stream FIFO IP core driver description is elaborated.
  - References: Xilinx PG080 document, axis-fifo.txt

Signed-off-by: Moses Christopher <moseschristopherb@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: rtl8723bs: Remove typedef in struct sdio_data
Madhumitha Prabakaran [Thu, 11 Apr 2019 15:30:14 +0000 (10:30 -0500)]
Staging: rtl8723bs: Remove typedef in struct sdio_data

Remove typedef in struct sdio_data and make the respective changes in
associated files, as the struct that has elements that can reasonably
be directly accessed should never be a typedef.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8192e: remove a blank line
Daniel Junho [Wed, 10 Apr 2019 00:27:05 +0000 (21:27 -0300)]
staging: rtl8192e: remove a blank line

Fix the checkpath error:
CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: Daniel Junho <djunho@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8192e: Remove a not necessary blank line before a close brace '}'
Gabriela Bittencourt [Tue, 9 Apr 2019 20:16:11 +0000 (17:16 -0300)]
staging: rtl8192e: Remove a not necessary blank line before a close brace '}'

Fix a coding style issue.

Signed-off-by: Gabriela Bittencourt <gabrielabittencourt00@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8192e: Remove set but not used variable 'VenderID'
YueHaibing [Sat, 6 Apr 2019 03:11:34 +0000 (03:11 +0000)]
staging: rtl8192e: Remove set but not used variable 'VenderID'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/staging/rtl8192e/rtl8192e/rtl_pci.c: In function 'rtl92e_check_adapter':
drivers/staging/rtl8192e/rtl8192e/rtl_pci.c:36:6: warning:
 variable 'VenderID' set but not used [-Wunused-but-set-variable]
  u16 VenderID;
      ^

It's never used and can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtlwifi: rtl8822be: Remove set but not used variable 'curtxbw_40mhz'
YueHaibing [Sat, 6 Apr 2019 03:11:18 +0000 (03:11 +0000)]
staging: rtlwifi: rtl8822be: Remove set but not used variable 'curtxbw_40mhz'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/staging/rtlwifi/rtl8822be/hw.c: In function 'rtl8822be_update_hal_rate_mask':
drivers/staging/rtlwifi/rtl8822be/hw.c:2144:5: warning:
 variable 'curtxbw_40mhz' set but not used [-Wunused-but-set-variable]

It's never used and can be removed.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: add space after enum declaration
William Tustumi [Fri, 5 Apr 2019 03:44:22 +0000 (00:44 -0300)]
staging: rtl8723bs: add space after enum declaration

Add space between "enum TXDESC_SC" and '{' at line 86.

Fix the following error from checkpatch.pl

WARNING: missing space after enum definition
+enum TXDESC_SC{

Signed-off-by: William Tustumi <whatust@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8192u: ieee80211: add space around '==' and before '('
Caio Salvador Rohwedder [Fri, 5 Apr 2019 01:56:46 +0000 (22:56 -0300)]
staging: rtl8192u: ieee80211: add space around '==' and before '('

Fix checkpatch coding style errors on rtl819x_TSProc.c
- space required before the open parenthesis '('
- spaces required around that '=='

Signed-off-by: Caio Salvador Rohwedder <caiosalvador96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8192u: Add missing space
Gabriel Siqueira [Thu, 4 Apr 2019 17:19:07 +0000 (14:19 -0300)]
staging: rtl8192u: Add missing space

Fix checkpatch error: "ERROR: space required after that close brace '}'".

Signed-off-by: Gabriel Siqueira <gabriel.gabrielhs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: hal: replace spaces by tabs.
Beatriz Martins de Carvalho [Thu, 4 Apr 2019 13:09:30 +0000 (10:09 -0300)]
staging: rtl8723bs: hal: replace spaces by tabs.

Fix checkpatch error "ERROR: code indent should use tabs where possible"
in hal_com_phycfg.c:1726.

Signed-off-by: Beatriz Martins de Carvalho <martinsdecarvalhobeatriz@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: make sta2sta_data_frame() static
Michael Straube [Wed, 3 Apr 2019 17:07:09 +0000 (19:07 +0200)]
staging: rtl8188eu: make sta2sta_data_frame() static

Function sta2sta_data_frame() is only used in rtw_recv.c.
So make it static.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: remove unnecessary declaration
Michael Straube [Wed, 3 Apr 2019 17:07:08 +0000 (19:07 +0200)]
staging: rtl8188eu: remove unnecessary declaration

The declaration of sta2sta_data_frame() is directly above
the function definition. Remove the unnecessary declaration.

This also clears a checkpatch issue.
CHECK: Lines should not end with a '('

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8712: remove unnecessary NULL check
Himadri Pandya [Wed, 3 Apr 2019 16:08:16 +0000 (21:38 +0530)]
staging: rtl8712: remove unnecessary NULL check

List wlan_network is built properly with init_list_head and
list_add_tail which cancels out its probability of being NULL because of
the precence of list_head at the top of this structure. Hence, the NULL
test can be omitted.

Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: android: vsoc: fix copy_from_user overrun
Vincent Stehlé [Sun, 14 Apr 2019 15:37:26 +0000 (17:37 +0200)]
staging: android: vsoc: fix copy_from_user overrun

The `np->permission' structure is smaller than the `np' structure but
sizeof(*np) worth of data is copied in there. Fix the size passed to
copy_from_user() to avoid overrun.

Fixes: 3d2ec9dcd553 ("staging: Android: Add 'vsoc' driver for cuttlefish.")
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: Documentation: update driver documentation
Christian Gromm [Wed, 3 Apr 2019 13:19:55 +0000 (15:19 +0200)]
staging: most: Documentation: update driver documentation

This patch updates the driver documentation files to reflect the
latest changes regarding configfs.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
v2:
- changed kernel version to 5.2
v3:
v4:

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: configfs: add code for link removal
Christian Gromm [Wed, 3 Apr 2019 13:19:54 +0000 (15:19 +0200)]
staging: most: configfs: add code for link removal

This patch adds code that cleans up established links whenever the destroy
attribute is set or if the config_item (directory) is being removed.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: configfs: make create attributes write-only
Christian Gromm [Wed, 3 Apr 2019 13:19:53 +0000 (15:19 +0200)]
staging: most: configfs: make create attributes write-only

Reading the create attribute that triggers the creation of a link to
a certain channel is not necessary. Hence, it is being removed.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: allow speculative configuration
Christian Gromm [Wed, 3 Apr 2019 13:19:52 +0000 (15:19 +0200)]
staging: most: allow speculative configuration

This patch makes the driver accept a link configuration eventhough no
device is attached to the bus. Instead the configuration is being applied
as soon as a device is being registered with the core.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: core: remove attribute add_link
Christian Gromm [Wed, 3 Apr 2019 13:19:51 +0000 (15:19 +0200)]
staging: most: core: remove attribute add_link

This patch removes the driver attribute add_link. It is not needed, because
the link management is now done via configfs.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: usb: remove prefix from description tag
Christian Gromm [Wed, 3 Apr 2019 13:19:50 +0000 (15:19 +0200)]
staging: most: usb: remove prefix from description tag

This patch cuts off the usb_device prefix of the description string.
It is not needed, as the interface type is already available with the
interface attribute of a channel.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: core: make sysfs attributes read-only
Christian Gromm [Wed, 3 Apr 2019 13:19:49 +0000 (15:19 +0200)]
staging: most: core: make sysfs attributes read-only

This patch changes the access flags of the channel attributes to
read-only. This is needed, because configuration is done via configfs.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: enable configfs support
Christian Gromm [Wed, 3 Apr 2019 13:19:48 +0000 (15:19 +0200)]
staging: most: enable configfs support

This patch enables the configfs functionality of the driver by
registering the configfs subsystems and compiling the configfs
part of the sources.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: sound: introduce new sound adapter management
Christian Gromm [Wed, 3 Apr 2019 13:19:47 +0000 (15:19 +0200)]
staging: most: sound: introduce new sound adapter management

This patch adapts the sound card management to the configfs changes.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: core: add configfs interface functions
Christian Gromm [Wed, 3 Apr 2019 13:19:46 +0000 (15:19 +0200)]
staging: most: core: add configfs interface functions

This patch adds the core's interface to configfs file.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: change signature of function probe_channel
Christian Gromm [Wed, 3 Apr 2019 13:19:45 +0000 (15:19 +0200)]
staging: most: change signature of function probe_channel

This patch adds the param argument to the function parameter of
the call-back probe_channel. This parameter is needed to configure
the channels of an attached device.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: most: add new file configfs.c
Christian Gromm [Wed, 3 Apr 2019 13:19:44 +0000 (15:19 +0200)]
staging: most: add new file configfs.c

This patch adds the file configfs.c to the driver directory. The file
registers the necessary subsystems with configfs in order to move the
driver configuration from sysfs to configfs.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: greybus: power_supply: fix prop-descriptor request size
Johan Hovold [Thu, 4 Apr 2019 06:53:30 +0000 (08:53 +0200)]
staging: greybus: power_supply: fix prop-descriptor request size

Since moving the message buffers off the stack, the dynamically
allocated get-prop-descriptor request buffer is incorrectly sized due to
using the pointer rather than request-struct size when creating the
operation.

Fortunately, the pointer size is always larger than this one-byte
request, but this could still cause trouble on the remote end due to the
unexpected message size.

Fixes: 9d15134d067e ("greybus: power_supply: rework get descriptors")
Cc: stable <stable@vger.kernel.org> # 4.9
Cc: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: gasket: Use DIV_ROUND_UP
Madhumitha Prabakaran [Wed, 3 Apr 2019 15:06:43 +0000 (10:06 -0500)]
Staging: gasket: Use DIV_ROUND_UP

Use DIV_ROUND_UP in-kernel function to make code simple and more
understandable.

Issue found using Coccinelle.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: fix spelling mistake "dissconect" -> "disconnect"
Colin Ian King [Mon, 15 Apr 2019 16:33:30 +0000 (17:33 +0100)]
staging: wilc1000: fix spelling mistake "dissconect" -> "disconnect"

There is a spelling mistake in a netdev_err error message, fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: give usleep_range a range
Nicholas Mc Guire [Thu, 11 Apr 2019 03:31:21 +0000 (05:31 +0200)]
staging: wilc1000: give usleep_range a range

usleep_range() is called in non-atomic context so there is little point
in setting min==max as the jitter of hrtimer is determined by interruptions
anyway. usleep_range can only perform the intended coalescence if some
room for placing the hrtimer is provided. Given the range of milliseconds
the delay will be 2+ anyway - so make it 2-2.5 ms which gives hrtimers
space to optimize without negatively impacting performance.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: Avoid GFP_KERNEL allocation from atomic context.
Tetsuo Handa [Sun, 7 Apr 2019 12:58:43 +0000 (21:58 +0900)]
staging: wilc1000: Avoid GFP_KERNEL allocation from atomic context.

Since wilc_set_multicast_list() is called with dev->addr_list_lock
spinlock held, we can't use GFP_KERNEL memory allocation.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: e624c58cf8eb ("staging: wilc1000: refactor code to avoid use of wilc_set_multicast_list global")
Cc: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: drop explicit conversion to bool
Nicholas Mc Guire [Sat, 6 Apr 2019 09:45:27 +0000 (11:45 +0200)]
staging: wilc1000: drop explicit conversion to bool

As the expression evaluates to a boolean anyway (relational and logical
operators) conversion with the ternary operator is not needed here as
coccinelle notes (boolconv.cocci)

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: adv_pci1710: fix spelling mistake: "droput" -> "dropout"
Colin Ian King [Mon, 15 Apr 2019 17:49:45 +0000 (18:49 +0100)]
staging: comedi: adv_pci1710: fix spelling mistake: "droput" -> "dropout"

There is a spelling mistake in a dev_error message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: dt2811: Fix spelling mistake
Hariprasad Kelam [Sat, 6 Apr 2019 08:23:19 +0000 (13:53 +0530)]
staging: comedi: dt2811: Fix spelling mistake

changes interupts --> interrupts to fix warning reported by checkpatch
tool

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: comedi: dyna_pci10xx: remove set but not used variables 'chan' and range'
YueHaibing [Sat, 6 Apr 2019 03:07:49 +0000 (03:07 +0000)]
staging: comedi: dyna_pci10xx: remove set but not used variables 'chan' and range'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/staging/comedi/drivers/dyna_pci10xx.c: In function 'dyna_pci10xx_insn_write_ao':
drivers/staging/comedi/drivers/dyna_pci10xx.c:109:21: warning:
 variable 'range' set but not used [-Wunused-but-set-variable]
  unsigned int chan, range;

drivers/staging/comedi/drivers/dyna_pci10xx.c:109:15: warning:
 variable 'chan' set but not used [-Wunused-but-set-variable]
  unsigned int chan, range;

They are never used since introduction in commit 16a7373a8e14 ("Staging:
comedi: add dyna_pci10xx driver")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoMerge tag 'iio-for-5.2a-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Thu, 4 Apr 2019 20:25:29 +0000 (22:25 +0200)]
Merge tag 'iio-for-5.2a-2' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

First set of new device support, features and fixes for IIO in the 5.2 cycle

Staging graduations
* ad7780
  - Move this ADC driver out of staging.  Included adding some new features
    along the way (see below). Also added DT bindings.

New device support
* adis16480
  - Support the ADIS16495 and ADIS16497 IMU devices making
    heavy use of refactoring of various aspects of the driver in precursor
    patches.
* lsm6dsx
  - Support for the ASM330LHH 6-axis (accelerometer + gyro) sensor.
  - Support for the LSM6DS0X
* matbotix mb1232
  - New driver for this ultrasound ranging device family. Including bindings.
  - Supports mb1202, mb1212, mb1222, mb1232, mb1242, mb7040 and mb7137.
* max31856
  - New driver for this thermocouple temperature sensor.
* meson saradc
  - Support the Meson-G12A (ID addition only).
* stmpe-adc
  - New driver supporting generic ADC alongside touchscreen support which
    previously existed. Includes DT bindings.
* vcnl4000
  - Support for the vcln4040 proximity and light sensor, including adding
    DT bindings for this and parts previously supported.

Features
* core
  - Allow reading of mount matrices from ACPI in addition to DT.
  - Common binding for theromcouple types.
* ad5933
  - Add ABI docs as there are a few 'unsual' elements about this
    device - perhaps because it's our only impedance analyser.
* ad7780
  - Add gain and filter gpio support + readback of current gain and filter.
* adis16480
  - Allow selection fo the dataready pin to be used.
  - Device tree ID table and binding documentation.
  - Support external clock modes, including new bindings.
* bma180
  - Mount matrix support.
* bmc150
  - Mount matrix support.
* bmg160
  - Mount matrix support.
  - DT id table and bindings doc.
* bmp280
  - Put calibration data into the entropy pool.
* hmc5843
  - Mount matrix support.
* itg3200
  - Mount matrix support.
* kxcjk1013
  - Device tree id table, and binding docs.
* lpc32xx
  - Add scale when regulator specified including DT docs for regulator.
* pms7003
  - Add device IDs for all supported parts to driver and binding.
* stm32-dfsdm
  - Enable hw consumer support, scan mode control and a complex set of
    triggered buffer modes.
  - Power management.
* stm32-lptimer-counter
  - power management.
  - Document the pinctrl sleep state binding.
* ti-ads7950
  - GPIO pin support.

Cleanups, minor fixes
* core
  - Use bitmap_zalloc to make it explicit that is what we are doing.
  - Tidy up all the Kconfig files (which had slowly gotten messy)
  - Fix a forwards definition missing issue in iio/driver.h
* ad sigma delta core
  - Improve handling of SPI bus locking vs CS assertion.  This has been
    wrong a long time so not rushing this in.
* ad5064
  - Mlock to local lock.
* ad5933 (staging cleanup)
  - Multiline comment fixes.
  - Include ordering.
  - SPDX.
  - Tidy up Kconfig help which was a bit missleading.
  - Change some non standard attributes to ABI defined ones.
* ad7124
  - White space fix.
* ad7192
  - White space.
  - Use DT clock binding.
  - Improve error reporting.
  - Platform data to DT conversion.
  - Use read_avail callback, mostly to avoid the endless series of
    patches from new contributors trying to falsely put spaces around
    the negative sign.
* ad7280a
  - Add brackets to macros to avoid potential precedence isseus.
  - Add temp vars for event codes to reduce indent and improved readability.
  - Clean out som CamelCase notation.
  - White space.
* ad7606
  - Fix broken file naming in MAINTAINERS.
* ad7780
  - Missing switch defaults to supress warnings and harden the code slightly.
  - Set pattern masks more directly.
  - Add ID values and masks for all supported chips.
  - SPDX + add Renato as a copyright holder as he has done a lot of work on
    this driver.
  - Add brackets to macros to avoid potential precedence issues.
* ad7923
  - White space fixes.
  - Use BIT macro to improve readability.
  - Add brackets to macros to avoid potential precedence issues.
  - Tidy up a null comparisom.
* ad9523
  - Fix a typo in naming of variables.
* adis16400
  - Combine trigger file into main code as no advantage in separate files.
    Rename core file to just adis16400.
  - Squash the header into the c file now there is only one file.
  - Generalize burst mode to support new variants.
* ak8975
  - Local variable to improve readability around mount matrix support.
* as3935
  - Avoid potential race by ensuring remove does exact opposite of
    probe rather than a slightly different order.
* cross_ec
  - Drop some unnecessary includes.
  - Fix some warning and the slightly 'unusual' code.
  - Add some docs for non obvious function.
  - SPDX
* hmc5843
  - Potential unhandled error case.
* iio trigger core
  - Print an error if there is no available irq due to max consumers per
    trigger being set to low.
* iio loop trigger
  - Drop an unlikely on IS_ERR as IS_ERR already has the annotation.
* ingenic-adc
  - Drop a redundant dev_err call as devm_ioremap_resource reports the same
    internally.
* lmp91000
  - Drop some unncessary parentheses and white space tidy up.
  - Invert and if statement to improve readability.
  - Fix a wrong error message.
* lpc32xx
  - Header sorting + drop some unused ones.
* mma8542
  - Mark a switch fallthrough.
* mpu6050
  - Add a local variable to improve code readability around mount matrix
    support.
* mxs-lradc-adc
  - Handle devm_iio_trigger_alloc failure.
* sps30
  - Fix up a kernel version in the ABI docs.
* srf04
  - DT binding doc converted to yaml.
* ssp_sensors
  - Supress a clang build warning due to lack of visibility of conditional
    within a iio_push_to_buffers_with_timestamp.  (reasonable false warning!)
* st_accel
  - Drop pointless less than 0 comparisom of unsigned int.
* stm32-dfsdm
  - Improve accuracy of spi_master_frequency calculation.
  - Improve calculation fo sampling frequency.
  - Rework various internals to simplify adding triggered buffer support.
  - Claim direct mode to avoid racing around read_raw and being in buffered
    mode.
* stmpe
  - Fix a clang false positive warning.
* ti-ads7950
  - Use local lock rather than using the core mlock when not locking around
    the device mode.
* vcnl4000
  - Use word writes instead of byte writes.  It seems byte writes are fine
    for some parts (undocument) but not others that the driver will shortly
    support.

Other
* mailmap
  - Add email address change for Sean Nyekjaer.  Update in relevant drivers

* tag 'iio-for-5.2a-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (129 commits)
  iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion
  iio: adc: stm32-dfsdm: add PM support
  iio: adc: stm32-dfsdm: improve sampling frequency accuracy
  staging: iio: adc: ad7280a: Tab alignment
  MAINTAINERS: Fix the link to ad7606 dt-bindings
  iio:temperature: Add MAX31856 thermocouple support
  iio:temperature:max31856:Add device tree bind info
  dt-bindings: iio/temperature: Add thermocouple types (and doc)
  devantech-srf04.yaml: transform DT binding to YAML
  iio: frequency: ad9523: Fix typo in ad9523_platform_data
  iio: Make possible to include driver.h first
  dt-bindings: iio: add Bosch BMG160 gyroscope sensor
  iio: gyro: bmg160: add device tree compatibility table
  staging: iio: adc: ad7192: Use read_avail for available attributes
  dt-bindings: iio: light: add vcnl4040 devicetree bindings
  iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor
  dt-bindings: iio: light: add vcnl4000 devicetree bindings
  iio: light: vcnl4000 add devicetree hooks
  iio: light: vcnl4000 use word writes instead of byte writes
  iio: adc: stm32-dfsdm: claim direct mode for raw read and settings
  ...

5 years agoiio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion
Lars-Peter Clausen [Tue, 19 Mar 2019 11:37:55 +0000 (13:37 +0200)]
iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion

For devices from the SigmaDelta family we need to keep CS low when doing a
conversion, since the device will use the MISO line as a interrupt to
indicate that the conversion is complete.

This is why the driver locks the SPI bus and when the SPI bus is locked
keeps as long as a conversion is going on. The current implementation gets
one small detail wrong though. CS is only de-asserted after the SPI bus is
unlocked. This means it is possible for a different SPI device on the same
bus to send a message which would be wrongfully be addressed to the
SigmaDelta device as well. Make sure that the last SPI transfer that is
done while holding the SPI bus lock de-asserts the CS signal.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <Alexandru.Ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-dfsdm: add PM support
Fabrice Gasnier [Mon, 25 Mar 2019 14:49:28 +0000 (15:49 +0100)]
iio: adc: stm32-dfsdm: add PM support

Add PM and runtime PM support to STM32 DFSDM drivers:
- stm32-dfsdm-core: manage clocks.
- stm32-dfsdm-adc: restore channels configuration upon resume. Also stop
  restart everything in case of buffer mode.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-dfsdm: improve sampling frequency accuracy
Fabrice Gasnier [Mon, 25 Mar 2019 14:24:01 +0000 (15:24 +0100)]
iio: adc: stm32-dfsdm: improve sampling frequency accuracy

The sample frequency is driven using the oversampling ratio depending
on the SPI bus frequency.
Currently, oversampling ratio is computed by an entire division:
- spi_freq / sample_freq. This may result in inaccurate value.
Using DIV_ROUND_CLOSEST improves resulting sample frequency, which is
useful for audio that requests fixed rates (such as: 8, 16 or 32 kHz).
BTW, introduce new routine to re-factor sample frequency setting, and
move frequency accuracy message from warning to debug level.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7280a: Tab alignment
Cristian Sicilia [Sun, 24 Mar 2019 17:23:09 +0000 (18:23 +0100)]
staging: iio: adc: ad7280a: Tab alignment

Aligned some parameters.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoMAINTAINERS: Fix the link to ad7606 dt-bindings
Stefan Popa [Tue, 26 Mar 2019 10:59:52 +0000 (12:59 +0200)]
MAINTAINERS: Fix the link to ad7606 dt-bindings

The devicetree bindings documentation for ad7606 should also include
the vendor prefix: ad7606.txt -> adi,ad7606.txt

Fixes: 6e33a125df66 ("dt-bindings: iio: adc: Add docs for AD7606 ADC")
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:temperature: Add MAX31856 thermocouple support
Paresh Chaudhary [Tue, 26 Mar 2019 11:18:42 +0000 (12:18 +0100)]
iio:temperature: Add MAX31856 thermocouple support

This patch adds support for Maxim MAX31856 thermocouple
temperature sensor support.

More information can be found in:
https://www.maximintegrated.com/en/ds/MAX31856.pdf

NOTE: Driver support only Comparator Mode.

Signed-off-by: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio:temperature:max31856:Add device tree bind info
Paresh Chaudhary [Tue, 26 Mar 2019 11:18:41 +0000 (12:18 +0100)]
iio:temperature:max31856:Add device tree bind info

This patch added device tree binding info for MAX31856 driver.

Signed-off-by: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio/temperature: Add thermocouple types (and doc)
Patrick Havelange [Tue, 26 Mar 2019 11:18:40 +0000 (12:18 +0100)]
dt-bindings: iio/temperature: Add thermocouple types (and doc)

This patch introduces common thermocouple types used by various
temperature sensors. Also a brief documentation explaining this
"thermocouple-type" property.

Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodevantech-srf04.yaml: transform DT binding to YAML
Andreas Klinger [Tue, 26 Mar 2019 13:39:40 +0000 (14:39 +0100)]
devantech-srf04.yaml: transform DT binding to YAML

devantech-srf04.yaml: yaml devicetree binding for iio ultrasonic
proximity driver of devantech srf04

use devantech-srf04.txt, transform binding into yaml and remove the
outdated DT documentation

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: frequency: ad9523: Fix typo in ad9523_platform_data
Lars-Peter Clausen [Tue, 26 Mar 2019 13:40:03 +0000 (15:40 +0200)]
iio: frequency: ad9523: Fix typo in ad9523_platform_data

Replace diff_{m1,m2} with div_{m1,m2} since they are dividers and not a
differential settings.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: Make possible to include driver.h first
Andy Shevchenko [Tue, 26 Mar 2019 13:47:00 +0000 (15:47 +0200)]
iio: Make possible to include driver.h first

If we put headers alphabetically sorted in the IIO driver,
the compilation will abort because of unknown type to handle.

Simple add a forward declaration of opaque struct iio_dev.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: add Bosch BMG160 gyroscope sensor
H. Nikolaus Schaller [Mon, 18 Mar 2019 15:14:15 +0000 (16:14 +0100)]
dt-bindings: iio: add Bosch BMG160 gyroscope sensor

Define bindings for "bosch,bmg160" and "bosch,bmi055_gyro".

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: gyro: bmg160: add device tree compatibility table
H. Nikolaus Schaller [Mon, 18 Mar 2019 15:14:14 +0000 (16:14 +0100)]
iio: gyro: bmg160: add device tree compatibility table

Add of_match_table.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7192: Use read_avail for available attributes
Mircea Caprioru [Tue, 19 Mar 2019 14:25:20 +0000 (16:25 +0200)]
staging: iio: adc: ad7192: Use read_avail for available attributes

This patch removes the in_voltage-voltage_scale_available and
in_voltage_scale_available attributes. These are replaced with available
attributes added in info_mask_shared_by_type_available.

With this modification the iio core will be responsible with naming the
attributes thus removing the checkpatch warning related to
in_voltage-voltage_scale_available naming.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: light: add vcnl4040 devicetree bindings
Angus Ainslie (Purism) [Thu, 21 Mar 2019 15:40:47 +0000 (08:40 -0700)]
dt-bindings: iio: light: add vcnl4040 devicetree bindings

Document the vishay VCNL4040 devicetree bindings.

Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor
Angus Ainslie (Purism) [Thu, 21 Mar 2019 15:40:46 +0000 (08:40 -0700)]
iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor

The VCNL4040 is almost identical to the VCNL4200 as far as register
layout goes but just need to check a different ID register location.

Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: light: add vcnl4000 devicetree bindings
Angus Ainslie (Purism) [Thu, 21 Mar 2019 15:40:45 +0000 (08:40 -0700)]
dt-bindings: iio: light: add vcnl4000 devicetree bindings

Document the vishay VCNL4000 devicetree bindings.

Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: vcnl4000 add devicetree hooks
Angus Ainslie (Purism) [Thu, 21 Mar 2019 15:40:44 +0000 (08:40 -0700)]
iio: light: vcnl4000 add devicetree hooks

Add an of_match table for devicetree probing.

Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: vcnl4000 use word writes instead of byte writes
Angus Ainslie (Purism) [Thu, 21 Mar 2019 15:40:43 +0000 (08:40 -0700)]
iio: light: vcnl4000 use word writes instead of byte writes

The VCNL4200 datasheet says that word read and writes should be used
to access the registers.

Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Tested-by: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: stm32-dfsdm: claim direct mode for raw read and settings
Fabrice Gasnier [Thu, 21 Mar 2019 16:47:29 +0000 (17:47 +0100)]
iio: adc: stm32-dfsdm: claim direct mode for raw read and settings

Claim direct mode to ensure no buffer mode is in use for:
- single conversion
- sample rate setting (must be set when filter isn't enabled).
- oversampling ratio (must be set when filter isn't enabled).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>