platform/kernel/linux-starfive.git
3 years agostaging: r8188eu/core: remove the check for NULL pointer in _rtw_enqueue_cmd()
Qiang Ma [Wed, 16 Jun 2021 12:53:32 +0000 (20:53 +0800)]
staging: r8188eu/core: remove the check for NULL pointer in _rtw_enqueue_cmd()

Remove the check for _rtw_enqueue_cmd(), because
rtw_enqueue_cmd() already has a check of NULL pointer,
so this condition is not possible.

Signed-off-by: Qiang Ma <maqianga@uniontech.com>
Link: https://lore.kernel.org/r/20210616125332.31674-1-maqianga@uniontech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: ks7010: Wrap macro definitions in parenthesis
Caleb D.S. Brzezinski [Wed, 16 Jun 2021 21:26:03 +0000 (21:26 +0000)]
staging: ks7010: Wrap macro definitions in parenthesis

Wrap the definition of TX_RATE_* constants in parenthesis to prevent
incorrect casting during expansion, as recommended by checkpatch.pl.

Signed-off-by: Caleb D.S. Brzezinski <calebdsb@protonmail.com>
Link: https://lore.kernel.org/r/20210616212552.117604-1-calebdsb@protonmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rts5208: remove redundant continue statement
Colin Ian King [Thu, 17 Jun 2021 12:04:11 +0000 (13:04 +0100)]
staging: rts5208: remove redundant continue statement

The continue statement at the end of a for-loop has no effect,
remove it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Continue has no effect")
Link: https://lore.kernel.org/r/20210617120411.11612-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: android: ashmem: add size field in procfs fdinfo
liuhailong [Fri, 18 Jun 2021 09:50:35 +0000 (17:50 +0800)]
staging: android: ashmem: add size field in procfs fdinfo

add this information to help user to find ashmem problem.

ashmem leak scenario:
-000|fd = ashmem_create_region
-001|mmap and pagefault
-002|munmap
-003|forget close(fd) <---- which lead to ashmem leak

Signed-off-by: liuhailong <liuhailong@oppo.com>
收件人: 刘海龙(DuckBuBee) <liuhailong@oppo.com>
Link: https://lore.kernel.org/r/20210618095035.32410-1-liuhailong@oppo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoMerge tag 'iio-for-5.14b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Thu, 17 Jun 2021 16:20:56 +0000 (18:20 +0200)]
Merge tag 'iio-for-5.14b' of https://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of Counter and IIO new device support, cleanups etc for 5.14

Counter
------

First part of general rework of counter subsystem to add a chrdev interface
for event drive data capture.  Most of it will hopefully land next cycle.

* Consolidate documentation to avoid multiple copies of same docs in per
  device files.
* Constify various arrays etc across subsystem.
* 104-quad-8:
  - Annotate the module config parameter to avoid using it when kernel is
    locked down.
  - Spelling and trivial comment drops etc
* Intel QEP
  - Follow up cleanups of trivial stuff from initial patch series.

IIO
---

Includes some cleanups as part of two ongoing audits
- runtime pm usage in IIO.
- Insufficient alignment on buffers passed to
iio_push_to_buffers_with_timstamp()

New device support
* bosch,bmc150
  - Add ID for BMA253

Minor features / cleanups / minor fixes / late breaking fixes
* iio_push_to_buffers_with_timestamp() alignment fixes.
  This set includes those where the best option is to mark the buffer as
  __aligned(8). Normally this choice was made because there is too high a degree
  of possible variation in number of channels enabled to be able to guarantee
  the timestamp was always in the same location.  This ruled out the more
  obvious structure form used in other drivers. Only one small class of
  related issues have patches under review and we can finally tighten up the
  explicit rules to reflect the hidden requirement.

* dummy
  - Kconfig build dependency fix.
* adi,ad_sigma_delta
  - General devm related simplifications for these devices.
* adi,adf4350
  - Fix some missing cleanup on error path.
* adi,adis, ADC drivers.
  - Clean out unneeded spi_set_drvdata()
* ams-taos,tcs3472
  - Fix a potential free of an irq that was never allocated.
* atlas,sensor
  - Drop unbalanced runtime pm call and use pm_runtime_resume_and_get()
    to reduce boilerplate.
* bosch,bma180
  - Fix bandwidth register values used.
* bosch,bmc150
  - Fix wrong pointer being dereferenced in remove.
  - Stop device trying unregister itself rather than the second device.
  - Refactor ACPI second device handing.
  - Add support for DUAL250E ACPI HID.
  - Move some stuff into the header to enable following patches to not
    add additional accessor functions. Drop existing accessors.
  - Add support for hinge angle setting with DUAL250E ACPI DSM to ensure
    keyboard and touchpad enabled correctly when in laptop mode and disabled
    otherwise.
  - Add label attr for the multiple sensor locations with DUAL250E ACPI HID.
  - Fix scale units for bma222
  - Various reordering of devices supported lists to be alphabetical order.
  - Drop unnecessary duplicated chip_info_tbl[] entries.
  - Document that some devices have two interrupts, even if not currently
    used by the driver.
  - Move bma254 over to the bma255 driver.
  - Move to more consistent scale values, based on assumption that some
    datasheets use lower precision in their calculations in comparison
    with others.
* hid-sensors
  - Use namespaces for exported symbols.
  - Update includes using manual inspection of output of the
    include-what-you-use tool.
* invensense,icp10100
  - Drop unbalanced runtime pm put. Use pm_runtime_resume_and_get() to cleanly
    handle potential error.
* invensense,mpu6050
  - Drop use of %hhx string formatting.
  - runtime pm boilerplate removal and drop an unbalanced call in remove.
* liteon,ltr501
  - Fix inaccurate volatile register list.
  - Fix wrong mode bit.
  - Add a missing leXX_to_cpu() conversion.
  - Mark ltr501_chip_info structure as const.
* pulsed-light-lidar:
  - Boilerplate removal using runtime_pm_resume_and_get()
* scmi-sensors
  - Formatting of SPDX fix.
* silabs,si1133
  - Fix a string format warning.
  - Drop remaining uses of %hhx string formatting.
* silabs,si1145
  - Drop use of %hhx string formatting.
* ti,ads1015
  - Drop unbalanced runtime pm call in remove and reduce boilerplate.

* tag 'iio-for-5.14b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (76 commits)
  iio: light: tcs3472: do not free unallocated IRQ
  iio: accel: bmc150: Use more consistent and accurate scale values
  iio: hid-sensors: Update header includes
  iio: pressure: icp10100: Balance runtime pm + use pm_runtime_resume_and_get()
  iio: prox: pulsed-light-v2: Use pm_runtime_resume_and_get()
  iio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get()
  iio: adc: ads1015: Balance runtime pm + pm_runtime_resume_and_get()
  iio: imu: mpu6050: Balance runtime pm + use pm_runtime_resume_and_get()
  iio: hid-sensors: lighten exported symbols by moving to IIO_HID namespace
  iio: prox: isl29501: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
  iio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
  iio: light: vcnl4000: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
  iio: magn: rm3100: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
  iio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
  iio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
  iio: adc: hx711: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
  iio: adc: at91-sama5d2: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
  counter: interrupt-cnt: Add const qualifier for actions_list array
  iio: ltr501: mark ltr501_chip_info as const
  iio: ltr501: ltr501_read_ps(): add missing endianness conversion
  ...

