Soumya Negi [Fri, 20 Oct 2023 01:55:23 +0000 (18:55 -0700)]
staging: vme_user: Use dev_err() in vme_check_window()
vme_check_window() uses printk() for logging error message. This
leads to the following checkpatch warning:
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then
dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
Use dev_err() instead. Pass VME bridge device to vme_check_window() so
that the error message can be logged with the bridge device context.
Soumya Negi [Fri, 20 Oct 2023 01:55:22 +0000 (18:55 -0700)]
staging: vme_user: Remove NULL-checks
Don't check for empty bridge device & resource in vme_alloc_consistent()
& vme_free_consistent() since they can not be NULL. Both the VME bridge
device and the VME resource that are used in these functions are set at
probe time.
Soumya Negi [Fri, 20 Oct 2023 01:55:21 +0000 (18:55 -0700)]
staging: vme_user: Remove printk() in find_bridge()
Don't log error message in find_bridge(). The printk() triggers a
checkpatch warning:
WARNING: Prefer [subsystem eg: netdev]_err([subsystem]dev, ... then
dev_err(dev, ... then pr_err(... to printk(KERN_ERR ...
It can't be replaced by dev_err() & using pr_err() is not helpful as it
doesn't give much context to the user. It is better to remove it.
Soumya Negi [Fri, 20 Oct 2023 01:55:19 +0000 (18:55 -0700)]
staging: vme_user: Replace printk() with dev_*()
vme.c uses printk() to log messages. To improve and standardize message
formatting, use logging mechanisms dev_err()/dev_warn() instead. Retain
the printk log levels of the messages during replacement.
Dorcas AnonoLitunya [Thu, 19 Oct 2023 10:13:37 +0000 (13:13 +0300)]
staging: sm750fb: Remove unused return variable in program_mode_registers()
Drops variable ret as it is unused in the code. This therefore modifies
the return type of program_mode_registers() to void from int since the
return value is being ignored in all function calls. This improves code
readability and maintainability.
Calvince Otieno [Thu, 19 Oct 2023 07:28:39 +0000 (10:28 +0300)]
staging: bcm2835-audio: remove function snd_bcm2835_new_ctl()
The function snd_bcm2835_new_ctl() is declared but not defined.
Its definition was removed 1 year ago in the
commit 143b67f19ba1 ("staging: bcm2835-audio: remove compat ALSA card")
Calvince Otieno [Thu, 19 Oct 2023 06:55:20 +0000 (09:55 +0300)]
staging: vme_user: replace strcpy with strscpy
Checkpatch suggests using strscpy() instead of strcpy().
The advantages of strscpy() are that it always adds a NUL terminator
and prevents read/write overflows if the source string is not properly
terminated.
strcpy() lacks built-in bounds checking for the destination buffer,
making it susceptible to buffer overflows. These overflows can lead
to various unpredictable behaviors.
In this specific context, both strscpy and strcpy performs the same
operation without any functional difference.
The reason for this equivalence is that the driver_name string "vme_fake"
is shorter than the size of the fake_bridge->name array which is defined
as 16 characters (struct vme_bridge {char name[VMENAMSIZ];...}). Thus,
there is no risk of buffer overflow in either case. VMENAMSIZ variable
holds a constant value of 16 (#define VMENAMSIZ 16)
The null-terminated "vme_fake" string
(static const char driver_name[] = "vme_fake";) can be safely copied into
fake_bridge->name using either strscpy or strcpy.
While using strscpy() does not address any bugs, it is considered a better
practice and aligns with checkpatch recommendations.
Umang Jain [Thu, 19 Oct 2023 09:01:26 +0000 (14:31 +0530)]
staging: vc04_services: Support module autoloading using MODULE_DEVICE_TABLE
VC04 has now a independent bus vchiq_bus to register its devices.
However, the module auto-loading for bcm2835-audio and bcm2835-camera
currently happens through MODULE_ALIAS() macro specified explicitly.
The correct way to auto-load a module, is when the alias is picked
out from MODULE_DEVICE_TABLE(). In order to get there, we need to
introduce vchiq_device_id and add relevant entries in file2alias.c
infrastructure so that aliases can be generated. This patch targets
adding vchiq_device_id and do_vchiq_entry, in order to
generate those alias using the /script/mod/file2alias.c.
Going forward the MODULE_ALIAS() from bcm2835-camera and bcm2835-audio
will be dropped, in favour of MODULE_DEVICE_TABLE being used there.
The alias format for vchiq_bus devices will be "vchiq:<dev_name>".
Adjust the vchiq_bus_uevent() to reflect that.
Benjamin Poirier [Fri, 20 Oct 2023 12:44:57 +0000 (08:44 -0400)]
staging: qlge: Retire the driver
No significant improvements have been done to this driver since commit a7c3ddf29a78 ("staging: qlge: clean up debugging code in the QL_ALL_DUMP
ifdef land") in January 2021. The driver should not stay in staging
forever. Since it has been abandoned by the vendor and no one has stepped
up to maintain it, delete it.
If some users manifest themselves, the driver will be restored to
drivers/net/ as suggested in the linked message.
Benjamin Poirier [Fri, 20 Oct 2023 12:44:56 +0000 (08:44 -0400)]
staging: qlge: Update TODO
Update TODO file to reflect the changes that have been done:
* multiple functions were renamed to have the "qlge_" prefix in commit f8c047be5401 ("staging: qlge: use qlge_* prefix to avoid namespace
clashes with other qlogic drivers")
* a redundant memset() was removed in commit 953b94009377 ("staging: qlge:
Initialize devlink health dump framework")
* the loop boundary in ql(ge)_alloc_rx_buffers() was updated in commit e4c911a73c89 ("staging: qlge: Remove rx_ring.type")
* pci_enable_msi() was replaced in commit 4eab532dca76 ("staging:
qlge/qlge_main.c: Replace depracated MSI API.")
* pci_dma_* were replaced in commit e955a071b9b3 ("staging: qlge: replace
deprecated apis pci_dma_*")
* the while loops were rewritten in commit 41e1bf811ace ("Staging: qlge:
Rewrite two while loops as simple for loops")
* indentation was fixed in commit 0eb79fd1e911 ("staging: qlge: cleanup
indent in qlge_main.c")
Calvince Otieno [Tue, 17 Oct 2023 10:12:56 +0000 (13:12 +0300)]
staging: wlan-ng: remove function prism2sta_ev_txexc
The function prism2sta_ev_txexc() is called by the function
hfa384x_usbin_txcompl() to print the transmit exception event - a debug
information using netdev_dbg().
The debugging utility function can be called directly by
hfa384x_usbin_txcompl().
Calvince Otieno [Tue, 17 Oct 2023 09:18:02 +0000 (12:18 +0300)]
staging: wlan-ng: use netdev_dbg over pr_debug
This patch replaces the usage of pr_debug() with netdev_dbg().
The change is made to enhance context-aware debugging,
improve code clarity, and maintain compatibility with established
network debugging practices. There were no functional code changes.
Dorcas AnonoLitunya [Mon, 16 Oct 2023 20:14:11 +0000 (23:14 +0300)]
Staging: sm750fb: Rename programModeRegisters
Rename function programModeRegisters to program_mode_registers. This
follows snakecase naming convention and ensures a consistent naming style
throughout the file. Issue found by checkpatch.
Mutes the following checkpatch error:
CHECK: Avoid CamelCase: <programModeRegisters>
Dorcas AnonoLitunya [Mon, 16 Oct 2023 20:14:10 +0000 (23:14 +0300)]
Staging: sm750fb: Rename dispControl
Rename variable dispControl to disp_control. This follows
snakecase naming convention and ensures a consistent naming style
throughout the file. Issue found by checkpatch.
Mutes the following checkpatch error:
CHECK: Avoid CamelCase: <dispControl>
Dorcas AnonoLitunya [Mon, 16 Oct 2023 20:14:09 +0000 (23:14 +0300)]
Staging: sm750fb: Rename pModeParam
Rename variable pModeParam to mode_param. This follows snakecase naming
convention and ensures a consistent naming style throughout the file.
Issue found by checkpatch.
Mutes the following checkpatch error:
CHECK: Avoid CamelCase: <pModeParam>
Rename function displayControlAdjust_SM750E to
display_control_adjust_SM750E. This follows snakecase naming convention
and ensures a consistent naming style throughout the file. Issue found by
checkpatch.
Mutes the following error:
CHECK:Avoid CamelCase: <displayControlAdjust_SM750E>
Greg Kroah-Hartman [Tue, 17 Oct 2023 08:13:10 +0000 (10:13 +0200)]
staging: rtl8192u: remove entry from Makefile
In commit 697455ce4110 ("staging: rtl8192u: Remove broken driver"), the
driver was removed, along with the Kconfig entry, but the Makefile line
in drivers/staging/Makefile was not updated, so things like 'make clean'
fail to work properly as they will decend into all subdirectories to try
to clean things up.
Resolve this by removing the entry in the main staging Makefile.
Calvince Otieno [Mon, 16 Oct 2023 09:20:37 +0000 (12:20 +0300)]
staging: wlan-ng: replace pr_debug() with netdev_dbg()
This patch replaces the usage of pr_debug() with netdev_dbg().
The change is made to enhance context-aware debugging,
improve code clarity, and maintain compatibility with established
network debugging practices. There were no functional code changes.
Calvince Otieno [Mon, 16 Oct 2023 06:39:33 +0000 (09:39 +0300)]
staging: wlan-ng: replace strncpy() with strscpy()
Checkpatch suggests the use of strscpy() instead of strncpy().
The advantages are that it always adds a NUL terminator and it prevents
a read overflow if the src string is not properly terminated. One
potential disadvantage is that it doesn't zero pad the string like
strncpy() does.
In this code, strscpy() and strncpy() are equivalent and it does not
affect runtime behavior. The string is zeroed on the line before
using memset(). The resulting string was always NUL terminated and
PRISM2_USB_FWFILE is string literal "prism2_ru.fw" so it's NUL
terminated.
However, even though using strscpy() does not fix any bugs, it's
still nicer and makes checkpatch happy.
Calvince Otieno [Mon, 16 Oct 2023 05:27:23 +0000 (08:27 +0300)]
staging: wlan-ng: remove unnecessary helper function
The function prism2sta_inf_handover() is called by the parent
function prism2sta_ev_info() to print a literal debug information
string using pr_debug(). The debugging utility function can be called
directly within prism2sta_ev_info().
Furthermore, to make the debugging more module-specific, the netdev_dbg()
function is preferred over the generic pr_debug() utility function.
Calvince Otieno [Sun, 15 Oct 2023 20:02:19 +0000 (23:02 +0300)]
staging: wlan-ng: remove unused function prototypes
These functions are declared but not defined or used anywhere. Their
definitions were removed 15 years ago.
prism2mgmt_set_grpaddr() was removed in the
commit 1e7201836c57 ("Staging: wlan-ng: Delete a pile of unused mibs.
And fix WEXT SET_TXPOWER.")
It's signature was changed in the commit 5a2214e2e02f ("staging:
wlang-ng: avoid new typedef: hfa384x_t")
prism2mgmt_get_grpaddr() and prism2mgmt_get_grpaddr_index() were
removed in the commit cbec30c4c00c ("Staging: wlan-ng: Delete a large pile of
now-unused code.")
Remove function _rtl92e_dm_ctrl_initgain_byrssi_false_alarm() as it is
unused. Remove in above function called function
_rtl92e_dm_ctrl_initgain_byrssi_highpwr() as well.
Remove variable dig_algorithm as its value is set to DIG_ALGO_BY_RSSI at
initialization. No further writes to dig_algorithm are done. The
equations result accordingly. Remove dead code.
Remove variable dig_enable_flag as its value is set to 1 at
initialization. No further writes to dig_enable_flag are done. The
equations result accordingly. Remove dead code.
The scsi_lock() and scsi_unlock() macros protect the sm_state and the
single queue element srb for write access in the driver. As suggested,
these names are very generic. Remove the macros from header file and call
spin_lock_irq() & spin_unlock_irq() directly instead.
Gustavo A. R. Silva [Mon, 9 Oct 2023 21:52:59 +0000 (15:52 -0600)]
staging: greybus: Add __counted_by for struct apr_rx_buf and use struct_size()
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for
array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).
While there, use struct_size() helper, instead of the open-coded
version, to calculate the size for the allocation of the whole
flexible structure, including of course, the flexible-array member.
This code was found with the help of Coccinelle, and audited and
fixed manually.
Signed-off-by: "Gustavo A. R. Silva" <gustavoars@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Alex Elder <elder@linaro.org> Link: https://lore.kernel.org/r/ZSR2O6zGyT/VX6ve@work Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove variable active_scan as its value is set to 1 at initialization.
No further writes to active_scan are done. The equation results
accordingly. Remove dead code.
Remove constant variable reg_max_lps_awake_intvl as this value is just
written to MaxPeriod. Function _rtl92e_init_priv_constant() is then empty
and can be removed as well.
Greg Kroah-Hartman [Thu, 5 Oct 2023 13:58:36 +0000 (15:58 +0200)]
staging: greybus: fw-management: make fw_mgmt_class constant
Now that the driver core allows for struct class to be in read-only
memory, making all 'class' structures to be declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at load time.
Greg Kroah-Hartman [Thu, 5 Oct 2023 13:58:35 +0000 (15:58 +0200)]
staging: greybus: authentication: make cap_class constant
Now that the driver core allows for struct class to be in read-only
memory, making all 'class' structures to be declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at load time.
Greg Kroah-Hartman [Thu, 5 Oct 2023 13:58:34 +0000 (15:58 +0200)]
staging: greybus: raw: make raw_class constant
Now that the driver core allows for struct class to be in read-only
memory, making all 'class' structures to be declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at load time.
Greg Kroah-Hartman [Thu, 5 Oct 2023 13:55:13 +0000 (15:55 +0200)]
staging: pi433: make pi433_class constant
Now that the driver core allows for struct class to be in read-only
memory, making all 'class' structures to be declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at load time.
Greg Kroah-Hartman [Thu, 5 Oct 2023 13:45:24 +0000 (15:45 +0200)]
staging: vme_user: make vme_user_sysfs_class constant
Now that the driver core allows for struct class to be in read-only
memory, making all 'class' structures to be declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at load time.
Greg Kroah-Hartman [Thu, 5 Oct 2023 13:43:53 +0000 (15:43 +0200)]
staging: fieldbus: make controller_class constant
Now that the driver core allows for struct class to be in read-only
memory, making all 'class' structures to be declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at load time.
staging: bcm2835-audio: Register bcm2835-audio with vchiq_bus_type
Similar to how bcm2385-camera device is registered, register the
bcm2835-audio with vchiq_bus_type as well.
Since we moved away bcm2835-audio from platform driver/device,
we have to set the DMA mask explicitly. Set the DMA mask at probe
time.
Meanwhile at it, change the name and module alias from "bcm2835_audio"
to "bcm2835-audio" to be consistent with bcm2835-camera device. This
does not brings any functional change as '-' and '_' are
interchangeable as per modprobe man pages.
Also, drop vchiq_register_child() helper which is no longer
needed after this patch.
staging: vc04_services: vchiq_arm: Add new bus type and device type
The devices that the vchiq interface registers (bcm2835-audio,
bcm2835-camera) are implemented and exposed by the VC04 firmware.
The device tree describes the VC04 itself with the resources required
to communicate with it through a mailbox interface. However, the
vchiq interface registers these devices as platform devices. This
also means the specific drivers for these devices are getting
registered as platform drivers. This is not correct and a blatant
abuse of platform device/driver.
Add a new bus type, vchiq_bus_type and device type (struct vchiq_device)
which will be used to migrate child devices that the vchiq interfaces
creates/registers from the platform device/driver.
staging: vc04_services: bcm2835-audio: Explicitly set DMA mask
In the following patches, vchiq_arm will be migrated to create and use
its own bus and all the vchiq drivers (bcm2835-camera, bcm2835-audio)
will be registered to it. Since the platform driver/device model
internally sets the DMA mask for its registered devices, we would have
to do it ourself when we remove the platform driver/device registration
for vchiq devices.
This patch explicitly sets the DMA mask to bcm2835-audio so as not
to introduce a regression when we move away from platform
device/driver model.
staging: vc04_services: bcm2835-camera: Explicitly set DMA mask
In the following patches, vchiq_arm will be migrated to create and use
its own bus and all the vchiq drivers (bcm2835-camera, bcm2835-audio)
will be registered to it. Since the platform driver/device model
internally sets the DMA mask for its registered devices, we would have
to do it ourself when we remove the platform driver/device registration
for vchiq devices.
This patch explicitly sets the DMA mask to bcm2835-camera so as not
to introduce a regression when we move away from platform
device/driver model.
Philipp Hortmann [Tue, 3 Oct 2023 19:33:19 +0000 (21:33 +0200)]
staging: rtl8192e: Remove function rtllib_start_monitor_mode()
Remove equation with raw_tx in function rtllib_start_monitor_mode() as it
is always false. rtllib_start_monitor_mode() is then empty and can be
removed as well.