Remove the function _rtw_zvmalloc from os_dep/osdep_service.c, as this
function is now unused and is just an inline wrapper around vmalloc
which zeroes out the memory. All previous callers have been converted to
use vzalloc. Also remove the declaration from include/osdep_service.h.
It is considered generally bad practice to declare functions as inline in
the majority of cases, as not only can this qualifier be ignored by the
compiler but the compiler generally makes good decisions about inlining
anyway.
Link: https://lore.kernel.org/r/20210818234853.208448-7-phil@philpotter.co.uk
Convert all rtw_zvmalloc calls within the driver to use the existing
kernel vzalloc function, which has the same semantics. Also rewrite the
two places where it is mentioned in comments to say vzalloc, and remove
the redundant cast to struct adapter * in ./os_dep/usb_intf.c as vzalloc
returns void *.
The reason for the conversion is that rtw_zvmalloc is just a
preprocessor definition for _rtw_zvmalloc which itself is just an inline
wrapper around vmalloc which then zeroes the memory out. As vzalloc does
the same thing via usage of __GFP_ZERO, this code is redundant and can
subsequently be removed.
Link: https://lore.kernel.org/r/20210818234853.208448-5-phil@philpotter.co.uk
Remove the function _rtw_vmalloc from os_dep/osdep_service.c, converting
its only user (also in os_dep/osdep_service.c) to use plain vmalloc.
This function is just an inline wrapper around vmalloc which returns a u8
pointer, which isn't needed. Also remove the declaration from
include/osdep_service.h.
It is considered generally bad practice to declare functions as inline in
the majority of cases, as not only can this qualifier be ignored by the
compiler but the compiler generally makes good decisions about inlining
anyway.
Link: https://lore.kernel.org/r/20210818234853.208448-4-phil@philpotter.co.uk
Convert the only call to rtw_vmalloc in os_dep/ioctl_linux.c to the
kernel's existing vmalloc function, as rtw_malloc is just a preprocessor
definition for _rtw_vmalloc. The _rtw_vmalloc function is defined inline
and returns a u8, wrapping standard vmalloc. This behaviour is not necessary.
Link: https://lore.kernel.org/r/20210818234853.208448-2-phil@philpotter.co.uk
The compiler is free to ignore, or follow, "inline" markings so they
really have no use in .c files, so just remove them.
This allows functions to properly show up as being unused when all
callers to them are removed, otherwise gcc does not warn you about this.
Link: https://lore.kernel.org/r/20210816073450.668993-1-gregkh@linuxfoundation.org
Looking at the error function as a whole, the error handling is odd
compared to the rest of the kernel, which prefers to set error codes on
goto paths, rather than a global "status" variable which determines the
error code at the end of the function and function calls in the case of
error.
Rearrange the error handling of this function to bring it more inline
with how the kernel does it in most cases, which helps readability.
Link: https://lore.kernel.org/r/20210812204027.338872-4-nathan@kernel.org
Link: https://lore.kernel.org/r/20210813201418.4018631-1-nathan@kernel.org
Use the IW_HANDLER macro to declare the handler functions for
wext ioctls. We don't have to skip unused ioctl numbers manually.
The same modification was applied to the deprecated rtl8188eu driver in
commit af249fce390f ("staging: rtl8188eu: use IW_HANDLER to declare wext
handlers").
Link: https://lore.kernel.org/r/20210807153636.11712-11-martin@kaiser.cx