3 years agoiio: light: tcs3472: do not free unallocated IRQ
frank zago [Tue, 27 Apr 2021 02:20:17 +0000 (21:20 -0500)]
iio: light: tcs3472: do not free unallocated IRQ

Allocating an IRQ is conditional to the IRQ existence, but freeing it
was not. If no IRQ was allocate, the driver would still try to free
IRQ 0. Add the missing checks.

This fixes the following trace when the driver is removed:

[  100.667788] Trying to free already-free IRQ 0
[  100.667793] WARNING: CPU: 0 PID: 2315 at kernel/irq/manage.c:1826 free_irq+0x1fd/0x370
...
[  100.667914] Call Trace:
[  100.667920]  tcs3472_remove+0x3a/0x90 [tcs3472]
[  100.667927]  i2c_device_remove+0x2b/0xa0

Signed-off-by: frank zago <frank@zago.net>
Link: https://lore.kernel.org/r/20210427022017.19314-2-frank@zago.net
Fixes: 9d2f715d592e ("iio: light: tcs3472: support out-of-threshold events")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: accel: bmc150: Use more consistent and accurate scale values
Stephan Gerhold [Fri, 11 Jun 2021 18:24:42 +0000 (20:24 +0200)]
iio: accel: bmc150: Use more consistent and accurate scale values

It is quite strange that BMA222 and BMA222E have very close, yet
subtly different values in their scale tables. Comparing the datasheets
this is simply because the "Resolution" for the different measurement
ranges are documented with different precision.

For example, for +-2g the BMA222 datasheet [1] suggests a resolution
of 15.6 mg/LSB, while the BMA222E datasheet [2] suggests 15.63 mg/LSB.

Actually, there is no need to rely on the resolution given by the Bosch
datasheets. The resolution and scale can be calculated more consistently
and accurately using the range (e.g. +-2g) and the channel size (e.g. 8 bits).

Distributing 4g (-2g to 2g) over 8 bits results in an exact resolution
of (4g / 2^8) = 15.625 mg/LSB which is the same value as in both datasheets,
just slightly more accurate. Multiplying g = 9.80665 m/s^2 we get a more
accurate value for the IIO scale table.

Generalizing this we can calculate the scale tables more accurately using
(range / 2^bits) * g * 10^6 (because of IIO_VAL_INT_PLUS_MICRO).

Document this and make the scale tables more consistent and accurate
for all the variants using that formula. Now the scale tables for
BMA222 and BMA222E are consistent and probably slightly more accurate.

[1]: https://media.digikey.com/pdf/Data%20Sheets/Bosch/BMA222.pdf
[2]: https://www.mouser.com/datasheet/2/783/BST-BMA222E-DS004-06-1021076.pdf

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gnail.com>
Link: https://lore.kernel.org/r/20210611182442.1971-1-stephan@gerhold.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: hid-sensors: Update header includes
Jonathan Cameron [Tue, 8 Jun 2021 20:55:10 +0000 (21:55 +0100)]
iio: hid-sensors: Update header includes

General driver churn doesn't always include updates of header includes.
Manual review of the output of the include-what-you-use checker lead to the
following cleanup. Hopefuly this brings things back to a good state for the
hid-sensor drivers.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20210608205510.4033887-1-jic23@kernel.org
3 years agoiio: pressure: icp10100: Balance runtime pm + use pm_runtime_resume_and_get()
Jonathan Cameron [Sun, 16 May 2021 16:21:03 +0000 (17:21 +0100)]
iio: pressure: icp10100: Balance runtime pm + use pm_runtime_resume_and_get()

The devm_ handled runtime pm disable calls pm_runtime_put_sync_suspend()
which isn't balancing a matching get call.  It isn't a bug as such,
because the runtime pm core doesn't decrement the reference count below
zero, but it is missleading so let's drop it.

Using pm_runtime_resume_and_get() new call makes it easy to handle
failures in resume as it doesn't hold a reference count if it exits
with an error.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210516162103.1332291-7-jic23@kernel.org
3 years agoiio: prox: pulsed-light-v2: Use pm_runtime_resume_and_get()
Jonathan Cameron [Sun, 16 May 2021 16:21:02 +0000 (17:21 +0100)]
iio: prox: pulsed-light-v2: Use pm_runtime_resume_and_get()

Using this new call makes it easy to handle any errors as a result
of runtime resume as it exits without leaving the reference count
elevated.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210516162103.1332291-6-jic23@kernel.org
3 years agoiio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get()
Jonathan Cameron [Sun, 16 May 2021 16:21:00 +0000 (17:21 +0100)]
iio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get()

The pm_runtime_put_noidle() call in remove isn't balanced with any get, so
drop it.  Note this isn't a bug as the runtime pm core will not allow the
reference count to go negative, making this a noop. However, it is
confusing to the reader so let's drop it.

pm_runtime_resume_and_get() replacement found using the coccicheck script
under review at:
https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/

As pm_runtime_resume_and_get() returns <= 0 take advantage of that to
change the error checking to if (ret) which is more in keeping with the
rest of this driver.

This is a prequel to taking a closer look at the runtime pm in IIO drivers
in general.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210516162103.1332291-4-jic23@kernel.org
3 years agoiio: adc: ads1015: Balance runtime pm + pm_runtime_resume_and_get()
Jonathan Cameron [Sun, 16 May 2021 16:20:59 +0000 (17:20 +0100)]
iio: adc: ads1015: Balance runtime pm + pm_runtime_resume_and_get()

The call to pm_runtime_put_noidle() in remove() is not balancing a
counter increment.  Note this doesn't matter as the runtime pm core
will not allow the counter to go negative.  However, it is confusing
to the reader so let's remove it.

The pm_runtime_resume_and_get() replacement was found using coccicheck
script under review at:
https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/

This is a prequel to taking a closer look at the runtime pm in IIO drivers
in general.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210516162103.1332291-3-jic23@kernel.org
3 years agoiio: imu: mpu6050: Balance runtime pm + use pm_runtime_resume_and_get()
Jonathan Cameron [Sun, 16 May 2021 16:20:58 +0000 (17:20 +0100)]
iio: imu: mpu6050: Balance runtime pm + use pm_runtime_resume_and_get()

Remove an unblanced pm_runtime_put_sync_suspend() call
in inv_pu_pm_disable().  Not this call is not a bug, because the runtime
pm core will not allow the reference counter to go negative.  It is
however confusing and serves no purpose.

pm_runtime_resume_and_get() case found using coccicheck script under
review at:
https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/

pm_runtime_resume_and_get() returns <= 0 only so simplify related checks
to bring this more inline with nearby calls.

