Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: max3100: Convert to_max3100_port() to be static inline

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>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20240410141135.1378948-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
25ca2d57 46f2bba8

+4 -1
+4 -1
drivers/tty/serial/max3100.c
··· 111 111 struct timer_list timer; 112 112 }; 113 113 114 - #define to_max3100_port(port) container_of(port, struct max3100_port, port) 114 + static inline struct max3100_port *to_max3100_port(struct uart_port *port) 115 + { 116 + return container_of(port, struct max3100_port, port); 117 + } 115 118 116 119 static struct max3100_port *max3100s[MAX_MAX3100]; /* the chips */ 117 120 static DEFINE_MUTEX(max3100s_lock); /* race on probe */