Alexandru Ardelean [Mon, 15 Feb 2021 10:40:29 +0000 (12:40 +0200)]
iio: core: rework iio device group creation
Up until now, the device groups that an IIO device had were limited to 6.
Two of these groups would account for buffer attributes (the buffer/ and
scan_elements/ directories).
Since we want to add multiple buffers per IIO device, this number may not
be enough, when adding a second buffer. So, this change reallocates the
groups array whenever an IIO device group is added, via a
iio_device_register_sysfs_group() helper.
This also means that the groups array should be assigned to
'indio_dev.dev.groups' really late, right before {cdev_}device_add() is
called to do the entire setup.
And we also must take care to free this array when the sysfs resources are
being cleaned up.
With this change we can also move the 'groups' & 'groupcounter' fields to
the iio_dev_opaque object. Up until now, this didn't make a whole lot of
sense (especially since we weren't sure how multibuffer support would look
like in the end).
But doing it now kills one birds with one stone.
An alternative, would be to add a configurable Kconfig symbol
CONFIG_IIO_MAX_BUFFERS_PER_DEVICE (or something like that) and compute a
static maximum of the groups we can support per IIO device. But that would
probably annoy a few people since that would make the system less
configurable.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-11-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 15 Feb 2021 10:40:28 +0000 (12:40 +0200)]
iio: core-trigger: make iio_device_register_trigger_consumer() an int return
Oddly enough the noop function is an int-return. This one seems to be void.
This change converts it to int, because we want to change how groups are
registered. With that change this function could error out with -ENOMEM.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-10-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 15 Feb 2021 10:40:27 +0000 (12:40 +0200)]
iio: core: register chardev only if needed
We only need a chardev if we need to support buffers and/or events.
With this change, a chardev will be created only if an IIO buffer is
attached OR an event_interface is configured.
Otherwise, no chardev will be created, and the IIO device will get
registered with the 'device_add()' call.
Quite a lot of IIO devices don't really need a chardev, so this is a minor
improvement to the IIO core, as the IIO device will take up (slightly)
fewer resources.
In order to not create a chardev, we mostly just need to not initialize the
indio_dev->dev.devt field. If that is un-initialized, cdev_device_add()
behaves like device_add().
This change has a small chance of breaking some userspace ABI, because it
removes un-needed chardevs. While these chardevs (that are being removed)
have always been unusable, it is likely that some scripts may check their
existence (for whatever logic).
And we also hope that before opening these chardevs, userspace would have
already checked for some pre-conditions to make sure that opening these
chardevs makes sense.
For the most part, there is also the hope that it would be easier to change
userspace code than revert this. But in the case that reverting this is
required, it should be easy enough to do it.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-9-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 15 Feb 2021 10:40:26 +0000 (12:40 +0200)]
docs: ioctl-number.rst: reserve IIO subsystem ioctl() space
Currently, only the 'i' 0x90 ioctl() actually exists and is defined in
'include/uapi/linux/iio/events.h'.
It's the IIO_GET_EVENT_FD_IOCTL, which is used to retrieve and FD for
reading events from an IIO device.
We will want to add more ioct() numbers, so with this change the 'i'
0x90-0x9F space is reserved for IIO ioctl() calls.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-8-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 15 Feb 2021 10:40:25 +0000 (12:40 +0200)]
iio: buffer-dma,adi-axi-adc: introduce devm_iio_dmaengine_buffer_setup()
This change does a conversion of the devm_iio_dmaengine_buffer_alloc() to
devm_iio_dmaengine_buffer_setup(). This will allocate an IIO DMA buffer and
attach it to the IIO device, similar to devm_iio_triggered_buffer_setup()
(though the underlying code is different, the final logic is the same).
Since the only user of the devm_iio_dmaengine_buffer_alloc() was the
adi-axi-adc driver, this change does the replacement in a single go in the
driver.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-7-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 15 Feb 2021 10:40:24 +0000 (12:40 +0200)]
iio: kfifo: un-export devm_iio_kfifo_allocate() function
At this point all drivers should use devm_iio_kfifo_buffer_setup() instead
of manually allocating via devm_iio_kfifo_allocate() and assigning ops and
modes.
With this change, the devm_iio_kfifo_allocate() will be made private to the
IIO core, since all drivers should call either
devm_iio_kfifo_buffer_setup() or devm_iio_triggered_buffer_setup() to
create a kfifo buffer.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-6-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 15 Feb 2021 10:40:23 +0000 (12:40 +0200)]
iio: accel: sca3000: use devm_iio_kfifo_buffer_setup() helper
This change makes use of the devm_iio_kfifo_buffer_setup() helper, however
the unwind order is changed.
The life-time of the kfifo object is attached to the parent device object.
This is to make the driver a bit more consistent with the other IIO
drivers, even though (as it is now before this change) it shouldn't be a
problem.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-5-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 15 Feb 2021 10:40:22 +0000 (12:40 +0200)]
iio: make use of devm_iio_kfifo_buffer_setup() helper
All drivers that already call devm_iio_kfifo_allocate() &
iio_device_attach_buffer() are simple to convert to
iio_device_attach_kfifo_buffer() in a single go.
This change does that; the unwind order is preserved.
What is important, is that the devm_iio_kfifo_buffer_setup() be called
after the indio_dev->modes is assigned, to make sure that
INDIO_BUFFER_SOFTWARE flag is set and not overridden by the assignment to
indio_dev->modes.
Also, the INDIO_BUFFER_SOFTWARE has been removed from the assignments of
'indio_dev->modes' because it is set by devm_iio_kfifo_buffer_setup().
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>x
Link: https://lore.kernel.org/r/20210215104043.91251-4-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Alexandru Ardelean [Mon, 15 Feb 2021 10:40:21 +0000 (12:40 +0200)]
iio: kfifo: add devm_iio_kfifo_buffer_setup() helper
This change adds the devm_iio_kfifo_buffer_setup() helper/short-hand,
which groups the simple routine of allocating a kfifo buffers via
devm_iio_kfifo_allocate() and calling iio_device_attach_buffer().
The mode_flags parameter is required, as the IIO kfifo supports 2 modes:
INDIO_BUFFER_SOFTWARE & INDIO_BUFFER_TRIGGERED.
The setup_ops parameter is optional.
This function will be a bit more useful when needing to define multiple
buffers per IIO device.
The naming for this function has been inspired from
iio_triggered_buffer_setup() since that one does a kfifo alloc + a pollfunc
alloc. So, this should have a more familiar ring to what it is.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210215104043.91251-3-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lars-Peter Clausen [Tue, 15 Dec 2020 19:17:43 +0000 (20:17 +0100)]
iio: Add basic unit test for iio_format_value()
The IIO core provides a function to do formatting of fixedpoint numbers.
In the past there have been some issues with the implementation of the
function where for example negative numbers were not handled correctly.
Introduce a basic unit test based on kunit that tests the function and
ensures that the generated output matches the expected output.
This gives us some confidence that future modifications to the function
implementation will not break ABI compatibility.
To run the unit tests follow the kunit documentation and add
CONFIG_IIO=y
CONFIG_IIO_TEST_FORMAT=y
to the .kunitconfig and run
> ./tools/testing/kunit/kunit.py run
Configuring KUnit Kernel ...
Building KUnit Kernel ...
Starting KUnit Kernel ...
============================================================
======== [PASSED] iio-format ========
[PASSED] iio_test_iio_format_value_integer
[PASSED] iio_test_iio_format_value_fixedpoint
[PASSED] iio_test_iio_format_value_fractional
[PASSED] iio_test_iio_format_value_fractional_log2
[PASSED] iio_test_iio_format_value_multiple
============================================================
Testing complete. 21 tests run. 0 failed. 0 crashed.
Elapsed time: 8.242s total, 0.001s configuring, 3.865s building, 0.000s running
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20201215191743.2725-3-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lars-Peter Clausen [Tue, 15 Dec 2020 19:17:42 +0000 (20:17 +0100)]
iio: iio_format_value(): Fix IIO_VAL_FRACTIONAL_LOG2 values between -1.0 and 0.0
When formatting a value using IIO_VAL_FRACTIONAL_LOG2 and the values is
between -1 and 0 the sign is omitted.
We need the same trick as for IIO_VAL_FRACTIONAL to make sure this gets
formatted correctly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20201215191743.2725-2-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Lars-Peter Clausen [Tue, 15 Dec 2020 19:17:41 +0000 (20:17 +0100)]
iio: iio_format_value(): Use signed temporary for IIO_VAL_FRACTIONAL_LOG2
IIO_VAL_FRACTIONAL_LOG2 works with signed values, yet the temporary we use
is unsigned. This works at the moment because the variable is implicitly
cast to signed everywhere where it is used.
But it will certainly be cleaner to use a signed variable in the first
place.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/20201215191743.2725-1-lars@metafoo.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Bhaskar Chowdhury [Wed, 10 Feb 2021 08:57:04 +0000 (14:27 +0530)]
iio: proximity: sx9500: Fix a spelling postive to positive
s/postive/positive/
Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20210210085704.1228068-1-unixbhaskar@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hans de Goede [Sun, 7 Feb 2021 16:09:01 +0000 (17:09 +0100)]
iio: accel: kxcjk-1013: Set label based on accel-location on 2-accel yoga-style 2-in-1s
Some 2-in-1 laptops / convertibles with 360° (yoga-style) hinges,
use 2 KXCJ91008 accelerometers:
1 in their display using an ACPI HID of "KIOX010A"; and
1 in their base using an ACPI HID of "KIOX020A"
Since in this case we know the location of each accelerometer,
set the label for the accelerometers to the standardized
"accel-display" resp. "accel-base" labels. This way userspace
can use the labels to get the location.
This was tested on a Medion Akoya E2228T MD60250.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210207160901.110643-4-hdegoede@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hans de Goede [Sun, 7 Feb 2021 16:09:00 +0000 (17:09 +0100)]
iio: accel: bmc150: Set label based on accel-location on 2-accel yoga-style 2-in-1s
Some 2-in-1 laptops / convertibles with 360° (yoga-style) hinges,
use 2 bmc150 accelerometers, defined by a single BOSC0200 ACPI
device node (1 in their base and 1 in their display).
Since in this case we know the location of each accelerometer,
set the label for the accelerometers to the standardized
"accel-display" resp. "accel-base" labels. This way userspace
can use the labels to get the location.
This was tested on a Lenovo ThinkPad Yoga 11e 4th gen (N3450 CPU).
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210207160901.110643-3-hdegoede@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Hans de Goede [Sun, 7 Feb 2021 16:08:59 +0000 (17:08 +0100)]
iio: core: Allow drivers to specify a label without it coming from of
Only set indio_dev->label from of/dt if there actually is a label
specified in of.
This allows drivers to set a label without this being overwritten with
NULL when there is no label specified in of. This is esp. useful on
devices where of is not used at all, such as your typical x86/ACPI device.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20210207160901.110643-2-hdegoede@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Tomislav Denis [Tue, 2 Feb 2021 08:41:07 +0000 (09:41 +0100)]
bindings: iio: adc: Add documentation for ADS131E0x ADC driver
Add a device tree binding documentation for Texas Instruments
ADS131E0x ADC family driver.
Signed-off-by: Tomislav Denis <tomislav.denis@avl.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210202084107.3260-3-tomislav.denis@avl.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Tomislav Denis [Tue, 2 Feb 2021 08:41:06 +0000 (09:41 +0100)]
iio: adc: Add driver for Texas Instruments ADS131E0x ADC family
The ADS131E0x are a family of multichannel, simultaneous sampling,
24-bit, delta-sigma, analog-to-digital converters (ADCs) with a
built-in programmable gain amplifier (PGA), internal reference
and an onboard oscillator.
Datasheet: https://www.ti.com/lit/ds/symlink/ads131e08.pdf
Signed-off-by: Tomislav Denis <tomislav.denis@avl.com>
Link: https://lore.kernel.org/r/20210202084107.3260-2-tomislav.denis@avl.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Mike Looijmans [Mon, 25 Jan 2021 15:07:32 +0000 (16:07 +0100)]
iio: accel: Add support for the Bosch-Sensortec BMI088
The BMI088 is a combined module with both accelerometer and gyroscope.
This adds the accelerometer driver support for the SPI interface.
The gyroscope part is already supported by the BMG160 driver.
Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210125150732.23873-2-mike.looijmans@topic.nl
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Mike Looijmans [Mon, 25 Jan 2021 15:07:31 +0000 (16:07 +0100)]
dt-bindings: iio: accel: Add bmi088 accelerometer bindings
This adds the device-tree bindings for the Bosch Sensortec BMI088 IMU,
the accelerometer part.
Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210125150732.23873-1-mike.looijmans@topic.nl
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
zuoqilin [Thu, 28 Jan 2021 02:19:05 +0000 (10:19 +0800)]
iio:adc:dac:ad5791 typo fix of regster
change 'regster' to 'register'
Signed-off-by: zuoqilin <zuoqilin@yulong.com>
Link: https://lore.kernel.org/r/20210128021905.963-1-zuoqilin1@163.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Peter Meerwald-Stadler [Mon, 25 Jan 2021 19:56:54 +0000 (20:56 +0100)]
MAINTAINERS: iio: move Peter Meerwald-Stadler to CREDITS
Haven't had much time lately and moved on to different things.
Thanks Jonathan for the gentle introduction to Linux land.
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
Link: https://lore.kernel.org/r/20210125195654.580465-1-pmeerw@pmeerw.net
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Ahmad Fatoum [Mon, 25 Jan 2021 19:48:23 +0000 (20:48 +0100)]
iio: adc: stm32-adc: enable timestamping for non-DMA usage
For non-DMA usage, we have an easy way to associate a timestamp with a
sample: iio_pollfunc_store_time stores a timestamp in the primary
trigger IRQ handler and stm32_adc_trigger_handler runs in the IRQ thread
to push out the buffer along with the timestamp.
For this to work, the driver needs to register an IIO_TIMESTAMP channel.
Do this.
For DMA, it's not as easy, because we don't push the buffers out of
stm32_adc_trigger, but out of stm32_adc_dma_buffer_done, which runs in
a tasklet scheduled after a DMA completion.
Preferably, the DMA controller would copy us the timestamp into that buffer
as well. Until this is implemented, restrict timestamping support to
only PIO. For low-frequency sampling, PIO is probably good enough.
Cc: Holger Assmann <has@pengutronix.de>
Acked-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.kernel.org/r/20210125194824.30549-1-a.fatoum@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Ye Xiang [Sat, 30 Jan 2021 10:25:46 +0000 (18:25 +0800)]
iio: hid-sensor-rotation: Fix quaternion data not correct
Because the data of HID_USAGE_SENSOR_ORIENT_QUATERNION defined by ISH FW
is s16, but quaternion data type is in_rot_quaternion_type(le:s16/32X4>>0),
need to transform data type from s16 to s32
May require manual backporting.
Fixes:
fc18dddc0625 ("iio: hid-sensors: Added device rotation support")
Signed-off-by: Ye Xiang <xiang.ye@intel.com>
Link: https://lore.kernel.org/r/20210130102546.31397-1-xiang.ye@intel.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
William Breathitt Gray [Sat, 30 Jan 2021 02:37:03 +0000 (11:37 +0900)]
counter: 104-quad-8: Remove IIO counter ABI
The IIO counter driver has been superseded by the Counter subsystem as
discussed in [1]. This patch removes the IIO counter ABI from the
104-QUAD-8 driver.
[1] https://lore.kernel.org/lkml/
20210119104105.
000010df@Huawei.com/
Cc: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/98a39983d5df761c058a469d1346fd8ffdef8516.1611973018.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fabrice Gasnier [Fri, 29 Jan 2021 13:22:22 +0000 (14:22 +0100)]
counter: stm32-lptimer-cnt: remove iio counter abi
Currently, the STM32 LP Timer counter driver registers into both IIO and
counter subsystems, which is redundant.
Remove the IIO counter ABI and IIO registration from the STM32 LP Timer
counter driver since it's been superseded by the Counter subsystem
as discussed in [1].
Keep only the counter subsystem related part.
Move a part of the ABI documentation into a driver comment.
This also removes a duplicate ABI warning
$ scripts/get_abi.pl validate
...
/sys/bus/iio/devices/iio:deviceX/in_count0_preset is defined 2 times:
./Documentation/ABI/testing/sysfs-bus-iio-timer-stm32:100
./Documentation/ABI/testing/sysfs-bus-iio-lptimer-stm32:0
[1] https://lkml.org/lkml/2021/1/19/347
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/1611926542-2490-1-git-send-email-fabrice.gasnier@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Jonathan Cameron [Sun, 24 Jan 2021 19:10:22 +0000 (19:10 +0000)]
iio:adc:stm32-adc: Add HAS_IOMEM dependency
Seems that there are config combinations in which this driver gets enabled
and hence selects the MFD, but with out HAS_IOMEM getting pulled in
via some other route. MFD is entirely contained in an
if HAS_IOMEM block, leading to the build issue in this bugzilla.
https://bugzilla.kernel.org/show_bug.cgi?id=209889
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Ahmad Fatoum [Thu, 21 Jan 2021 15:39:44 +0000 (16:39 +0100)]
iio: st_sensors: fix typo in comment
s/timetamping/timestamping/
Cc: trivial@kernel.org
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.kernel.org/r/20210121153945.5499-1-a.fatoum@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Klemen Košir [Wed, 3 Mar 2021 09:01:34 +0000 (18:01 +0900)]
staging: unisys: visornic: Fix repeated words in comments
This patch removes some repeated words in code comments.
Signed-off-by: Klemen Košir <klemen.kosir@kream.io>
Link: https://lore.kernel.org/r/20210303090134.16007-1-klemen.kosir@kream.io
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Song Chen [Tue, 12 Jan 2021 08:25:40 +0000 (16:25 +0800)]
staging: unisys: visornic: enhance visornic to use channel_interrupt
visornic uses timer to check the response queue and drain
it if needed periodically. On the other hand, visorbus
provides periodic work to serve such request, therefore,
timer should be replaced by channel_interrupt.
Signed-off-by: Song Chen <chensong_2000@189.cn>
Link: https://lore.kernel.org/r/1610439940-5590-1-git-send-email-chensong_2000@189.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kumar Kartikeya Dwivedi [Sun, 21 Feb 2021 15:42:59 +0000 (21:12 +0530)]
staging/greybus: eliminate use of NAME_SIZE for strings
Instead, depend on the size of the destination buffer for easier
refactoring.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20210221154258.119503-1-memxor@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gustavo A. R. Silva [Thu, 4 Mar 2021 02:02:28 +0000 (20:02 -0600)]
staging: rtl8188eu: Replace one-element array with flexible-array in struct ndis_802_11_var_ie
There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members”[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].
Use flexible-array member in struct ndis_802_11_var_ie, instead of
one-element array.
Also, this helps with the ongoing efforts to enable -Warray-bounds by
fixing the following warning:
drivers/staging/rtl8188eu/core/rtw_wlan_util.c: In function ‘HT_caps_handler’:
drivers/staging/rtl8188eu/core/rtw_wlan_util.c:665:65: warning: array subscript 2 is above array bounds of ‘u8[1]’ {aka ‘unsigned char[1]’} [-Warray-bounds]
665 | if ((pmlmeinfo->HT_caps.ampdu_params_info & 0x3) > (pIE->data[i] & 0x3))
| ~~~~~~~~~^~~
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.9/process/deprecated.html#zero-length-and-one-element-arrays
Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/109
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20210304020228.GA45139@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Marco Cesati [Fri, 5 Mar 2021 10:01:46 +0000 (11:01 +0100)]
staging: HalBtc8723b1Ant: remove useless typedef's
This commit fixes the following checkpatch.pl warnings:
WARNING: do not add new typedefs
#24: FILE: hal/HalBtc8723b1Ant.h:24:
+typedef enum _BT_INFO_SRC_8723B_1ANT {
WARNING: do not add new typedefs
#31: FILE: hal/HalBtc8723b1Ant.h:31:
+typedef enum _BT_8723B_1ANT_BT_STATUS {
WARNING: do not add new typedefs
#41: FILE: hal/HalBtc8723b1Ant.h:41:
+typedef enum _BT_8723B_1ANT_WIFI_STATUS {
WARNING: do not add new typedefs
#51: FILE: hal/HalBtc8723b1Ant.h:51:
+typedef enum _BT_8723B_1ANT_COEX_ALGO {
WARNING: do not add new typedefs
#66: FILE: hal/HalBtc8723b1Ant.h:66:
+typedef struct _COEX_DM_8723B_1ANT {
WARNING: do not add new typedefs
#121: FILE: hal/HalBtc8723b1Ant.h:121:
+typedef struct _COEX_STA_8723B_1ANT {
Signed-off-by: Marco Cesati <marco.cesati@gmail.com>
Link: https://lore.kernel.org/r/20210305100146.30687-1-marco.cesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Marco Cesati [Fri, 5 Mar 2021 10:11:51 +0000 (11:11 +0100)]
staging: HalBtc8723b2Ant: remove useless typedef's
This commit fixes the following checkpatch.pl warnings:
WARNING: do not add new typedefs
#19: FILE: hal/HalBtc8723b2Ant.h:19:
+typedef enum _BT_INFO_SRC_8723B_2ANT {
WARNING: do not add new typedefs
#26: FILE: hal/HalBtc8723b2Ant.h:26:
+typedef enum _BT_8723B_2ANT_BT_STATUS {
WARNING: do not add new typedefs
#36: FILE: hal/HalBtc8723b2Ant.h:36:
+typedef enum _BT_8723B_2ANT_COEX_ALGO {
WARNING: do not add new typedefs
#51: FILE: hal/HalBtc8723b2Ant.h:51:
+typedef struct _COEX_DM_8723B_2ANT {
WARNING: do not add new typedefs
#104: FILE: hal/HalBtc8723b2Ant.h:104:
+typedef struct _COEX_STA_8723B_2ANT {
Signed-off-by: Marco Cesati <marco.cesati@gmail.com>
Link: https://lore.kernel.org/r/20210305101151.13137-1-marco.cesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Denis Efremov [Fri, 5 Mar 2021 15:50:01 +0000 (18:50 +0300)]
staging: rtl8723bs: remove duplicate pstat->hwaddr check
IS_MCAST(pstat->hwaddr) checked twice in a row in
odm_RefreshRateAdaptiveMaskCE(). Remove the second check.
Signed-off-by: Denis Efremov <efremov@linux.com>
Link: https://lore.kernel.org/r/20210305155001.61951-1-efremov@linux.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Marco Cesati [Fri, 5 Mar 2021 14:49:06 +0000 (15:49 +0100)]
staging: rtl8723bs: remove useless typedef's in HalPhyRf.h
This commit fixes the following checkpatch.pl warnings:
WARNING: do not add new typedefs
#11: FILE: hal/HalPhyRf.h:11:
+typedef enum _SPUR_CAL_METHOD {
WARNING: do not add new typedefs
#16: FILE: hal/HalPhyRf.h:16:
+typedef enum _PWRTRACK_CONTROL_METHOD {
WARNING: do not add new typedefs
#27: FILE: hal/HalPhyRf.h:27:
+typedef struct _TXPWRTRACK_CFG {
Signed-off-by: Marco Cesati <marco.cesati@gmail.com>
Link: https://lore.kernel.org/r/20210305144906.18850-1-marco.cesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fabio Aiuto [Fri, 5 Mar 2021 19:17:16 +0000 (20:17 +0100)]
staging: rtl8723bs: removed unused code block
Removed conditional code block checked by unused CONFIG_TX_BCAST2UNI
This patch does the cleaning required in TODO file:
find and remove code blocks guarded by never set CONFIG_FOO defines
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/20210305191713.GA2466@agape.jhs
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Michael Straube [Sat, 6 Mar 2021 08:11:33 +0000 (09:11 +0100)]
staging: rtl8188eu: rename parameters of odm_phy_status_query()
Rename parameters of odm_phy_status_query() to avoid camel case.
pDM_Odm -> dm_odm
pPhyInfo -> phy_info
pPhyStatus -> phy_status
pPktinfo -> pkt_info
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20210306081133.1272-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Michael Straube [Sat, 6 Mar 2021 08:11:32 +0000 (09:11 +0100)]
staging: rtl8188eu: rename ODM_PhyStatusQuery()
Rename ODM_PhyStatusQuery() to odm_phy_status_query() to avoid camel
case.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20210306081133.1272-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Jia-Ju Bai [Sat, 6 Mar 2021 13:22:45 +0000 (05:22 -0800)]
staging: vc04_services: vchiq_arm: fix error return code of vchiq_release_internal() and vchiq_use_internal()
When arm_state is NULL, no error return code of vchiq_release_internal()
and vchiq_use_internal() is assigned.
To fix this bug, ret is assigned with VCHIQ_ERROR.
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20210306132245.16811-1-baijiaju1990@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Giovanni Gherdovich [Sat, 6 Mar 2021 14:13:22 +0000 (15:13 +0100)]
staging: ralink-gdma: Check return code of device_reset
The device_reset() function is marked as "__must_check", thus the static
analysis tool "sparse" complains that in ralink-gdma its return value is
ignored. Log a warning in case it returns an error.
Signed-off-by: Giovanni Gherdovich <bobdc9664@seznam.cz>
Link: https://lore.kernel.org/r/20210306141322.7516-1-bobdc9664@seznam.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Darryl T. Agostinelli [Mon, 8 Mar 2021 14:48:39 +0000 (08:48 -0600)]
staging: wimax: i2400m: fix some incorrect type warnings
Fix some "incorrect type in assignment" warnings reported by sparse in fw.c
sparse warnings:
wimax/i2400m/fw.c:266:27: warning: cast to restricted __le32
wimax/i2400m/fw.c:266:25: warning: incorrect type in assignment (different base types)
wimax/i2400m/fw.c:267:27: warning: cast to restricted __le32
wimax/i2400m/fw.c:267:25: warning: incorrect type in assignment (different base types)
wimax/i2400m/fw.c:268:27: warning: cast to restricted __le32
wimax/i2400m/fw.c:268:25: warning: incorrect type in assignment (different base types)
wimax/i2400m/fw.c:269:27: warning: cast to restricted __le32
wimax/i2400m/fw.c:269:25: warning: incorrect type in assignment (different base types)
Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com>
Link: https://lore.kernel.org/r/20210308144839.2364329-1-dagostinelli@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
karthik alapati [Sun, 21 Feb 2021 15:31:28 +0000 (21:01 +0530)]
staging: wimax/i2400m: convert __le32 type to host byte-order
fix sparse type warning by converting __le32 types
to host byte-order types before comparison
Signed-off-by: karthik alapati <mail@karthek.com>
Link: https://lore.kernel.org/r/87f93e091f736cb422f1d557fa5a2ac752f057a8.1613921277.git.mail@karthek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
karthik alapati [Sun, 21 Feb 2021 15:31:05 +0000 (21:01 +0530)]
staging: wimax/i2400m: fix byte-order issue
fix sparse byte-order warnings by converting host byte-order
type to __le16 byte-order types before assigning to hdr.length
Signed-off-by: karthik alapati <mail@karthek.com>
Link: https://lore.kernel.org/r/0ae5c5c4c646506d8be871e7be5705542671a1d5.1613921277.git.mail@karthek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Nikolay Kyx [Tue, 2 Mar 2021 13:32:17 +0000 (16:32 +0300)]
staging: rtl8192e: remove redundant variable shadowing
In function rtl92e_start_adapter() automatic variable 'i' referenced only
within certain loops, used as iteration counter. Control flow can't get
into such loop w/o 'i = 0' assignment.
It's redundant to shadow this variable by creating scope around loop.
This patch fixes the following sparse warning:
warning: symbol 'i' shadows an earlier one
Signed-off-by: Nikolay Kyx <knv418@gmail.com>
Link: https://lore.kernel.org/r/20210302133217.145994-1-knv418@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Mon, 1 Mar 2021 21:53:34 +0000 (21:53 +0000)]
staging: rtl8192e: reformat rx_ts_record struct
This change uses a space instead of tabs between the type and name of
each member of the struct.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210301215335.767-10-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Mon, 1 Mar 2021 21:53:33 +0000 (21:53 +0000)]
staging: rtl8192e: rename RxLastFragNum to rx_last_frag_num in rx_ts_record struct
Rename RxLastFragNum to rx_last_frag_num to silence a checkpatch warning
about CamelCase.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210301215335.767-9-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Mon, 1 Mar 2021 21:53:32 +0000 (21:53 +0000)]
staging: rtl8192e: rename RxLastSeqNum to rx_last_seq_num in rx_ts_record struct
Rename RxLastSeqNum to rx_last_seq_num to silence a checkpatch warning
about CamelCase.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210301215335.767-8-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Mon, 1 Mar 2021 21:53:31 +0000 (21:53 +0000)]
staging: rtl8192e: rename RxAdmittedBARecord to rx_admitted_ba_record in rx_ts_record struct
Rename RxAdmittedBARecord to rx_admitted_ba_record to silence a
checkpatch warning about CamelCase.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210301215335.767-7-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Mon, 1 Mar 2021 21:53:30 +0000 (21:53 +0000)]
staging: rtl8192e: rename RxPktPendingTimer to rx_pkt_pending_timer in rx_ts_record struct
Rename RxPktPendingTimer to rx_pkt_pending_timer to silence a checkpatch
warning about CamelCase.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210301215335.767-6-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Mon, 1 Mar 2021 21:53:29 +0000 (21:53 +0000)]
staging: rtl8192e: rename RxPendingPktList to rx_pending_pkt_list in rx_ts_record struct
Rename RxPendingPktList to rx_pending_pkt_list to silence a checkpatch
warning about CamelCase.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210301215335.767-5-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Mon, 1 Mar 2021 21:53:28 +0000 (21:53 +0000)]
staging: rtl8192e: rename RxTimeoutIndicateSeq to rx_timeout_indicate_seq in rx_ts_record struct
Rename RxTimeoutIndicateSeq to rx_timeout_indicate_seq to silence a
checkpatch warning about CamelCase.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210301215335.767-4-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Mon, 1 Mar 2021 21:53:27 +0000 (21:53 +0000)]
staging: rtl8192e: rename RxIndicateSeq to rx_indicate_seq in rx_ts_record struct
Rename RxIndicateSeq to rx_indicate_seq to silence a checkpatch warning
about CamelCase.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210301215335.767-3-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Mon, 1 Mar 2021 21:53:26 +0000 (21:53 +0000)]
staging: rtl8192e: rename TsCommonInfo to ts_common_info in rx_ts_record struct
Rename TsCommonInfo to ts_common_info to silence a checkpatch warning
about CamelCase.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210301215335.767-2-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Candy Febriyanto [Mon, 1 Mar 2021 15:00:11 +0000 (22:00 +0700)]
staging: rtl8723bs: os_dep: Replace sprintf with scnprintf
The use of sprintf with format string here means that there is a risk
that the writes will go out of bounds, replace it with scnprintf.
In one block of the translate_scan function sprintf is only called once
(it's not being used to concatenate strings) so there is no need to keep
the pointer "p", remove it.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Candy Febriyanto <cfebriyanto@gmail.com>
Link: https://lore.kernel.org/r/d76c5f1db8dbf02ac0ab954b0971ce24e5a8b9bd.1614610197.git.cfebriyanto@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Candy Febriyanto [Mon, 1 Mar 2021 15:01:50 +0000 (22:01 +0700)]
staging: rtl8723bs: hal: Replace sprintf with scnprintf
The use of sprintf with format string here means that there is a risk
that the writes will go out of bounds, replace it with scnprintf.
Also avoid unnecessarily passing "%s" on some of the function calls.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Candy Febriyanto <cfebriyanto@gmail.com>
Link: https://lore.kernel.org/r/ed564fb9e325f757b2b937df37689d40b96d8831.1614610197.git.cfebriyanto@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Candy Febriyanto [Mon, 1 Mar 2021 14:58:17 +0000 (21:58 +0700)]
staging: rtl8723bs: core: Replace sprintf with scnprintf
The use of sprintf with format string here means that there is a risk
that the writes will go out of bounds, replace it with scnprintf.
In on_action_public_default the variable "cnt" isn't being used for
anything meaningful so remove it.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Candy Febriyanto <cfebriyanto@gmail.com>
Link: https://lore.kernel.org/r/6c260641164d6856fc4447555fe739124cb27c19.1614610197.git.cfebriyanto@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Sat, 27 Feb 2021 22:22:37 +0000 (01:22 +0300)]
staging:rtl8712: replace cap_* definitions with native kernel WLAN_CAPABILITY_*
cap_* definitions duplicate WLAN_CAPABILITY_*. Remove cap_* definitions,
improve code consistency.
Reviewed-by: Mike Ximing Chen <mike.ximing.chen@intel.com>
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20210227222236.581490-5-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Sat, 27 Feb 2021 22:22:36 +0000 (01:22 +0300)]
staging:rtl8712: use IEEE80211_FCTL_* kernel definitions
_TO_DS_, _FROM_DS_, _MORE_FRAG_, _RETRY_, _PWRMGT_, _MORE_DATA_,
_PRIVACY_, _ORDER_ definitions are duplicate IEEE80211_FCTL_*
kernel definitions.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20210227222236.581490-4-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Sat, 27 Feb 2021 22:22:35 +0000 (01:22 +0300)]
staging:rtl8712: remove unused definitions from wifi.h
These definitions are not used and will not be useful in the future.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20210227222236.581490-3-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ivan Safonov [Sat, 27 Feb 2021 22:22:34 +0000 (01:22 +0300)]
staging:rtl8712: replace get_(d|s)a with ieee80211_get_(D|S)A
get_da()/get_sa() duplicate native ieee80211_get_(D|S)A functions.
Remove get_(d|s)a, use ieee80211_get_(D|S)A instead.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20210227222236.581490-2-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Lee Gibson [Fri, 26 Feb 2021 11:48:00 +0000 (11:48 +0000)]
staging: fwserial: minor coding style fix
Fixes this checkpatch warning
WARNING: Integer promotion: Using 'h' in '%04hx' is unnecessary
Signed-off-by: Lee Gibson <leegib@gmail.com>
Link: https://lore.kernel.org/r/20210226114800.316897-1-leegib@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Mon, 1 Mar 2021 16:57:57 +0000 (16:57 +0000)]
staging: comedi: dt2814: Clear stale AI data on detach
When the Comedi "detach" handler is called, it is possible that an extra
A/D conversion (triggered during termination of a Comedi asynchronous
command) is still in progress. In that case, the FINISH bit in the
Status register will eventually get set and there will be stale data
waiting to be read from the A/D Data register. The interrupt handler
will also be called if still connected at the time. That should all be
mostly harmless, but it would be better to wait for any such conversion
to complete and clear any stale data during the "detach". Add a custom
"detach" handler `dt2814_detach()` to do that if an interrupt handler
has been set up. (There is no need to do it if no interrupt handler was
set up because Comedi asynchronous command support is disabled in that
case.)
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210301165757.243065-7-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Mon, 1 Mar 2021 16:57:56 +0000 (16:57 +0000)]
staging: comedi: dt2814: Remove struct dt2814_private
The `ntrig` member of the `struct dt2814_private` pointed to by
`dev->private` is no longer used as a counter to determine the end of
acquisition for a Comedi asynchronous command. The other member
`curadscan` is also unused. Remove the allocation of the private data
during initialization and remove the definition of `struct
dt2814_private` since they are no longer needed.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210301165757.243065-6-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Mon, 1 Mar 2021 16:57:55 +0000 (16:57 +0000)]
staging: comedi: dt2814: Fix asynchronous command interrupt handling
The support for asynchronous commands in this driver is currently
broken. If interrupts are enabled, the interrupt handler is called at
the end of every A/D conversion. A/D conversions could be due to
software-triggered conversions resulting from Comedi `INSN_READ`
instruction handling, or due to timer-trigger conversions enabled when
a Comedi asynchronous command is set up. We only want the interrupt
handler to read a sample from the A/D Data register for timer-triggered
conversions, but currently it always reads the A/D Data register. Since
the A/D Data register is read twice (to read a 12-bit value from an
8-bit register), that probably interferes with the reading for
software-triggered conversions.
The interrupt handler does not currently do anything with the data, it
just ignores it. It should be written to the Comedi buffer if handling
an asynchronous command.
Other problems are that the driver has no Comedi `cancel` handler to
call when the asynchronous command is being stopped manually, and it
does not handle "infinite" acquisitions (when the command's `stop_src ==
TRIG_NONE`) properly.
Change the interrupt handler to check the timer enable (ENB) bit to
check the asynchronous command is active and return early if not
enabled. Also check the error (ERR) and "conversion complete" (FINISH)
bits, and return early if neither is set. Then the sample can be read
from the A/D Data register to clear the ERR and FINISH bits. If the ERR
bit was set, terminate the acquisition with an error, otherwise write
the data to the Comedi buffer and check for end of acquisition. Replace
the current check for end of acquisition, using the count of completed
scans in `scans_done` (updated by calls to `comedi_buf_write_samples()`)
when `stop_src == TRIG_COUNT`) and allowing "infinite" acquisitions when
`stop_src == TRIG_NONE`.
Add a `cancel` handler function `dt2814_ai_cancel()` that will be called
when the end of acquisition event is processed and when the acquisition
is stopped manually. It turns off the timer enable (ENB) bit in the
Control register, leaving the current channel selected.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210301165757.243065-5-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Mon, 1 Mar 2021 16:57:54 +0000 (16:57 +0000)]
staging: comedi: dt2814: Call dt2814_ai_clear() during initialization
The Comedi "attach" handler `dt2814_attach()` writes to the Control
register to turn off the timer enable 'ENB' bit, which triggers a
conversion. It then sleeps awhile and checks the Status register,
returning an error if the ERR bit is set. However, the ERR bit could
have been set due to the conversion being triggered while the A/D
converter was busy (unlikely) or due to the conversion being triggered
before some previous sample had been read from the A/D Data register.
Replace the existing code with a call to `dt2814_ai_clear()` which waits
for any conversion to finish and then clears any unread data or error
condition. A non-zero return value from `dt2814_ai_clear()` indicates a
time-out while waiting for the A/D converter to become non-busy. Return
an error in that case.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210301165757.243065-4-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Mon, 1 Mar 2021 16:57:53 +0000 (16:57 +0000)]
staging: comedi: dt2814: Don't wait for conversion in interrupt handler
When the interrupt handler decides the final sample has been acquired,
it turns off the timer enable (ENB) bit in the Command register. That
triggers another A/D conversion. The interrupt handler currently waits
for that to finish and then reads the resulting, unwanted sample. Since
the functions for handling Comedi read instructions and for setting up
asynchronous commands now call `dt2814_ai_clear()` to wait for and
discard any spurious A/D conversion, let's remove that code from the
interrupt handler.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210301165757.243065-3-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Mon, 1 Mar 2021 16:57:52 +0000 (16:57 +0000)]
staging: comedi: dt2814: Clear stale AI data before operation
When performing a Comedi read instruction or setting up an asynchronous
command on the AI subdevice, clear any stale data on the A/D registers
by waiting for the Status register's BUSY bit to clear (if set) and then
if the FINISH or ERR bit is set, reading the A/D Data register twice to
clear the stale data.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210301165757.243065-2-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shubhrajyoti Datta [Wed, 24 Feb 2021 13:10:39 +0000 (18:40 +0530)]
staging: clocking-wizard: Remove the hardcoding of the clock outputs
The number of output clocks are configurable in the hardware.
Currently the driver registers the maximum number of outputs.
Fix the same by registering only the outputs that are there.
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/1614172241-17326-8-git-send-email-shubhrajyoti.datta@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shubhrajyoti Datta [Wed, 24 Feb 2021 13:10:38 +0000 (18:40 +0530)]
staging: clocking-wizard: Add support for fractional support
Currently the set rate granularity is to integral divisors.
Add support for the fractional divisors.
Only the first output0 is fractional in the hardware.
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/1614172241-17326-7-git-send-email-shubhrajyoti.datta@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shubhrajyoti Datta [Wed, 24 Feb 2021 13:10:37 +0000 (18:40 +0530)]
staging: clocking-wizard: Add support for dynamic reconfiguration
The patch adds support for dynamic reconfiguration of clock output rate.
Output clocks are registered as dividers and set rate callback function
is used for dynamic reconfiguration.
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Co-developed-by: Chirag Parekh <chirag.parekh@xilinx.com>
Link: https://lore.kernel.org/r/1614172241-17326-6-git-send-email-shubhrajyoti.datta@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shubhrajyoti Datta [Wed, 24 Feb 2021 13:10:36 +0000 (18:40 +0530)]
staging: clocking-wizard: Allow changing of parent rate for single output
If there is only one output then allow changing of the parent rate.
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/1614172241-17326-5-git-send-email-shubhrajyoti.datta@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shubhrajyoti Datta [Wed, 24 Feb 2021 13:10:35 +0000 (18:40 +0530)]
staging: clocking-wizard: Update the fixed factor divisors
Update the fixed factor clock registration to register the divisors.
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/1614172241-17326-4-git-send-email-shubhrajyoti.datta@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shubhrajyoti Datta [Wed, 24 Feb 2021 13:10:34 +0000 (18:40 +0530)]
staging: clocking-wizard: Rename speed-grade to xlnx,speed-grade
Rename speed-grade to xlnx,speed-grade
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/1614172241-17326-3-git-send-email-shubhrajyoti.datta@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Shubhrajyoti Datta [Wed, 24 Feb 2021 13:10:33 +0000 (18:40 +0530)]
staging: clocking-wizard: Fix kernel-doc warning
Fix the clocking wizard main structure kernel documentation.
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/1614172241-17326-2-git-send-email-shubhrajyoti.datta@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:29:09 +0000 (17:29 +0000)]
staging: rtl8192e: reformat bss_ht struct
This change uses a space instead of tabs between the type and name of
each member of the struct.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-14-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:29:08 +0000 (17:29 +0000)]
staging: rtl8192e: rename bdHT1R to bd_ht_1r in bss_ht struct
Rename bdHT1R to bd_ht_1r to silence a checkpatch warning about
CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-13-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:29:07 +0000 (17:29 +0000)]
staging: rtl8192e: rename RT2RT_HT_Mode to rt2rt_ht_mode in bss_ht struct
Rename RT2RT_HT_Mode to rt2rt_ht_mode to silence a checkpatch warning
about CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-12-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:29:06 +0000 (17:29 +0000)]
staging: rtl8192e: rename bdRT2RTLongSlotTime to bd_rt2rt_long_slot_time in bss_ht struct
Rename bdRT2RTLongSlotTime to bd_rt2rt_long_slot_time to silence a
checkpatch warning about CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-11-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:29:05 +0000 (17:29 +0000)]
staging: rtl8192e: rename bdRT2RTAggregation to bd_rt2rt_aggregation in bss_ht struct
Rename bdRT2RTAggregation to bd_rt2rt_aggregation to silence a
checkpatch warning about CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-10-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:29:04 +0000 (17:29 +0000)]
staging: rtl8192e: rename bdBandWidth to bd_bandwidth in bss_ht struct
Rename bdBandWidth to bd_bandwidth to silence a checkpatch warning about
CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-9-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:29:03 +0000 (17:29 +0000)]
staging: rtl8192e: rename bdHTSpecVer to bd_ht_spec_ver in bss_ht struct
Rename bdHTSpecVer to bd_ht_spec_ver to silence a checkpatch warning
about CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-8-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:29:02 +0000 (17:29 +0000)]
staging: rtl8192e: rename bdHTInfoLen to bd_ht_info_len in bss_ht struct
Rename bdHTInfoLen to bd_ht_info_len to silence a checkpatch warning
about CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-7-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:29:01 +0000 (17:29 +0000)]
staging: rtl8192e: rename bdHTInfoBuf to bd_ht_info_buf in bss_ht struct
Rename bdHTInfoBuf to bd_ht_info_buf to silence a checkpatch warning
about CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-6-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:29:00 +0000 (17:29 +0000)]
staging: rtl8192e: rename bdHTCapLen to bd_ht_cap_len in bss_ht struct
Rename bdHTCapLen to bd_ht_cap_len to silence a checkpatch warning about
CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-5-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:28:59 +0000 (17:28 +0000)]
staging: rtl8192e: rename bdHTCapBuf to bd_ht_cap_buf in bss_ht struct
Rename bdHTCapBuf to bd_ht_cap_buf to silence a checkpatch warning about
CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-4-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:28:58 +0000 (17:28 +0000)]
staging: rtl8192e: rename bdSupportHT to bd_support_ht in bss_ht struct
Rename bdSupportHT to bd_support_ht to silence a checkpatch warning
about CamelCase.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-3-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Sat, 20 Feb 2021 17:28:57 +0000 (17:28 +0000)]
staging: rtl8192e: remove blank line in bss_ht struct
Fix a checkpatch warning about a blank line after an open curly brace.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210220172909.15812-2-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Hassan Shahbazi [Tue, 23 Feb 2021 06:42:29 +0000 (08:42 +0200)]
staging: wimax: fix code style issues
Fixes 'WARNING: Missing a blank line after declarations' generated by
checkpatch.pl script.
Signed-off-by: Hassan Shahbazi <h.shahbazi.git@gmail.com>
Link: https://lore.kernel.org/r/20210223064227.62631-1-h.shahbazi.git@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bastien Maureille [Mon, 22 Feb 2021 18:18:14 +0000 (19:18 +0100)]
staging: vc04_services: fix indent in vchiq_debugfs_node
Fix checkpatch.pl warning regarding space indents and replace it with
tabs to comply with kernel coding style.
Signed-off-by: Bastien Maureille <bastien.maureille@gmail.com>
Link: https://lore.kernel.org/r/20210222181812.268909-1-bastien.maureille@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Simone Serra [Tue, 23 Feb 2021 23:41:02 +0000 (00:41 +0100)]
staging: rt8192u: Move constant in comparison to the RHS
Fixes checkpatch warning:
WARNING: Comparisons should place the constant on the right side of the test
Signed-off-by: Simone Serra <serrazimone@gmail.com>
Link: https://lore.kernel.org/r/20210223234102.15784-1-serrazimone@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Amrit Khera [Mon, 22 Feb 2021 10:15:42 +0000 (15:45 +0530)]
staging: wimax: Fix block comment style issue in stack.c
This change fixes a checkpatch warning for "Block comments use
* on subsequent lines". It removes the unnecessary block comment.
Signed-off-by: Amrit Khera <amritkhera98@gmail.com>
Link: https://lore.kernel.org/r/20210222101541.2571-1-amritkhera98@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
George Xanthakis [Sun, 21 Feb 2021 17:05:42 +0000 (19:05 +0200)]
staging: android: Remove filename reference from file
This commit fixes a checkpatch warning that references the filename in
the the file comments.
Signed-off-by: George Xanthakis <kompiouterakias@gmail.com>
Link: https://lore.kernel.org/r/20210221170542.45309-1-kompiouterakias@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fatih Yildirim [Sun, 21 Feb 2021 20:28:55 +0000 (23:28 +0300)]
staging: comedi dt2814: Removed unused variables
Removed unused variables.
Acked-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com>
Link: https://lore.kernel.org/r/20210221202855.12442-1-yildirim.fatih@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rajesh Kumbhakar [Sun, 21 Feb 2021 13:39:51 +0000 (05:39 -0800)]
staging: wimax: i2400m: add space before open parenthesis
fixing ERROR: space required before the open parenthesis '('
Signed-off-by: Rajesh Kumbhakar <sssraj.sssraj@gmail.com>
Link: https://lore.kernel.org/r/20210221133951.21234-1-sssraj.sssraj@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Nikolay Kyx [Sun, 21 Feb 2021 13:22:46 +0000 (16:22 +0300)]
staging: kpc2000: code style: fix line length issue
This patch fixes the following checkpatch.pl warning:
WARNING: line length of 124 exceeds 100 columns
in file kpc2000_i2c.c
Signed-off-by: Nikolay Kyx <knv418@gmail.com>
Link: https://lore.kernel.org/r/20210221132246.1154-2-knv418@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Nikolay Kyx [Sun, 21 Feb 2021 13:22:45 +0000 (16:22 +0300)]
staging: kpc2000: code style: match alignment with open parenthesis
This patch fixes the following checkpatch.pl check:
CHECK: Alignment should match open parenthesis
in files kpc2000_i2c.c kpc2000_spi.c
Signed-off-by: Nikolay Kyx <knv418@gmail.com>
Link: https://lore.kernel.org/r/20210221132246.1154-1-knv418@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Fri, 19 Feb 2021 23:33:52 +0000 (23:33 +0000)]
staging: rtl8192e: fix alignment issues in rtllib_wx.c
Fixes "Alignment should match open parenthesis" issues reported by
checkpatch.pl in the `rtllib_wx.c` file.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210219233352.2298-1-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Fri, 19 Feb 2021 23:11:28 +0000 (23:11 +0000)]
staging: rtl8192e: reformat ba_record struct
This change uses a space instead of tabs between the type and name of
each member of the struct.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210219231128.27119-8-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
William Durand [Fri, 19 Feb 2021 23:11:27 +0000 (23:11 +0000)]
staging: rtl8192e: rename BaStartSeqCtrl to ba_start_seq_ctrl in ba_record struct
Fixes a checkpatch CHECK issue.
Signed-off-by: William Durand <will+git@drnd.me>
Link: https://lore.kernel.org/r/20210219231128.27119-7-will+git@drnd.me
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>