Re: [PATCH v3 0/4] tty: TX helpers

From: Johan Hovold
Date: Fri Sep 09 2022 - 08:24:21 EST


On Wed, Sep 07, 2022 at 01:16:23PM +0300, Ilpo Järvinen wrote:

> Also, I don't understand why you see it unreadable when the actual code is
> out in the open in that macro. It's formatted much better than e.g.
> read_poll_timeout() if you want an example of something that is hardly
> readable ;-). I agree though there's a learning-curve, albeit small, that
> it actually creates a function but that doesn't seem to me as big of an
> obstacle you seem to think.

There's a huge difference between the proposed macro with its
I-lost-count-of-how-many arguments and levels of indirection and
something like wait_event() which take one condition and has a
descriptive name:

wait_event(device->misc_wait, atomic_read(&device->ap_pending_cnt) == 0);

vs

static DEFINE_UART_PORT_TX_HELPER_LIMITED(altera_jtaguart_do_tx_chars,
true,
writel(ch, port->membase + ALTERA_JTAGUART_DATA_REG),
({}));

In the former case, you just need to look at the code to understand what
is going on, very much unlike in the latter case.

Johan