This is a prequel to taking a closer look at the runtime pm in IIO drivers
in general.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210516162103.1332291-2-jic23@kernel.org
3 years agoiio: hid-sensors: lighten exported symbols by moving to IIO_HID namespace
Andy Shevchenko [Mon, 14 Jun 2021 16:24:47 +0000 (19:24 +0300)]
iio: hid-sensors: lighten exported symbols by moving to IIO_HID namespace

A namespace for exported symbols makes clear who is a provider
and who is a consumer of the certain resources. Besides that,
it doesn't pollute the common namespace.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20210614162447.5392-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: prox: isl29501: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron [Sun, 13 Jun 2021 15:23:01 +0000 (16:23 +0100)]
iio: prox: isl29501: Fix buffer alignment in iio_push_to_buffers_with_timestamp()

Add __aligned(8) to ensure the buffer passed to
iio_push_to_buffers_with_timestamp() is suitable for the naturally
aligned timestamp that will be inserted.

Here an explicit structure is not used, because the holes would
necessitate the addition of an explict memset(), to avoid a kernel
data leak, making for a less minimal fix.

Fixes: 1c28799257bc ("iio: light: isl29501: Add support for the ISL29501 ToF sensor.")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Mathieu Othacehe <m.othacehe@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-9-jic23@kernel.org
3 years agoiio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron [Sun, 13 Jun 2021 15:23:00 +0000 (16:23 +0100)]
iio: light: vcnl4035: Fix buffer alignment in iio_push_to_buffers_with_timestamp()

Add __aligned(8) to ensure the buffer passed to
iio_push_to_buffers_with_timestamp() is suitable for the naturally
aligned timestamp that will be inserted.

Here an explicit structure is not used, because the holes would
necessitate the addition of an explict memset(), to avoid a potential
kernel data leak, making for a less minimal fix.

Fixes: 55707294c4eb ("iio: light: Add support for vishay vcnl4035")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Parthiban Nallathambi <pn@denx.de>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-8-jic23@kernel.org
3 years agostaging: rtl8188eu: remove _dbg_dump_tx_info function
Phillip Potter [Tue, 15 Jun 2021 22:36:07 +0000 (23:36 +0100)]
staging: rtl8188eu: remove _dbg_dump_tx_info function

Remove the _dbg_dump_tx_info function from hal/rtl8188e_xmit.c, as
it doesn't actually do anything and is only called from one place.
It used to have some redundant debugging statements in it, but these
have now been removed anyway, so all it does is read information from
the adapter to set a variable 'dump_txdesc' which is then never used.
This fixes a kernel test robot warning.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615223607.13863-8-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove unused variables from hal/rtl8188e_cmd.c
Phillip Potter [Tue, 15 Jun 2021 22:36:06 +0000 (23:36 +0100)]
staging: rtl8188eu: remove unused variables from hal/rtl8188e_cmd.c

Remove set but unused variables from within the file hal/rtl8188e_cmd.c
in the function rtl8188e_set_FwMediaStatus_cmd, as they are triggering
kernel test robot warnings.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615223607.13863-7-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove unused variable from os_dep/ioctl_linux.c
Phillip Potter [Tue, 15 Jun 2021 22:36:05 +0000 (23:36 +0100)]
staging: rtl8188eu: remove unused variable from os_dep/ioctl_linux.c

Remove set but unused variable 'reason' from within the file
os_dep/ioctl_linux.c in the function rtw_wx_set_mlme, as it is
triggering a kernel test robot warning.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615223607.13863-6-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove unused variables from core/rtw_mlme_ext.c
Phillip Potter [Tue, 15 Jun 2021 22:36:04 +0000 (23:36 +0100)]
staging: rtl8188eu: remove unused variables from core/rtw_mlme_ext.c

Remove set but unused variables from within the file core/rtw_mlme_ext.c,
as they are triggering kernel test robot warnings.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615223607.13863-5-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove unused variables from core/rtw_efuse.c
Phillip Potter [Tue, 15 Jun 2021 22:36:03 +0000 (23:36 +0100)]
staging: rtl8188eu: remove unused variables from core/rtw_efuse.c

Remove set but unused variables from within the file core/rtw_efuse.c
in the function efuse_read_phymap_from_txpktbuf, as they are triggering
kernel test robot warnings. Also, remove the local 'lenc' array as well,
as nothing is done with its values. Keep the two usb_read8 calls
however, as this patch is purely for warnings, not to change behaviour
of the code.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615223607.13863-4-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: use prefix decrement operator on trycnt variable
Phillip Potter [Tue, 15 Jun 2021 22:36:02 +0000 (23:36 +0100)]
staging: rtl8188eu: use prefix decrement operator on trycnt variable

Modify trycnt condition in the do/while loop of rtw_hal_set_hwreg to use
a prefix decrement operator instead of postfix. As an unsigned 8-bit
integer, this value would actually be 255 after the end of the do/while
loop, which is almost certainly not what was intended. It is more
reasonable to assume a loop counter should be zero at the end of all
loop iterations. Indeed, the line following the loop previously contained
an if statement which assumed trycnt was 0, and therefore was never
triggered.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615223607.13863-3-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove empty label from mlmeext_joinbss_event_callback
Phillip Potter [Tue, 15 Jun 2021 22:36:01 +0000 (23:36 +0100)]
staging: rtl8188eu: remove empty label from mlmeext_joinbss_event_callback

Remove empty label at end of mlmeext_joinbss_event_callback function, as
it only contained a return in my last patch to make the code build. It
is better removed, and the corresponding goto converted to a return.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615223607.13863-2-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mt7621-dts: fix pci address for PCI memory range
Sergio Paracuellos [Mon, 14 Jun 2021 10:06:17 +0000 (12:06 +0200)]
staging: mt7621-dts: fix pci address for PCI memory range

Driver code call 'devm_of_pci_get_host_bridge_resources'
to get resources and properly fill 'bridge->windows' and
'bridge->dma_ranges'. After parsing the ranges and store
as resources, at the end it makes a call to pci function
'pci_add_resource_offset' to set the offset for the
memory resource. To calculate offset, resource start address
subtracts pci address of the range. MT7621 does not need
any offset for the memory resource. Moreover, setting an
offset got into 'WARN_ON' calls from pci devices driver code.
Until now memory range pci_addr was being '0x00000000' and
res->start is '0x60000000' but becase pci controller driver
was manually setting resources and adding them using pci function
'pci_add_resource' where a zero is passed as offset, things
was properly working. Since PCI_IOBASE is defined now for
ralink we don't set nothing manually anymore so we have to
properly fix PCI address for this range to make things work
and the new pci address must be set to '0x60000000'. Doing
in this way the subtract result obtain zero as offset
and pci device driver code properly works.

Fixes: d59578da2bb8 ("staging: mt7621-dts: add dts files")
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20210614100617.28753-4-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: mt7621-pci: remove 'mt7621_pci_parse_request_of_pci_ranges'
Sergio Paracuellos [Mon, 14 Jun 2021 10:06:16 +0000 (12:06 +0200)]
staging: mt7621-pci: remove 'mt7621_pci_parse_request_of_pci_ranges'

