Re: [PATCH 01/56] staging: r8188eu: add parenthesis to macro SetToDs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> ---
>  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




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux