Skip to content

Commit

Permalink
serial: max3100: Convert to_max3100_port() to be static inline
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andy Shevchenko authored and Greg Kroah-Hartman committed Apr 11, 2024
1 parent 46f2bba commit 25ca2d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/tty/serial/max3100.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 25ca2d5

Please sign in to comment.