After 'PCI_IOBASE' is defined for ralink, ranges are properly parsed
using pci generic APIS and there is no need to parse anything
manually. So function 'mt7621_pci_parse_request_of_pci_ranges'
used for this can be enterely removed. Since we have to configure
iocu memory regions and pci io windows resources must be retrieved
accordly from 'bridge->windows' but there is no need to store
anything as driver private data.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20210614100617.28753-3-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoMIPS: ralink: Define PCI_IOBASE
Sergio Paracuellos [Mon, 14 Jun 2021 10:06:15 +0000 (12:06 +0200)]
MIPS: ralink: Define PCI_IOBASE

PCI_IOBASE is used to create VM maps for PCI I/O ports, it is
required by generic PCI drivers to make memory mapped I/O range
work. Hence define it for ralink architectures to be able to
avoid parsing manually IO ranges in PCI generic driver code.
Function 'plat_mem_setup' for ralink is using 'set_io_port_base'
call using '0xa0000000' as address, so use the same address in
the definition to align things.

Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20210614100617.28753-2-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: remove two unused files from tree
Fabio Aiuto [Tue, 15 Jun 2021 11:45:38 +0000 (13:45 +0200)]
staging: rtl8723bs: remove two unused files from tree

remove unused files from tree, for they are excluded
by the build process.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/ef7c21270ccaa2ee3d48b93d0a16fa55911c6cce.1623756906.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: remove include/autoconf.h header file from tree
Fabio Aiuto [Tue, 15 Jun 2021 11:45:37 +0000 (13:45 +0200)]
staging: rtl8723bs: remove include/autoconf.h header file from tree

remove include/autoconf.h header file from tree.
It just contains a compiler configuration check
which is not needed.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/9317fa8fd41da4668a41775207b5e6dad33e7447.1623756906.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: move LPS_RPWM_WAIT_MS macro
Fabio Aiuto [Tue, 15 Jun 2021 11:45:36 +0000 (13:45 +0200)]
staging: rtl8723bs: move LPS_RPWM_WAIT_MS macro

move LPS_RPWM_WAIT_MS macro from include/autoconf.h to
include/hal_btcoex.h in order to empty unneeded
autoconf.h.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/5756b958b5d279f1cc8cea7887f50d003b17b94e.1623756906.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: remove HAL_{BB,MAC,RF,FW}_ENABLE macros
Fabio Aiuto [Tue, 15 Jun 2021 11:45:35 +0000 (13:45 +0200)]
staging: rtl8723bs: remove HAL_{BB,MAC,RF,FW}_ENABLE macros

remove HAL_{BB,MAC,RF,FW}_ENABLE macros.
They are used to turn on/off by hand some core
capabilities we want to be always 'on'.

So remove usages and definitions.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/04248acbd22f9be30d21891926e134490b34036a.1623756906.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: remove unneeded DISABLE_BB_RF macro
Fabio Aiuto [Tue, 15 Jun 2021 11:45:34 +0000 (13:45 +0200)]
staging: rtl8723bs: remove unneeded DISABLE_BB_RF macro

remove unneeded DISABLE_BB_RF macro.

This is just a symbolic constant used to disable
by hand-edit some core hardware capabilities which
we want to be always enabled. So just remove it.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/1a56a6b2f9f846197e8e25769ad86ad23e530047.1623756906.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: remove unused WAKEUP_GPIO_IDX macro definition
Fabio Aiuto [Tue, 15 Jun 2021 11:45:33 +0000 (13:45 +0200)]
staging: rtl8723bs: remove unused WAKEUP_GPIO_IDX macro definition

remove unused WAKEUP_GPIO_IDX macro definition.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/6bf5ddf3e4465840cdfcca79a524645cdaf0104d.1623756906.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: remove unneeded comments
Fabio Aiuto [Tue, 15 Jun 2021 11:45:32 +0000 (13:45 +0200)]
staging: rtl8723bs: remove unneeded comments

remove unneeded comments in include/autoconf.h

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/4c1ea0e7ddceebba1afe1485662c204db5dfa9c7.1623756906.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8723bs: remove unused debug macro
Fabio Aiuto [Tue, 15 Jun 2021 11:45:31 +0000 (13:45 +0200)]
staging: rtl8723bs: remove unused debug macro

remove unused debug macro definition in
include/autoconf.h

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/4d1e9ad759fc4b66fa3309637b3b4c8eb81d2ea9.1623756906.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove DBG_88E macro definition
Phillip Potter [Tue, 15 Jun 2021 00:15:07 +0000 (01:15 +0100)]
staging: rtl8188eu: remove DBG_88E macro definition

As all callers have now been removed, remove the definition of the
DBG_88E macro itself. It is no longer required and is dead code.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-29-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove core/rtw_debug.c
Phillip Potter [Tue, 15 Jun 2021 00:15:06 +0000 (01:15 +0100)]
staging: rtl8188eu: remove core/rtw_debug.c

Remove core/rtw_debug.c as all the functions contained within it are
entirely unused, and modify the Makefile to remove it as a build
requirement. Also remove the function declarations from
include/rtw_debug.h - this is part of an ongoing effort to purge
dead/unused code and cleanup this driver. This has the helpful
side effect of removing all DBG_88E macro calls within this file
as well.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-28-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove converted netdev_dbg calls from core/rtw_sta_mgt.c
Phillip Potter [Tue, 15 Jun 2021 00:15:05 +0000 (01:15 +0100)]
staging: rtl8188eu: remove converted netdev_dbg calls from core/rtw_sta_mgt.c

Remove all previously converted netdev_dbg calls from core/rtw_sta_mgt.c,
as these were originally DBG_88E macro calls, and therefore of dubious
necessity to begin with.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-27-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove converted netdev_dbg calls from core/rtw_recv.c
Phillip Potter [Tue, 15 Jun 2021 00:15:04 +0000 (01:15 +0100)]
staging: rtl8188eu: remove converted netdev_dbg calls from core/rtw_recv.c

