serial: pic32: convert to_pic32_sport() to an inline
authorJiri Slaby <jslaby@suse.cz>
Tue, 3 May 2022 06:31:18 +0000 (08:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 May 2022 20:39:18 +0000 (22:39 +0200)
'c' is not in wrapped in parentheses in the to_pic32_sport() macro, so
it might be problematic wrt macro expansion. Using an inline is always
safer in these cases. Both type-wise and macro-expansion-wise. So switch
the macro to an inline.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220503063122.20957-8-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/pic32_uart.c

index 32a86b12f2032c6f0964a27e5e59b2a0473a4e2f..c3b4fd0b5b76868b3bea9e1aa5e0a2be97a0b3cb 100644 (file)
@@ -72,7 +72,11 @@ struct pic32_sport {
 
        struct device *dev;
 };
-#define to_pic32_sport(c) container_of(c, struct pic32_sport, port)
+
+static inline struct pic32_sport *to_pic32_sport(struct uart_port *port)
+{
+       return container_of(port, struct pic32_sport, port);
+}
 
 static inline void pic32_uart_writel(struct pic32_sport *sport,
                                        u32 reg, u32 val)