lkml.org 
[lkml]   [2022]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 01/56] staging: r8188eu: add parenthesis to macro SetToDs
On Mon, Jan 03, 2022 at 08:01:36PM +0100, Alberto Merciai wrote:
> Enclose in parenthesis complex macro SetToDs

Why?

You are saying what you are doing (which is easy to see by looking at
the patch itself), but not _why_ you are doing this. Please read the
documentation in the kernel source tree for how to write a good kernel
commit message. It is in the section entitled "The canonical patch
format" in the kernel file, Documentation/SubmittingPatches.

> Signed-off-by: Alberto Merciai <alb3rt0.m3rciai@gmail.com>
> ---
> drivers/staging/r8188eu/include/wifi.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h
> index 7cbc7015e90f..f16e9f44babe 100644
> --- a/drivers/staging/r8188eu/include/wifi.h
> +++ b/drivers/staging/r8188eu/include/wifi.h
> @@ -164,7 +164,7 @@ enum WIFI_REG_DOMAIN {
> #define _ORDER_ BIT(15)
>
> #define SetToDs(pbuf) \
> - *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_)
> + (*(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_))

The cast here should not be happening as odds are it hides other endian
issues.

Also the name is horrid, but really, the lack of () is is fine as-is as
it is used as a "function call" in the driver. Wrapping it in () does
nothing to it at all from what I can tell so this change isn't even
helping :(

Why not fix this up properly by replacing the places where it is called
with the code here instead?

For example, these lines:
else if ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE)
SetToDs(fctrl);
would be:
else if ((pmlmeinfo->state & 0x03) == WIFI_FW_STATION_STATE)
fctrl |= cpu_to_le16(_TO_DS_);

Isn't that now much more readable and easier to understand what is
happening here?

Then there's the crazyness of a bit field being called "_TO_DS_", but
that can be cleaned up later...

I hate to reject patch 1 of a 50+ patch series, but next time try
sending smaller series so that you don't have to redo a bunch of work
like now has to happen here (the same comments apply to your other ()
patches in this series.)

thanks,

greg k-h

\
 
 \ /
  Last update: 2022-01-06 15:13    [W:0.522 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site