public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Brent Pappas <bpappas@pappasbrent.com>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	Brent Pappas <pappasbrent@gmail.com>
Subject: Re: [PATCH] staging: rtl8723bs: core: Replace macros RotR1 through Mk16 with static inline functions
Date: Tue, 18 Oct 2022 07:28:31 +0200	[thread overview]
Message-ID: <Y045f/UzV8Dx5tpp@kroah.com> (raw)
In-Reply-To: <20221017171653.12578-1-bpappas@pappasbrent.com>

On Mon, Oct 17, 2022 at 01:16:54PM -0400, Brent Pappas wrote:
> From: Brent Pappas <pappasbrent@gmail.com>
> 
> Replace macros "RotR1", "Lo8", "Hi8", "Lo16", "Hi16", and "Mk16" with
> static inline functions to comply with Linux coding style standards.
> 
> Signed-off-by: Brent Pappas <bpappas@pappasbrent.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_security.c | 35 +++++++++++++++----
>  1 file changed, 29 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
> index ac731415f733..519e141fb82c 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_security.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_security.c
> @@ -253,12 +253,35 @@ void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_cod
>  }
>  
>  /* macros for extraction/creation of unsigned char/unsigned short values  */
> -#define RotR1(v16)   ((((v16) >> 1) & 0x7FFF) ^ (((v16) & 1) << 15))
> -#define   Lo8(v16)   ((u8)((v16)       & 0x00FF))
> -#define   Hi8(v16)   ((u8)(((v16) >> 8) & 0x00FF))
> -#define  Lo16(v32)   ((u16)((v32)       & 0xFFFF))
> -#define  Hi16(v32)   ((u16)(((v32) >> 16) & 0xFFFF))
> -#define  Mk16(hi, lo) ((lo) ^ (((u16)(hi)) << 8))
> +static inline u16 RotR1(u16 v16)
> +{
> +	return ((((v16) >> 1) & 0x7FFF) ^ (((v16) & 1) << 15));
> +}
> +
> +static inline u8 Lo8(u16 v16)
> +{
> +	return ((u8)((v16)       & 0x00FF));

Odd use of spaces, doesn't checkpatch complain about this?

But the larger question is, don't we already have functions for this in
the core kernel?  Why not just use them instead of hand-rolling custom
functions instead?

thanks,

greg k-h

      reply	other threads:[~2022-10-18  5:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 17:16 [PATCH] staging: rtl8723bs: core: Replace macros RotR1 through Mk16 with static inline functions Brent Pappas
2022-10-18  5:28 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y045f/UzV8Dx5tpp@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bpappas@pappasbrent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=pappasbrent@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox