Arnd Bergmann [Wed, 16 Oct 2024 11:15:18 +0000 (11:15 +0000)]
staging: gpib: make port I/O code conditional
A few of the helper modules contain functions for both IORESOURCE_MEM
and IORESOURCE_IO type access, with the latter not being supported
on all architectures but also not used by all the drivers.
Add #ifdef checks around these to allow building the library code
and use it on MMIO-only configurations.
On architectures that don't support the ISA DMA API, this causes a build
failure. The corresponding dma_alloc() call is already in an #ifdef,
so use the same one for dma_free().
Note that nothing seems to set PC2_DMA, so parts of this driver
are likely unused. ISA DMA usually does not work on PCI or PCMCIA
devices, only on physical ISA slots.
Arnd Bergmann [Wed, 16 Oct 2024 11:15:16 +0000 (11:15 +0000)]
staging: gpib: avoid unused const variables
Variables that are 'static const' but not used anywhere cause a warning
with "gcc -Wunused-const-variable", which we may want to enable by default
in the future.
The gpib code already has a mix of 'enum' and 'static const' variables
for named constants, so convert the ones that are causing problems to
enums as well, or move them closer to the only users where possible.
Everest K.C. [Wed, 16 Oct 2024 07:55:43 +0000 (01:55 -0600)]
staging: gpib: Remove unused value
The variable `complement_count` is assigned a value which is again
overwritten in the next statement.
Fix this by removing the first value assigning statement
This issue was reported by Coverity Scan.
Report:
CID 1600790: (#1 of 1): Unused value (UNUSED_VALUE)
assigned_value: Assigning value from length to complement_count here,
but that stored value is overwritten before it can be used.
staging: gpib: fmh: Drop residue from fmh_gpid_fifo_read_countable()
Clang warns (or errors with CONFIG_WERROR=y):
drivers/staging/gpib/fmh_gpib/fmh_gpib.c:970:43: error: variable 'residue' is uninitialized when used here [-Werror,-Wuninitialized]
970 | (int)(*bytes_read), (int)length, (int)residue);
| ^~~~~~~
residue is never initialized in this function and it is not used outside
of an error print. Just remove it altogether, as it is likely not
necessary in this function, as this same exact statement in present in
fmh_gpib_dma_read().
Javier Carrasco [Mon, 14 Oct 2024 08:56:37 +0000 (10:56 +0200)]
staging: vchiq_arm: Fix missing refcount decrement in error path for fw_node
An error path was introduced without including the required call to
of_node_put() to decrement the node's refcount and avoid leaking memory.
If the call to kzalloc() for 'mgmt' fails, the probe returns without
decrementing the refcount.
Use the automatic cleanup facility to fix the bug and protect the code
against new error paths where the call to of_node_put() might be missing
again.
Javier Carrasco [Mon, 14 Oct 2024 08:56:36 +0000 (10:56 +0200)]
staging: vchiq_arm: refactor goto instructions in vchiq_probe()
The 'failed_platform_init' and 'error_exit' labels do not simplify the
code, there is a single jump to them in the code, and the actions taken
from then on can be easily carried out where the goto occurs.
In file included from drivers/staging/gpib/ines/ines_gpib.c:19:
drivers/staging/gpib/include/gpib_pci_ids.h:3:9: error: '__GPIB_PCI_IDS_H' is used as a header guard here, followed by #define of a different macro [-Werror,-Wheader-guard]
3 | #ifndef __GPIB_PCI_IDS_H
| ^~~~~~~~~~~~~~~~
drivers/staging/gpib/include/gpib_pci_ids.h:4:9: note: '__GPIB_LINUX_PCI_IDS_H' is defined here; did you mean '__GPIB_PCI_IDS_H'?
4 | #define __GPIB_LINUX_PCI_IDS_H
| ^~~~~~~~~~~~~~~~~~~~~~
| __GPIB_PCI_IDS_H
Fix the define to match the guard like the note suggests, as that is
clearly what was intended here.
Everest K.C. [Tue, 15 Oct 2024 21:51:55 +0000 (15:51 -0600)]
staging: gpib: Move free after the variable use has been completed
The variable `in_data` is freed, but used later in the code.
Fix it by moving the freeing the memory after it use has been
completed.
This issue was reported by Coverity Scan.
Report:
CID 1600783: (#1 of 1): Use after free (USE_AFTER_FREE)
19. pass_freed_arg: Passing freed pointer in_data as an argument to
ni_usb_dump_raw_block.
Philipp Hortmann [Sat, 12 Oct 2024 16:49:24 +0000 (18:49 +0200)]
staging: vt6656: Remove unused driver
Forest Bond contributed this driver in 2009.
The following reasons lead to the removal:
- This driver generates maintenance workload
- This driver has a maximum 54MBit/s as it supports only 802.11 b/g.
Peak throughput is 3MBytes/s.
- ping times can be 17ms are often above 500ms and worst case 22 seconds.
One other user does not see such long ping times using a rasperry pi.
I suggest deleting the driver as it no longer meets current expectations
for throuput.
Umang Jain [Sun, 13 Oct 2024 11:21:28 +0000 (16:51 +0530)]
staging: vchiq_core: Lower indentation in vchiq_close_service_internal
Reduce indentation of the conditional nesting in
vchiq_close_service_internal() switch case by checking the error paths
first and break early. This helps to reduce conditional branching and
reduce indentation levels.
Umang Jain [Sun, 13 Oct 2024 11:21:27 +0000 (16:51 +0530)]
staging: vchiq_core: Lower indentation in parse_open()
If the service is not in VCHIQ_SRVSTATE_LISTENING state, it is
implied that the message is dealt with and parse_open() should return.
If this is the case, simply jump the code flow to return site using
'goto done;' statement.
This helps to lower the indentation of
if (service->srvstate == VCHIQ_SRVSTATE_LISTENING)
conditional branch.
Umang Jain [Sun, 13 Oct 2024 11:21:23 +0000 (16:51 +0530)]
staging: vchiq_core: Locally cache cache_line_size information
Locally cache 'cache_line_size' information in a variable instead of
repeatedly accessing it from drv_mgmt->info. This helps to reflow lines
under 80 columns.
Stefan Wahren [Fri, 11 Oct 2024 10:01:19 +0000 (12:01 +0200)]
staging: vc04_services: TESTING: Adjust ping test
Recent tests on Raspberry Pi 3 B Plus have shown that one
iteration is not enough to discover issues reliable. So
switch back to the defaults (1000 iterations).
Philipp Hortmann [Thu, 10 Oct 2024 19:15:06 +0000 (21:15 +0200)]
staging: gdm724x: Remove unused driver
Won Kang from gct contributed the driver in 2013.
The following reasons lead to the removal:
- This driver generates maintenance workload
- The manufacturer is not interested and does not care as Emails or
inquiries, to support or involved persons of gct, got unanswered.
- Did not find a possibility to buy the chips.
- Did not find minimal documentation on the web.
- Did not find a device where it is build in and the user is able to
install any Linux. Therefore it is not possible to do any testing of
the driver from the community.
- No blog entries about anyone using the gdmtty and gdmulte.
- No response about usage of this drivers to the Email from April 2024
Philipp Hortmann [Thu, 10 Oct 2024 16:42:17 +0000 (18:42 +0200)]
staging: vt6655: Remove unused driver
Forest Bond contributed this driver in 2009.
The following reasons lead to the removal:
- This driver generates maintenance workload
- This driver has a maximum 54MBit/s as it supports only 802.11 b/g.
Peak throughput is 3MBytes/s but this lasts only for a second.
Typically throughput is 1.7MBytes/s.
- Depending on the number of devices on the channel the device looses
connection and cannot reconnect for 5-60 seconds. Watching a youtube
video is OK because of the buffer. But surfing can then be really a
pain.
- Its form factor is mini PCI (not miniPCIe) that is old and large.
- Hardly not to buy.
Dave Penkler [Wed, 18 Sep 2024 12:19:05 +0000 (14:19 +0200)]
staging: gpib: Add LPVO DIY USB GPIB driver
Driver for the DIY board designed at the Laboratory of Photovoltaics
and Optoelectronics at the Faculty of Electrical Engineering,
University of Ljubljana.
Dave Penkler [Wed, 18 Sep 2024 12:18:51 +0000 (14:18 +0200)]
staging: gpib: Add user api include files
User api include files used by drivers and userland code.
The files are also distributed with the userland package.
Since these include files have been used by many applications we
had to keep the camelCase enums, typedefs and uint8_t declarations.
Wei Wang from Realsil contributed this driver in 2011.
The following reasons lead to the removal:
- This driver generates maintenance workload
- Did not find minimal documentation on the web.
- No blog entries about anyone using the rts5208 and rts5288 during the
last years.
- Did not find any device that may has it in and is still available on
the market.
vchiq_pagelist.h only defines one struct and a couple of macros.
It can be merged with vchiq_core since all the pagelist related
function helpers are now in vchiq_core for bulk transfers.
Move the struct and related macros to vchiq_core header and drop
vchiq_pagelist.h.
staging: vchiq_core: Move bulk data functions in vchiq_core
Bulk transfers core logic lives in vchiq_core.c, hence move all
the preparatory bulk data allocation helpers to vchiq_core.c (from
vchiq_arm).
The discrepancy was noticed when vchiq_prepare_bulk_data() and
vchiq_complete_bulk() are being used vchiq_core.c but are defined
in vchiq_arm. Now that they are now confined to vchiq_core.c,
they can be made static and their signatures from vchiq_core header
can be dropped.
vchiq_prepare_bulk_data() and vchiq_complete_bulk() depends on
struct vchiq_pagelist_info, cleanup_pagelist(), free_pagelist() and
create_pagelist() hence they are pulled in from vchiq_arm as well,
as part of this commit.
The function remote_event_signal() is declared in vchiq_core.h while
defined in vchiq_arm.c and used only in vchiq_core.c. Move the
definition to vchiq_core.c as it is only used in this file.
Also convert it to static and drop the function signature from
vchiq_core.h header. BELL2 doorbell macro is also moved from vchiq_arm
to vchiq_core as part of this change.
-EINTR is returned by vchiq_queue_message() on receiving a fatal
signal to the process. Since the process is deemed to be terminated
anyway, do not retry queuing with vchiq_queue_message() on -EINTR.
staging: vchiq_arm: Do not retry bulk transfers on -EINTR
-EINTR is returned by various vchiq bulk transfer code paths
on receiving a fatal signal to the process. Since the process is
deemed to be terminated anyway, do not retry the bulk transfer
on -EINTR.
staging: vchiq_core: Return -EINTR when bulk transfers are interrupted
Bulk transfers for various VCHIQ modes use mutex_lock_killable() and
wait_for_completion_killable() variations. Currently, -EAGAIN is
returned if these are interrupted by a fatal signal.
-EAGAIN may mislead the caller into thinking the operation can be
retried, while in reality, the process has received a fatal signal
and is terminating. Therefore, we should update the return value to
align with what these killable functions would return, specifically
-EINTR (Interrupted system call).
staging: vchiq_core: Return -EINTR in queue_message() on interrupt
queue_message() uses mutex_lock_killable() and
wait_for_completion_killable() variations of locking and wait event
completions respectively. These functions return either 0 (on success)
or -EINTR, if interrupted by a fatal signal (as documented in the
kernel).
However, queue_message() is currently returning -EAGAIN if these
killable functions are interrupted by fatal signals. Bubbling up
-EAGAIN might give a sense to the caller, that the code path can
be re-tried however, in actual sense, a fatal signal has been
received by the process and the process is going away.
Hence, we should align the return value with what these killable
versions will return i.e. -EINTR (Interrupted system call).
staging: vchiq_core: Return on all errors from queue_message()
In vchiq_connect_internal(), a MAKE_CONNECT message is queued
if the connection is disconnected, but only -EAGAIN error is
checked on the error path and returned.
However, queue_message() can fail with other errors as well hence,
vchiq_connect_internal() should return in those cases as well.
staging: vchiq_core: Use killable wait completions for bulk transfers
commit f27e47bc6b8b ("staging: vchiq: use completions instead of
semaphores") introduced completions for events in vchiq interface.
It introduced _interruptible() version of completions for waiting
on events. However, it missed a subtle down_interruptible() macro
override in vchiq_killable.h, which used to mask most of the signals
and only interrupt on fatal ones.
The above issue was fixed in commit a772f116702e ("staging: vchiq: switch
to wait_for_completion_killable"). Given the override logic of
down_interruptible() that existed in vchiq_killable.h, that commit
fixed the completions with the correct variation i.e. killable() family
of functions.
However, commit a772f116702e ("staging: vchiq: switch to
wait_for_completion_killable") later got reverted [1] due to high CPU
load noticed by various downstream and upstream distributions [2].
Reverting the commit solved this problem but the root cause was never
diagonsed and the entire commit was reverted.
This patch brings back killable version of wait events but only for
bulk transfers and queue_message() transfer code paths.
The idea is to bring back killable versions for various event
completions in a phased manner so that we do not re-regress again as
noticed in [2]. Hence, no other wait events are converted from
interruptible -> killable in this patch.
Since the bulk transfers are no longer interruptible (but killable),
drop the "_interruptible" suffix from all vchiq_bulk_xfer_* functions.
staging: Switch back to struct platform_driver::remove()
After commit 0edb555a65d1 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.
Convert all staging drivers to use .remove(), with the eventual goal to
drop struct platform_driver::remove_new(). As .remove() and .remove_new()
have the same prototypes, conversion is done by just changing the structure
member name in the driver initializer.
staging: olpc_dcon: Drop explicit initialization of struct i2c_device_id::driver_data to 0
These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.
This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.
staging: most: i2c: Drop explicit initialization of struct i2c_device_id::driver_data to 0
These drivers don't use the driver_data member of struct i2c_device_id,
so don't explicitly initialize this member.
This prepares putting driver_data in an anonymous union which requires
either no initialization or named designators. But it's also a nice
cleanup on its own.
While touching the initializer, also remove the comma after the sentinel
entry.
Commit ed394dbf5371b03a5335a7ba1973ba124c0ced3d replaced Forest Bond
with Philipp Hortmann as vt665X maintainer in MAINTAINERS, but
drivers/staging/vt6656/TODO was not changed, rendering it stale. This
patch fixes it.