lkml.org 
[lkml]   [2024]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 1/1] serial: max3100: Convert to_max3100_port() to be static inline
On Wed, Apr 10, 2024 at 04:20:10PM +0200, Greg Kroah-Hartman wrote:
> On Wed, Apr 10, 2024 at 05:11:35PM +0300, 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.
>
> Is there a problem today?

Nope. And if anyone tries to make it a problem it won't build, so
unlikely problematic code can ever be upstreamed.

> If not, this line isn't needed, as it sounds
> like you are fixing a problem here, when all you are doing is making it
> "nicer", right?

Correct.

..

> > -#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);
>
> Note, the one reason you might want to do this as a #define is if you
> use container_of_const() which has to be a #define. So the fact that
> this was a define to start with is normal and not really a big deal.

Noted.

Thanks for review!

--
With Best Regards,
Andy Shevchenko



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