[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <af980df4-a308-4aab-8628-ca02b55de43f@www.fastmail.com>
Date: Wed, 07 Sep 2022 15:47:37 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
Cc: "Jiri Slaby" <jirislaby@...nel.org>,
"Johan Hovold" <johan@...nel.org>,
linux-serial <linux-serial@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
"Tobias Klauser" <tklauser@...tanz.ch>,
"Richard Genoud" <richard.genoud@...il.com>,
"Nicolas Ferre" <nicolas.ferre@...rochip.com>,
"Alexandre Belloni" <alexandre.belloni@...tlin.com>,
"Claudiu Beznea" <claudiu.beznea@...rochip.com>,
"Vladimir Zapolskiy" <vz@...ia.com>,
"Liviu Dudau" <liviu.dudau@....com>,
"Sudeep Holla" <sudeep.holla@....com>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@....com>,
"Shawn Guo" <shawnguo@...nel.org>,
"Sascha Hauer" <s.hauer@...gutronix.de>,
"Pengutronix Kernel Team" <kernel@...gutronix.de>,
"Fabio Estevam" <festevam@...il.com>,
"NXP Linux Team" <linux-imx@....com>,
Andreas Färber <afaerber@...e.de>,
"Manivannan Sadhasivam" <mani@...nel.org>,
"Russell King" <linux@...linux.org.uk>,
"Florian Fainelli" <f.fainelli@...il.com>,
bcm-kernel-feedback-list@...adcom.com,
Pali Rohár <pali@...nel.org>,
"Kevin Cernekee" <cernekee@...il.com>,
"Palmer Dabbelt" <palmer@...belt.com>,
"Paul Walmsley" <paul.walmsley@...ive.com>,
"Orson Zhai" <orsonzhai@...il.com>,
"Baolin Wang" <baolin.wang7@...il.com>,
"Chunyan Zhang" <zhang.lyra@...il.com>,
"Patrice Chotard" <patrice.chotard@...s.st.com>,
linux-riscv@...ts.infradead.org
Subject: Re: [PATCH v3 0/4] tty: TX helpers
On Wed, Sep 7, 2022, at 2:56 PM, Ilpo Järvinen wrote:
> On Wed, 7 Sep 2022, Greg Kroah-Hartman wrote:
>> Ok, no, I don't understand what Arnd meant here then :(
>
> I think he did just 2 things (compared with 2/4 of this series):
>
> - __DEFINE_UART_PORT_TX_HELPER() doesn't create a function but just wraps
> the macro body with ({ }). Therefore, a driver must use it inside
> a function rather than the macro creating a new function with name.
> - Use lowercase instead of uppercase (this is a trivial change)
>
> When a driver is using these "function" that are just made look functions
> but are macros for real, it will not add function-pointer-indirection-call
> per character but pulls the whole loop from the macro into the function
> in the driver and injects those putchar, etc. directly into that loop.
> ...It is just like read_poll_timeout() constructs the loop.
Right, the example I was thinking of was wait_event(), which is
another common macro that takes expressions as arguments but gets
used like a function call. Same thing really.
Note that even with an always_inline function that takes a
function pointer argument, anything from gcc-4.7 up has no
problem inlining through that, so it should not be any less
efficient though it might not help readability either.
See https://godbolt.org/z/o8GGG8TzM for an example of that.
Arnd
Powered by blists - more mailing lists