Remove all previously converted netdev_dbg calls from core/rtw_recv.c, as
these were originally DBG_88E macro calls, and therefore of dubious
necessity to begin with.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-26-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from hal/rtl8188eu_xmit.c
Phillip Potter [Tue, 15 Jun 2021 00:15:03 +0000 (01:15 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from hal/rtl8188eu_xmit.c

Remove all DBG_88E calls from hal/rtl8188eu_xmit.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-25-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from hal/rtl8188eu_recv.c
Phillip Potter [Tue, 15 Jun 2021 00:15:02 +0000 (01:15 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from hal/rtl8188eu_recv.c

Remove all DBG_88E calls from hal/rtl8188eu_recv.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-24-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from hal/usb_halinit.c
Phillip Potter [Tue, 15 Jun 2021 00:15:01 +0000 (01:15 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from hal/usb_halinit.c

Remove all DBG_88E calls from hal/usb_halinit.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself. Also remove unused jiffies variable from the start of
rtl8188eu_hal_init.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-23-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from hal/rtl8188e_xmit.c
Phillip Potter [Tue, 15 Jun 2021 00:15:00 +0000 (01:15 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from hal/rtl8188e_xmit.c

Remove all DBG_88E calls from hal/rtl8188e_xmit.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-22-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from hal/rtl8188e_hal_init.c
Phillip Potter [Tue, 15 Jun 2021 00:14:59 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from hal/rtl8188e_hal_init.c

Remove all DBG_88E calls from hal/rtl8188e_hal_init.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-21-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from hal/pwrseqcmd.c
Phillip Potter [Tue, 15 Jun 2021 00:14:58 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from hal/pwrseqcmd.c

Remove all DBG_88E calls from hal/pwrseqcmd.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-20-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from hal/rtl8188e_cmd.c
Phillip Potter [Tue, 15 Jun 2021 00:14:57 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from hal/rtl8188e_cmd.c

Remove all DBG_88E calls from hal/rtl8188e_cmd.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-19-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from hal/hal_intf.c
Phillip Potter [Tue, 15 Jun 2021 00:14:56 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from hal/hal_intf.c

Remove all DBG_88E calls from hal/hal_intf.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-18-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from os_dep/rtw_android.c
Phillip Potter [Tue, 15 Jun 2021 00:14:55 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from os_dep/rtw_android.c

Remove all DBG_88E calls from os_dep/rtw_android.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-17-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from os_dep/xmit_linux.c
Phillip Potter [Tue, 15 Jun 2021 00:14:54 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from os_dep/xmit_linux.c

Remove all DBG_88E calls from os_dep/xmit_linux.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-16-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from os_dep/mlme_linux.c
Phillip Potter [Tue, 15 Jun 2021 00:14:53 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from os_dep/mlme_linux.c

Remove all DBG_88E calls from os_dep/mlme_linux.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-15-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from os_dep/os_intfs.c
Phillip Potter [Tue, 15 Jun 2021 00:14:52 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from os_dep/os_intfs.c

Remove all DBG_88E calls from os_dep/os_intfs.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself. Also remove variable declarations for variables which now go
unused as a result of this change with os_dep/os_intfs.c

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-14-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from os_dep/usb_intf.c
Phillip Potter [Tue, 15 Jun 2021 00:14:51 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from os_dep/usb_intf.c

Remove all DBG_88E calls from os_dep/usb_intf.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-13-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from os_dep/ioctl_linux.c
Phillip Potter [Tue, 15 Jun 2021 00:14:50 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from os_dep/ioctl_linux.c

Remove all DBG_88E calls from os_dep/ioctl_linux.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-12-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from core/rtw_mlme.c
Phillip Potter [Tue, 15 Jun 2021 00:14:49 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from core/rtw_mlme.c

Remove all DBG_88E calls from core/rtw_mlme.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-11-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from core/rtw_ioctl_set.c
Phillip Potter [Tue, 15 Jun 2021 00:14:48 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from core/rtw_ioctl_set.c

Remove all DBG_88E calls from core/rtw_ioctl_set.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-10-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from core/rtw_security.c
Phillip Potter [Tue, 15 Jun 2021 00:14:47 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from core/rtw_security.c

Remove all DBG_88E calls from core/rtw_security.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-9-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from core/rtw_ieee80211.c
Phillip Potter [Tue, 15 Jun 2021 00:14:46 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from core/rtw_ieee80211.c

Remove all DBG_88E calls from core/rtw_ieee80211.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-8-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from core/rtw_pwrctrl.c
Phillip Potter [Tue, 15 Jun 2021 00:14:45 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from core/rtw_pwrctrl.c

Remove all DBG_88E calls from core/rtw_pwrctrl.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself. Also remove pmlmepriv declaration from within rtw_ps_processor
as it is now no longer used.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-7-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from core/rtw_ap.c
Phillip Potter [Tue, 15 Jun 2021 00:14:44 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from core/rtw_ap.c

Remove all DBG_88E calls from core/rtw_ap.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-6-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from core/rtw_wlan_util.c
Phillip Potter [Tue, 15 Jun 2021 00:14:43 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from core/rtw_wlan_util.c

Remove all DBG_88E calls from core/rtw_wlan_util.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-5-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from core/rtw_mlme_ext.c
Phillip Potter [Tue, 15 Jun 2021 00:14:42 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from core/rtw_mlme_ext.c

Remove all DBG_88E calls from core/rtw_mlme_ext.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself. Also remove variable declarations for variables which now go
unused as a result of this change with core/rtw_mlme_ext.c

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-4-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from core/rtw_xmit.c
Phillip Potter [Tue, 15 Jun 2021 00:14:41 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from core/rtw_xmit.c

Remove all DBG_88E calls from core/rtw_xmit.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Also remove static rtw_sctx_chk_warning_status function, as it no longer
has any callers.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-3-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove all DBG_88E calls from core/rtw_efuse.c
Phillip Potter [Tue, 15 Jun 2021 00:14:40 +0000 (01:14 +0100)]
staging: rtl8188eu: remove all DBG_88E calls from core/rtw_efuse.c

Remove all DBG_88E calls from core/rtw_efuse.c as this macro is
unnecessary, and many of these calls are dubious in terms of necessity.
Removing all calls will ultimately allow the removal of the macro
itself.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210615001507.1171-2-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: unisys: visorhba: Convert module from IDR to XArray
Fabio M. De Francesco [Fri, 14 May 2021 08:11:11 +0000 (10:11 +0200)]
staging: unisys: visorhba: Convert module from IDR to XArray

Converted visorhba from IDR to XArray. The abstract data type XArray is
more memory-efficient, parallelizable, and cache friendly. It takes
advantage of RCU to perform lookups without locking. Furthermore, IDR is
deprecated because XArray has a better (cleaner and more consistent)
API.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20210514081112.19542-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8712: fix memory leak in rtl871x_load_fw_cb
Pavel Skripkin [Sun, 13 Jun 2021 22:00:19 +0000 (01:00 +0300)]
staging: rtl8712: fix memory leak in rtl871x_load_fw_cb

There is a leak in rtl8712 driver.
The problem was in non-freed adapter data if
firmware load failed.

This leak can be reproduced with this code:
https://syzkaller.appspot.com/text?tag=ReproC&x=16612f02d00000,
Autoload must fail (to not hit memory leak reported by syzkaller)

There are 2 possible ways how rtl871x_load_fw_cb() and
r871xu_dev_remove() can be called (in case of fw load error).

1st case:
r871xu_dev_remove() then rtl871x_load_fw_cb()

In this case r871xu_dev_remove() will wait for
completion and then will jump to the end, because
rtl871x_load_fw_cb() set intfdata to NULL:

if (pnetdev) {
struct _adapter *padapter = netdev_priv(pnetdev);

/* never exit with a firmware callback pending */
wait_for_completion(&padapter->rtl8712_fw_ready);
pnetdev = usb_get_intfdata(pusb_intf);
usb_set_intfdata(pusb_intf, NULL);
if (!pnetdev)
goto firmware_load_fail;

... clean up code here ...
}

2nd case:
rtl871x_load_fw_cb() then r871xu_dev_remove()

In this case pnetdev (from code snippet above) will
be zero (because rtl871x_load_fw_cb() set it to NULL)
And clean up code won't be executed again.

So, in all cases we need to free adapted data in rtl871x_load_fw_cb(),
because disconnect function cannot take care of it. And there won't be
any race conditions, because complete() call happens after setting
intfdata to NULL.

In previous patch I moved out free_netdev() from r8712_free_drv_sw()
and that's why now it's possible to free adapter data and then call
complete.

Fixes: 8c213fa59199 ("staging: r8712u: Use asynchronous firmware loading")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/81e68fe0194499cc2e7692d35bc4dcf167827d8f.1623620630.git.paskripkin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8712: fix error handling in r871xu_drv_init
Pavel Skripkin [Sun, 13 Jun 2021 22:00:13 +0000 (01:00 +0300)]
staging: rtl8712: fix error handling in r871xu_drv_init

Previous error handling path was unique for all
possible errors and there was unnecessary branching.
Also, one step for freeing drv_sw was missing. All
these problems was fixed by restructuring error
handling path.

Also, moved out free_netdev() from r8712_free_drv_sw() for
correct error handling.

Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/febb00f72354449bb4d305f373d6d2f47e539ab4.1623620630.git.paskripkin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8712: remove redundant check in r871xu_drv_init
Pavel Skripkin [Sun, 13 Jun 2021 22:00:07 +0000 (01:00 +0300)]
staging: rtl8712: remove redundant check in r871xu_drv_init

padapter->dvobj_init is initialized rigth before
initialization check. There is no need for any
branching here.

Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/d367e5f39f22af44c545f8710cc18fb00f10e66c.1623620630.git.paskripkin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove another write-only member
Martin Kaiser [Sat, 12 Jun 2021 18:00:18 +0000 (20:00 +0200)]
staging: rtl8188eu: remove another write-only member

bAPKThermalMeterIgnore in struct hal_data_8188e is never read and can
be removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20210612180019.20387-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove a write-only power-index members
Martin Kaiser [Sat, 12 Jun 2021 18:00:17 +0000 (20:00 +0200)]
staging: rtl8188eu: remove a write-only power-index members

Remove power index members of struct hal_data_8188e that are written to
but never read.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20210612180019.20387-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove a write-only struct member
Martin Kaiser [Sat, 12 Jun 2021 18:00:16 +0000 (20:00 +0200)]
staging: rtl8188eu: remove a write-only struct member

FwRsvdPageStartOffset in struct hal_data_8188e is never read. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20210612180019.20387-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove unused hal_data_8188e members
Martin Kaiser [Sat, 12 Jun 2021 18:00:14 +0000 (20:00 +0200)]
staging: rtl8188eu: remove unused hal_data_8188e members

Remove some members of struct hal_data_8188e which are not used
in this driver.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20210612180019.20387-1-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: qlge: change msleep to usleep_range
Tobias Alam [Mon, 14 Jun 2021 02:11:30 +0000 (22:11 -0400)]
staging: qlge: change msleep to usleep_range

This patch changes msleep() to usleep_range() based on
Documentation/timers/timers-howto.txt. It suggests using usleep_range()
for small msec(1ms - 20ms) because msleep() will often sleep longer than
the desired value. Issue found by checkpatch.

Signed-off-by: Tobias Alam <tobiasalam@gmail.com>
Link: https://lore.kernel.org/r/YMa60p5dl0LMV/9D@tobias-VirtualBox
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: convert DBG_88E calls in core/rtw_recv.c
Phillip Potter [Sun, 13 Jun 2021 10:24:59 +0000 (11:24 +0100)]
staging: rtl8188eu: convert DBG_88E calls in core/rtw_recv.c

Convert all calls to the DBG_88E macro in core/rtw_recv.c into
netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
debug messages can be controlled more precisely by just using debugfs.
It is important to keep these messages still, as they are displayable
via a kernel module parameter when using DBG_88E.

One such converted call is after a failed skb allocation, but as it prints
additional information besides just stating failure, I've left it in
despite the checkpatch warning.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210613102459.7532-1-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c
Phillip Potter [Sun, 13 Jun 2021 10:24:54 +0000 (11:24 +0100)]
staging: rtl8188eu: convert DBG_88E calls in core/rtw_sta_mgt.c

Convert both calls to the DBG_88E macro in core/rtw_sta_mgt.c into
netdev_dbg calls. The DBG_88E macro is unnecessary, as visibility of
debug messages can be controlled more precisely by just using debugfs.
It is important to keep these messages still, as they are displayable
via a kernel module parameter when using DBG_88E.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210613102454.7480-1-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: rtl8188eu: remove HW_DEF_ODM_DBG_FLAG enum value
Phillip Potter [Sat, 12 Jun 2021 18:19:42 +0000 (19:19 +0100)]
staging: rtl8188eu: remove HW_DEF_ODM_DBG_FLAG enum value

Remove HW_DEF_ODM_DBG_FLAG definition from the hal_def_variable enum
in include/hal_intf.h, and remove its usage from the switch statement
in rtw_hal_get_def_var inside hal/usb_halinit.c - this is dead code
and no longer used, now that ODM_RT_TRACE and include/odm_debug.h
have been removed.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210612181942.33817-1-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: gdm724x: check for overflow in gdm_lte_netif_rx()
Dan Carpenter [Mon, 14 Jun 2021 09:58:36 +0000 (12:58 +0300)]
staging: gdm724x: check for overflow in gdm_lte_netif_rx()

This code assumes that "len" is at least 62 bytes, but we need a check
to prevent a read overflow.

Fixes: 61e121047645 ("staging: gdm7240: adding LTE USB driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YMcoTPsCYlhh2TQo@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agostaging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()
Dan Carpenter [Mon, 14 Jun 2021 09:55:35 +0000 (12:55 +0300)]
staging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()

There needs to be a check to verify that we don't read beyond the end
of "buf".  This function is called from do_rx().  The "buf" is the USB
transfer_buffer and "len" is "urb->actual_length".

Fixes: 61e121047645 ("staging: gdm7240: adding LTE USB driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YMcnl4zCwGWGDVMG@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoiio: light: vcnl4000: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron [Sun, 13 Jun 2021 15:22:59 +0000 (16:22 +0100)]
iio: light: vcnl4000: Fix buffer alignment in iio_push_to_buffers_with_timestamp()

Add __aligned(8) to ensure the buffer passed to
iio_push_to_buffers_with_timestamp() is suitable for the naturally
aligned timestamp that will be inserted.

Here an explicit structure is not used, because the holes would
necessitate the addition of an explict memset(), to avoid a kernel
data leak, making for a less minimal fix.

Found during an audit of all callers of iio_push_to_buffers_with_timestamp()

Fixes: 8fe78d5261e7 ("iio: vcnl4000: Add buffer support for VCNL4010/20.")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Mathieu Othacehe <m.othacehe@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-7-jic23@kernel.org
3 years agoiio: magn: rm3100: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
Jonathan Cameron [Sun, 13 Jun 2021 15:22:58 +0000 (16:22 +0100)]
iio: magn: rm3100: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()

Add __aligned(8) to ensure the buffer passed to
iio_push_to_buffers_with_timestamp() is suitable for the naturally
aligned timestamp that will be inserted.

Here an explicit structure is not used, because this buffer is used in
a non-trivial way for data repacking.

Fixes: 121354b2eceb ("iio: magnetometer: Add driver support for PNI RM3100")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Song Qiang <songqiang1304521@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-6-jic23@kernel.org
3 years agoiio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
Jonathan Cameron [Sun, 13 Jun 2021 15:22:57 +0000 (16:22 +0100)]
iio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()

Add __aligned(8) to ensure the buffer passed to
iio_push_to_buffers_with_timestamp() is suitable for the naturally
aligned timestamp that will be inserted.

Fixes: f214ff521fb1 ("iio: ti-ads8688: Update buffer allocation for timestamps")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-5-jic23@kernel.org
3 years agoiio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron [Sun, 13 Jun 2021 15:22:56 +0000 (16:22 +0100)]
iio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with_timestamp()

To make code more readable, use a structure to express the channel
layout and ensure the timestamp is 8 byte aligned.
Add a comment on why the buffer is the size it is as not immediately
obvious.

Found during an audit of all calls of this function.

Fixes: 6dd112b9f85e ("iio: adc: mxs-lradc: Add support for ADC driver")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-4-jic23@kernel.org
3 years agoiio: adc: hx711: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron [Sun, 13 Jun 2021 15:22:55 +0000 (16:22 +0100)]
iio: adc: hx711: Fix buffer alignment in iio_push_to_buffers_with_timestamp()

To make code more readable, use a structure to express the channel
layout and ensure the timestamp is 8 byte aligned.

Found during an audit of all calls of this function.

Fixes: d3bf60450d47 ("iio: hx711: add triggered buffer support")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-3-jic23@kernel.org
3 years agoiio: adc: at91-sama5d2: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron [Sun, 13 Jun 2021 15:22:54 +0000 (16:22 +0100)]
iio: adc: at91-sama5d2: Fix buffer alignment in iio_push_to_buffers_with_timestamp()

To make code more readable, use a structure to express the channel
layout and ensure the timestamp is 8 byte aligned.

Found during an audit of all calls of this function.

Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-2-jic23@kernel.org
3 years agoMerge tag 'v5.13-rc6' into staging-next
Greg Kroah-Hartman [Mon, 14 Jun 2021 07:12:45 +0000 (09:12 +0200)]
Merge tag 'v5.13-rc6' into staging-next

We want the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 years agoLinux 5.13-rc6
Linus Torvalds [Sun, 13 Jun 2021 21:43:10 +0000 (14:43 -0700)]
Linux 5.13-rc6

3 years agoMerge tag 'perf-tools-fixes-for-v5.13-2021-06-13' of git://git.kernel.org/pub/scm...
Linus Torvalds [Sun, 13 Jun 2021 19:41:47 +0000 (12:41 -0700)]
Merge tag 'perf-tools-fixes-for-v5.13-2021-06-13' of git://git./linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

 - Correct buffer copying when peeking events

 - Sync cpufeatures/disabled-features.h header with the kernel sources

* tag 'perf-tools-fixes-for-v5.13-2021-06-13' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  tools headers cpufeatures: Sync with the kernel sources
  perf session: Correct buffer copying when peeking events

3 years agoMerge tag 'nfs-for-5.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Linus Torvalds [Sun, 13 Jun 2021 19:32:59 +0000 (12:32 -0700)]
Merge tag 'nfs-for-5.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client bugfixes from Trond Myklebust:
 "Highlights include:

  Stable fixes:

   - Fix use-after-free in nfs4_init_client()

  Bugfixes:

   - Fix deadlock between nfs4_evict_inode() and nfs4_opendata_get_inode()

   - Fix second deadlock in nfs4_evict_inode()

   - nfs4_proc_set_acl should not change the value of NFS_CAP_UIDGID_NOMAP

   - Fix setting of the NFS_CAP_SECURITY_LABEL capability"

* tag 'nfs-for-5.13-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  NFSv4: Fix second deadlock in nfs4_evict_inode()
  NFSv4: Fix deadlock between nfs4_evict_inode() and nfs4_opendata_get_inode()
  NFS: FMODE_READ and friends are C macros, not enum types
  NFS: Fix a potential NULL dereference in nfs_get_client()
  NFS: Fix use-after-free in nfs4_init_client()
  NFS: Ensure the NFS_CAP_SECURITY_LABEL capability is set when appropriate
  NFSv4: nfs4_proc_set_acl needs to restore NFS_CAP_UIDGID_NOMAP on error.

3 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sun, 13 Jun 2021 19:25:33 +0000 (12:25 -0700)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Four reasonably small fixes to the core for scsi host allocation
  failure paths.

  The root problem is that we're not freeing the memory allocated by
  dev_set_name(), which involves a rejig of may of the free on error
  paths to do put_device() instead of kfree which, in turn, has several
  other knock on ramifications and inspection turned up a few other
  lurking bugs"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: core: Only put parent device if host state differs from SHOST_CREATED
  scsi: core: Put .shost_dev in failure path if host state changes to RUNNING
  scsi: core: Fix failure handling of scsi_add_host_with_dma()
  scsi: core: Fix error handling of scsi_host_alloc()

3 years agocounter: interrupt-cnt: Add const qualifier for actions_list array
William Breathitt Gray [Thu, 10 Jun 2021 01:36:42 +0000 (10:36 +0900)]
counter: interrupt-cnt: Add const qualifier for actions_list array

The struct counter_synapse actions_list member expects a const enum
counter_synapse_action array. This patch renames
interrupt_cnt_synapse_actionss to interrupt_cnt_synapse_actions and adds
a const qualifier to match actions_list.

Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Reviewed-by: <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20210610013642.149961-1-vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: ltr501: mark ltr501_chip_info as const
Marc Kleine-Budde [Thu, 10 Jun 2021 13:46:19 +0000 (15:46 +0200)]
iio: ltr501: mark ltr501_chip_info as const

This patch marks the struct ltr501_chip_info as constant.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Nikita Travkin <nikita@trvn.ru> # ltr559
Link: https://lore.kernel.org/r/20210610134619.2101372-5-mkl@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: ltr501: ltr501_read_ps(): add missing endianness conversion
Oliver Lang [Thu, 10 Jun 2021 13:46:18 +0000 (15:46 +0200)]
iio: ltr501: ltr501_read_ps(): add missing endianness conversion

The PS ADC Channel data is spread over 2 registers in little-endian
form. This patch adds the missing endianness conversion.

Fixes: 2690be905123 ("iio: Add Lite-On ltr501 ambient light / proximity sensor driver")
Signed-off-by: Oliver Lang <Oliver.Lang@gossenmetrawatt.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Nikita Travkin <nikita@trvn.ru> # ltr559
Link: https://lore.kernel.org/r/20210610134619.2101372-4-mkl@pengutronix.de
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: ltr501: ltr559: fix initialization of LTR501_ALS_CONTR
Oliver Lang [Thu, 10 Jun 2021 13:46:17 +0000 (15:46 +0200)]
iio: ltr501: ltr559: fix initialization of LTR501_ALS_CONTR

The ltr559 chip uses only the lowest bit of the ALS_CONTR register to
configure between active and stand-by mode. In the original driver
BIT(1) is used, which does a software reset instead.

This patch fixes the problem by using BIT(0) as als_mode_active for
the ltr559 chip.

Fixes: 8592a7eefa54 ("iio: ltr501: Add support for ltr559 chip")
Signed-off-by: Oliver Lang <Oliver.Lang@gossenmetrawatt.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Nikita Travkin <nikita@trvn.ru> # ltr559
Link: https://lore.kernel.org/r/20210610134619.2101372-3-mkl@pengutronix.de
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volat...
Marc Kleine-Budde [Thu, 10 Jun 2021 13:46:16 +0000 (15:46 +0200)]
iio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volatile, too

The regmap is configured for 8 bit registers, uses a RB-Tree cache and
marks several registers as volatile (i.e. do not cache).

The ALS and PS data registers in the chip are 16 bit wide and spans
two regmap registers. In the current driver only the base register is
marked as volatile, resulting in the upper register only read once.

Further the data sheet notes:

| When the I2C read operation starts, all four ALS data registers are
| locked until the I2C read operation of register 0x8B is completed.

Which results in the registers never update after the 2nd read.

This patch fixes the problem by marking the upper 8 bits of the ALS
and PS registers as volatile, too.

Fixes: 2f2c96338afc ("iio: ltr501: Add regmap support.")
Reported-by: Oliver Lang <Oliver.Lang@gossenmetrawatt.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Tested-by: Nikita Travkin <nikita@trvn.ru> # ltr559
Link: https://lore.kernel.org/r/20210610134619.2101372-2-mkl@pengutronix.de
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: scmi: fix spelling of SPDX tag
Tom Rix [Thu, 10 Jun 2021 21:44:36 +0000 (14:44 -0700)]
iio: scmi: fix spelling of SPDX tag

checkpatch looks for SPDX-License-Identifier.
Remove the extra spaces.

Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20210610214438.3161140-7-trix@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: accel: bma180/bmc150: Move BMA254 to bmc150-accel driver
Stephan Gerhold [Fri, 11 Jun 2021 08:09:03 +0000 (10:09 +0200)]
iio: accel: bma180/bmc150: Move BMA254 to bmc150-accel driver

Commit c1d1c4a62db5 ("iio: accel: bma180: BMA254 support") added
BMA254 support to the bma180 driver and changed some naming to BMA25x
to make it easier to add support for BMA253 and BMA255.

Unfortunately, there is quite some overlap between the bma180 driver
and the bmc150-accel driver. Back when the commit was made, the
bmc150-accel driver actually already had support for BMA255, and
adding support for BMA254 would have been as simple as adding a new
compatible to bmc150-accel.

The bmc150-accel driver is a bit better for BMA254 since it also
supports the motion trigger/interrupt functionality. Fortunately,
moving BMA254 support over to bmc150-accel is fairly simple because
the drivers have compatible device tree bindings.

Revert most of the changes for BMA254 support in bma180 and move
BMA254 over to bmc150-accel. This has the following advantages:

  - Support for motion trigger/interrupt
  - Fix incorrect scale values (BMA254 currently uses the same as
    BMA250 but actually they're different because of 10 vs 12 bits
    data size)
  - Less code than before :)

BMA250 could be potentially also moved but it's more complicated
because its chip_id conflicts with the one for BMA222 in bmc150-accel.
Perhaps there are also other register differences, I did not investigate
further yet (and I have no way to test it).

Cc: Peter Meerwald <pmeerw@pmeerw.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20210611080903.14384-11-stephan@gerhold.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: accel: bma180/bma255: Move bma254 to bma255 schema
Stephan Gerhold [Fri, 11 Jun 2021 08:09:02 +0000 (10:09 +0200)]
dt-bindings: iio: accel: bma180/bma255: Move bma254 to bma255 schema

BMA254 is very similar to BMA253/BMA255 which are both supported by
the bmc150-accel driver. In general, there is quite some overlap between
the bma180 and bmc150-accel driver, but the bmc150-accel driver has a few
more features (e.g. motion trigger/interrupt).

Let's move bma254 over to the bma255 schema (bmc150-accel driver).

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20210611080903.14384-10-stephan@gerhold.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: bma255: Allow multiple interrupts
Stephan Gerhold [Fri, 11 Jun 2021 08:09:01 +0000 (10:09 +0200)]
dt-bindings: iio: bma255: Allow multiple interrupts

BMA253 has two interrupt pins (INT1 and INT2) that can be configured
independently. At the moment the bmc150-accel driver does not make use
of them but it might be able to in the future, so it's useful to already
specify all available interrupts in the device tree.

Set maxItems: 2 for interrupts to allow specifying a second one.
This is necessary as preparation to move the bosch,bma254 compatible
from bosch,bma180.yaml to bosch,bma255.yaml since bma180 allows two
interrupts, but BMA254 is better supported by the bmc150-accel driver.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20210611080903.14384-9-stephan@gerhold.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: accel: bmc150: Add device IDs for BMA253
Stephan Gerhold [Fri, 11 Jun 2021 08:09:00 +0000 (10:09 +0200)]
iio: accel: bmc150: Add device IDs for BMA253

BMA253 is mostly like BMA255 and has exactly the same register layout
as used by the bmc150-accel driver as far I can tell. Making it work
is as simple as adding new device IDs for it since it has the same
chip_id = 0xFA (250) as BMA255 and others.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20210611080903.14384-8-stephan@gerhold.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agodt-bindings: iio: accel: bma255: Document bosch,bma253
Stephan Gerhold [Fri, 11 Jun 2021 08:08:59 +0000 (10:08 +0200)]
dt-bindings: iio: accel: bma255: Document bosch,bma253

BMA253 is mostly like BMA255 that is already supported by the
bmc150-accel driver. Document an extra bosch,bma253 compatible for it.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20210611080903.14384-7-stephan@gerhold.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: accel: bmc150: Sort all chip names alphabetically / by chip ID
Stephan Gerhold [Fri, 11 Jun 2021 08:08:58 +0000 (10:08 +0200)]
iio: accel: bmc150: Sort all chip names alphabetically / by chip ID

Right now all the device IDs are listed in seemingly random order,
make this consistent by ordering those alphabetically. Also, order
bmc150_accel_chip_info_tbl by chip ID for the same reason.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20210611080903.14384-6-stephan@gerhold.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
3 years agoiio: accel: bmc150: Drop duplicated documentation of supported chips
Stephan Gerhold [Fri, 11 Jun 2021 08:08:57 +0000 (10:08 +0200)]
iio: accel: bmc150: Drop duplicated documentation of supported chips

The chips supported by the bmc150-accel driver are clearly documented
in Kconfig, in the bmc150_accel_chip_info_tbl as well as in all the
device ID tables in the I2C/SPI drivers. It's easy to forget to update
the lists in the file header. Drop those entirely to reduce the amount
of changes required to add new chip variants.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20210611080903.14384-5-stephan@gerhold.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>