lkml.org 
[lkml]   [2024]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v1 1/1] serial: max3100: Convert to_max3100_port() to be static inline
On Wed, 10 Apr 2024, Andy Shevchenko wrote:

> As Jiri rightfully pointed out the current to_max3100_port() macro
> implementation is fragile in a sense that it expects the variable
> name to be port, otherwise it blow up the build.
>
> Change this to be static inline to prevent bad compilation.
>
> Suggested-by: Jiri Slaby <jirislaby@kernel.org>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/tty/serial/max3100.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
> index 1e6b5763ce3f..07ee001640bb 100644
> --- a/drivers/tty/serial/max3100.c
> +++ b/drivers/tty/serial/max3100.c
> @@ -111,7 +111,10 @@ struct max3100_port {
> struct timer_list timer;
> };
>
> -#define to_max3100_port(port) container_of(port, struct max3100_port, port)
> +static inline struct max3100_port *to_max3100_port(struct uart_port *port)
> +{
> + return container_of(port, struct max3100_port, port);
> +}
>
> static struct max3100_port *max3100s[MAX_MAX3100]; /* the chips */
> static DEFINE_MUTEX(max3100s_lock); /* race on probe */
>

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

It seems liteuart has the same trap.

--
i.
\
 
 \ /
  Last update: 2024-05-27 16:35    [W:0.049 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site