Umang Jain [Tue, 24 Oct 2023 11:44:26 +0000 (07:44 -0400)]
staging: vc04: Convert vchiq_log_trace() to use dynamic debug
Move vchiq_log_trace() custom logging wrapper based on printk
to use dynamic debug. The log category is dictated by enum
vchiq_log_category which will become the part of the trace
string format that will be logged to dynamic debug (for grep).
All the vchiq_log_trace() calls are adjusted to use the
modified wrapper.
Umang Jain [Tue, 24 Oct 2023 11:44:25 +0000 (07:44 -0400)]
staging: vc04: Convert(and rename) vchiq_log_info() to use dynamic debug
Convert(and rename) vchiq_log_info() custom logging wrapping based on
printk to use dynamic debug. The wrapper is now renamed to
vchiq_log_debug() since most of the usage is around printing debug
information. The log category is dictated by enum vchiq_log_category
which will become the part of the debug string format that will be
logged to dynamic debug (for grep).
All the vchiq_log_info() calls are adjusted to use the
modified wrapper vchiq_log_debug().
The existing custom logging for vchiq_log_info() also tries
to log trace messages using SRVTRACE_LEVEL. This is simply
moved to use the vchiq_log_debug() directly.
Umang Jain [Tue, 24 Oct 2023 11:44:24 +0000 (07:44 -0400)]
staging: vc04: Convert vchiq_log_warning() to use dynamic debug
Move vchiq_log_warning() custom logging wrapper based on printk to use
dynamic debug. The log category is dictated by vchiq_log_category
which will become the part of the warning string format that will be
logged to dynamic debug (for grep).
All the vchiq_log_warning() calls are adjusted to use the
modified wrapper.
While at that, remove the extraneous "----" from few of the
warning string text.
Umang Jain [Tue, 24 Oct 2023 11:44:23 +0000 (07:44 -0400)]
staging: vc04: Convert vchiq_log_error() to use dynamic debug
Move vchiq_log_error() custom logging wrapper based on printk,
to use dynamic debug. To categorise, enum vchiq_log_category
has been introduced, which will become the part of the error
string format that will be logged to dynamic debug (for grep).
All the vchiq_log_error() calls are adjusted to use the
dynamic debug wrapper. vchiq_loud_error_*() has been removed
as a part of this patch and replaced with dev_err (so that
they directly end up in kernel log, even if dynamic debug
isn't enabled), which serves the purpose.
Umang Jain [Tue, 24 Oct 2023 11:44:22 +0000 (07:44 -0400)]
staging: vc04_services: Pass struct device to vchiq_init_slots()
Pass struct device pointer to vchiq_init_slots(). In subsequent
commits, vchiq_log_* macros will be ported to use dynamic debug
(dev_dbg()), hence they need access to a struct device pointer.
Umang Jain [Tue, 24 Oct 2023 11:44:21 +0000 (07:44 -0400)]
staging: vc04_services: Pass struct device to vchiq_log_dump_mem()
Pass struct device pointer to vchiq_log_dump_mem(). In subsequent
commits, vchiq_log_* macros will be ported to use dynamic debug
(dev_dbg()), hence they need access to a struct device pointer.
Michael Straube [Mon, 23 Oct 2023 09:00:01 +0000 (11:00 +0200)]
staging: vme_user: prefer strscpy over strcpy
Using strcpy has potential for buffer overflows. It should be replaced
with strscpy where possible. In this case the return value of strcpy is
not used, so we can safely replace it with strscpy.
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.