There are only two definitions from ethernet.h used in the driver.
Namely:
Both are only used in the file core/rtw_recv.c. Replace the usage of
ETHERNET_HEADER_SIZE with ETH_HLEN, move the definition of LLC_HEADER_SIZE
into rtw_recv.h and remove the now unused ethernet.h header file.
Link: https://lore.kernel.org/r/20210824123621.10801-4-straube.linux@gmail.com
The struct ip_options declared in ip.h is only unsed in the optlength
macro which is also defined in ip.h and not used in the driver code.
All other definitions/declarations in ip.h are duplicated from
<include/uapi/linux/ip.h>. Remove the ip.h header file and its includes.
Link: https://lore.kernel.org/r/20210824123621.10801-3-straube.linux@gmail.com
Many defined constants in wifi.h are unused and/or available from
<linux/ieee80211.h>, some with slightly different names. Remove
the constants from ieee80211.h and wifi.h and use the common ones. Rename where
necessary.
Set the pipe for reading or writing in usbctrl_vendorreq only once.
There's no need to set it again for every retry.
This patch is an adaptation of commit 889ed8b5e374 ("staging: rtl8188eu:
set pipe only once") for the new r8188eu driver.
Link: https://lore.kernel.org/r/20210821164859.4351-10-martin@kaiser.cx
The bRequest value for the vendor specific control requests sent by this
driver is always 0x05. Replace the function parameter with the define from
usb_ops.h.
This patch is an adaptation of commit eeb4661560ff ("staging: rtl8188eu:
ctrl vendor req value is always 0x05") for the new r8188eu driver.
Link: https://lore.kernel.org/r/20210818200041.10870-1-martin@kaiser.cx
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