Philipp Hortmann [Sun, 3 Nov 2024 08:14:22 +0000 (09:14 +0100)]
staging: rtl8723bs: Replace function thread_enter
Replace function thread_enter with its only called function allow_signal
to increase readability. Remove resulting unused local variable
thread_name as well.
Umang Jain [Wed, 23 Oct 2024 11:04:06 +0000 (16:34 +0530)]
staging: vchiq_arm: Track bulk user data pointer separately
A bulk callback transfer can be initiated from two places -
inside kernel interface or from user interface. However,
the callback data pointer 'cb_data' is used for tracking both
sets of data pointer. This commit tracks the callback
data pointer from user interface (named as 'cb_userdata') separately,
in the bulk transfer service callback.
This is esentially done by adding a 'void __user *cb_userdata' for
tracking __user pointers in vchiq_bulk and vchiq_completion_data
structs. Furthermore, the 'cb_userdata' data pointer is appended to
the vchiq_service's callback signature.
Separating the two callback data pointers ('cb_data' and 'cb_userdata')
fixes the sparse warnings around mixing userspace and kernel space
pointers.
As there are no additional sparse warnings left for vc04_services,
drop the relevant entry from the TODO.
Umang Jain [Wed, 23 Oct 2024 11:04:05 +0000 (16:34 +0530)]
staging: vchiq_core: Pass vchiq_bulk pointer to make_service_callback()
Pass struct vchiq_bulk pointer to make_service_callback() instead of
just passing the bulk->cb_data. This is a preparatory change when we
need to pass the callback data user pointer (__user) in a subsequent
commit.
In a previous commit, struct vchiq_bulk 'userdata' got renamed to
'cb_data' since it is the data pointer passed in
VCHIQ_BULK_CALLBACK_MODE's callback. Since struct vchiq_completion_data*
structs also has 'bulk_userdata' for completion records, rename
'bulk_userdata' member to 'cb_data' for these structs as well.
This brings consistency and clarity for the struct members. No
functional change in this patch.
Rename the struct vchiq_bulk 'userdata' member to 'cb_data' to clarify
its purpose. 'cb_data' is meant to be passed to service callback
function in VCHIQ_BULK_MODE_CALLBACK mode.
Umang Jain [Wed, 23 Oct 2024 11:04:02 +0000 (16:34 +0530)]
staging: vchiq_core: Bulk waiter should not piggy back on bulk userdata
Currently, struct bulk_waiter is allocated for VCHIQ_BULK_MODE_BLOCKING
bulk transfer and its pointer is assigned to vchiq_bulk->userdata. Avoid
this kind of piggybacking and introduce a dedicate 'waiter' member in
struct vchiq_bulk.
The 'userdata' is meant for VCHIQ_BULK_MODE_CALLBACK mode, to pass user
specified parameter to the actual callback function.
Philipp Hortmann [Sat, 2 Nov 2024 19:14:34 +0000 (20:14 +0100)]
staging: fieldbus: Delete unused driver
Sven Van Asbroeck contributed this driver in 2019.
The following reasons lead to the removal:
- This driver generates maintenance workload
- only 11 patches during the last 3 years. Part of the patches seem to be
motivated because of maintenance (for example - remove deprecated
function)
- Maintainer lost interest, last "Reviewed-by:" is May 2021
- no blog about usage of this driver
The staging subsystem is the way for drivers into the kernel - at current
speed and interest this is never going to happen. I think that fieldbus
is an interesting topic. But when almost nobody cares about this driver,
it does not make sense to keep it. Please consider that support will
remain for years in the longterm kernels.
Philipp Hortmann [Sun, 20 Oct 2024 14:49:29 +0000 (16:49 +0200)]
staging: rtl8712: Remove driver using deprecated API wext
This driver is in the staging area since 2010.
The following reasons lead to the removal:
- This driver generates maintenance workload for itself and for API wext
- A MAC80211 driver was available in 2016 time frame; This driver does
not compile anymore but would be a better starting point than the
current driver. Here the note from the TODO file:
A replacement for this driver with MAC80211 support is available
at https://github.com/chunkeey/rtl8192su
- no progress changing to mac80211
- Using this hardware is security wise not state of the art as WPA3 is
not supported.
The longterm kernels will still support this hardware for years.
Umang Jain [Thu, 17 Oct 2024 13:36:29 +0000 (19:06 +0530)]
staging: vchiq_dev: Drop userdata local pointer
The 'userdata' local pointer can be dropped which is set to bulk_waiter.
We can directly pass the waiter->bulk_waiter pointer to
vchiq_bulk_xfer_waiting().
Umang Jain [Thu, 17 Oct 2024 13:36:28 +0000 (19:06 +0530)]
staging: vchiq_core: Simplify bulk transfer queue message function
vchiq_bulk_xfer_queue_msg_killable() is a common function between
various bulk transfer code paths (blocking, callback and no-callback).
These code paths were simplified earlier by passing a populated
struct vchiq_bulk pointer in order to avoid open-coding the parameters
required to initiate a bulk transfer.
Now simplify the vchiq_bulk_xfer_queue_msg_killable() in a similar way
i.e. avoid open-coding the function parameters and pass the struct
vchiq_bulk pointer directly, coming from the various bulk transfer code
paths.
Umang Jain [Thu, 17 Oct 2024 13:36:27 +0000 (19:06 +0530)]
staging: vc04_services: Simplify (no)callback bulk transfer code paths
The (no)callback mode bulk transfer tends to open-code every function
parameter needed to initiate the bulk transfer. Instead of doing that,
simply pass a populated struct vchiq_bulk down the function chain.
Umang Jain [Thu, 17 Oct 2024 13:36:26 +0000 (19:06 +0530)]
staging: vc04_services: Simplify block bulk transfer code paths
Blocking bulk transfer functions tend to open-code every function
parameter needed to initiate the bulk transfer. Instead of doing
that, simply pass a populated struct vchiq_bulk down the function
chain.
Umang Jain [Thu, 17 Oct 2024 13:36:25 +0000 (19:06 +0530)]
staging: vchiq_core: Simplify bulk data preparatory functions
Two functions create_pagelist() and vchiq_prepare_bulk_data()
open code bulk data arguments ('size' and 'dir') in their function
signatures which can easily be obtained by struct vchiq_bulk pointer.
Retrieve the arguments from vchiq_bulk pointer instead and reduce
the number of arguments passed in create_pagelist() and
vchiq_bulk_prepare_data().
Umang Jain [Thu, 17 Oct 2024 13:36:24 +0000 (19:06 +0530)]
staging: vchiq_core: Subsume 'offset' in struct vchiq_bulk
Subsume offset and uoffset inside struct vchiq_bulk instead of
open-coding them in vchiq_prepare_bulk_data() function. It helps in
reducing function parameters and can be easily retrieved from the
struct vchiq_bulk pointer for creating pagelist.
Everest K.C. [Thu, 17 Oct 2024 22:07:24 +0000 (16:07 -0600)]
staging: gpib: Change return type and error code of fmh_gpib_get_dma_residue()
fmh_gpib_get_dma_residue() returns unsigned int with -1 as error code.
This error cannot be caught.
Fix this by changing the return type of the function to int and
returning the error code, that was captured. Also, change the data
type of variable residue to int in the function fmh_gpib_dma_read().
Dan Carpenter [Thu, 17 Oct 2024 19:31:46 +0000 (22:31 +0300)]
staging: gpib: fix uninitialized variable in usb_gpib_command()
The number of bytes written is supposed to be zero at the start of this
function but only one caller, ibcmd(), initializes it to zero. For the
other three callers, setup_serial_poll(), read_serial_poll_byte() and
cleanup_serial_poll(), it's an uninitialized variable.
Everest K.C. [Thu, 17 Oct 2024 09:25:10 +0000 (03:25 -0600)]
staging: gpib: Change return type and error code of fluke_get_dma_residue
fluke_get_dma_residue() returns unsigned int with -1 as error code.
This error cannot be caught.
Fix this by changing the return type of the function to int and
returning the error code, that was captured. Also, change the data
type of variable residue to int in the function fluke_dma_read().
Arnd Bergmann [Wed, 16 Oct 2024 11:15:20 +0000 (11:15 +0000)]
staging: gpib: use proper format string in request_module
Using a string variable as a format causes a -Wformat-security
warning. Since the only use of the temporary module_string[] is to hold
the sprintf() output, just pass the format string and argument directly
to request_module().
Arnd Bergmann [Wed, 16 Oct 2024 11:15:19 +0000 (11:15 +0000)]
staging: gpib: add bus specific Kconfig dependencies
A number of GPIB drivers fail to build when CONFIG_HAS_IOPORT is disabled,
which can be avoided with a CONFIG_ISA_BUS or CONFIG_PCMCIA dependency.
For completeness, mark all of the new device drivers with a dependency
on whichever bus they use, and hide the symbols for chip drivers that
are already selected by teh device drivers using them.
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.
Nathan Chancellor [Tue, 15 Oct 2024 20:09:02 +0000 (13:09 -0700)]
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.
Nathan Chancellor [Tue, 15 Oct 2024 19:55:33 +0000 (12:55 -0700)]
staging: gpib: Fix PCI header include guard
Clang warns (or errors with CONFIG_WERROR=y):
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.
Philipp Hortmann [Wed, 9 Oct 2024 19:32:45 +0000 (21:32 +0200)]
staging: rts5208: Remove unused driver
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.