[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aXM5IcS9jNTytEgS@stanley.mountain>
Date: Fri, 23 Jan 2026 12:02:25 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Ethan Tidmore <ethantidmore06@...il.com>
Cc: parthiban.veerasooran@...rochip.com, christian.gromm@...rochip.com,
gregkh@...uxfoundation.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] staging: most: dim2: replace macro with static inline
function
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@...il.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
Powered by blists - more mailing lists