public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Ethan Tidmore <ethantidmore06@gmail.com>
Cc: parthiban.veerasooran@microchip.com,
	christian.gromm@microchip.com, gregkh@linuxfoundation.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] staging: most: dim2: replace macro with static inline function
Date: Fri, 23 Jan 2026 12:02:25 +0300	[thread overview]
Message-ID: <aXM5IcS9jNTytEgS@stanley.mountain> (raw)
In-Reply-To: <20260123054708.11140-1-ethantidmore06@gmail.com>

On Thu, Jan 22, 2026 at 11:47:08PM -0600, Ethan Tidmore wrote:
> Replace unsafe macro with static inline function to avoid side effects.
> 
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
> ---
>  drivers/staging/most/dim2/dim2.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
> index dad2abe6c0c9..a075a2df349e 100644
> --- a/drivers/staging/most/dim2/dim2.c
> +++ b/drivers/staging/most/dim2/dim2.c
> @@ -113,10 +113,12 @@ static inline struct dim2_hdm *iface_to_hdm(struct most_interface *iface)
>  	return container_of(iface, struct dim2_hdm, most_iface);
>  }
>  
> -/* Macro to identify a network status message */
> -#define PACKET_IS_NET_INFO(p)  \
> -	(((p)[1] == 0x18) && ((p)[2] == 0x05) && ((p)[3] == 0x0C) && \
> -	 ((p)[13] == 0x3C) && ((p)[14] == 0x00) && ((p)[15] == 0x0A))
> +/* Identify a network status message */
> +static inline bool packet_is_net_info(const u8 *p)

These days we tend not to mark functions as inline since the compiler
is smart enough to do it on it's own and it's mostly going to ignore
our inlining suggestions anyway.  If it really matters in benchmarking
the use the __always_inline annotation.

> +{
> +	return p[1] == 0x18 && p[2] == 0x05 && p[3] == 0x0C &&
> +		p[13] == 0x3C && p[14] == 0x00 && p[15] == 0x0A;

This should be aligned slight differently.
[tab][space x 7]p[13] == 0x3C && p[14] == 0x00 && p[15] == 0x0A;

regards,
dan carpenter


      reply	other threads:[~2026-01-23  9:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23  5:47 [PATCH v1] staging: most: dim2: replace macro with static inline function Ethan Tidmore
2026-01-23  9:02 ` Dan Carpenter [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=aXM5IcS9jNTytEgS@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=christian.gromm@microchip.com \
    --cc=ethantidmore06@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=parthiban.veerasooran@microchip.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