Hi,
While adding upstream support to a new platform (Mobileye EyeQ5[1]) that
uses the AMBA PL011 driver, I took some time to look at the PL011
driver and ended up with a few patches that cleanup parts of it. The
line-diff is big mostly because of the checkpatch-fixing commits.
The driver hadn't received any love for quite some time. See commit
messages for more information.
v5 has been rebased upon v6.7-rc1, with [PATCH v4 3/6] split into many
small commits and a header include in [PATCH v4 2/6] to fix a kernel
test robot report.
[1]: https://lore.kernel.org/all/[email protected]/T/
Have a nice day,
Théo Lebrun
Signed-off-by: Théo Lebrun <[email protected]>
---
Changes in v5:
- Rebase upon v6.7-rc1.
- Add #include <linux/bitfield.h> in include/linux/amba/serial.h.
- Split [PATCH v4 3/6] into 5 manageable commits.
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Fix reverse if logic bug in [PATCH V3 6/6].
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Replace magic constants in linux/amba/serial.h by FIELD_PREP_CONST calls
- Refactor QDF2400 SoC erratum 44 handling out of probe in a new patch
- A nit in "unindent pl011_console_get_options function body"
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- [PATCH 2]: add #include <linux/bits.h> in include/linux/amba/serial.h
as we use the BIT() macro.
- Move one whitespace cleanup from [PATCH 4/6] to [PATCH v2 3/5] where
it belongs.
- Drop [PATCH 6/6]: console will never have a word length of 5 or 6.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Théo Lebrun (9):
tty: serial: amba: cleanup whitespace
tty: serial: amba: Use linux/{bits,bitfield}.h macros
tty: serial: amba-pl011: fix whitespace formatting
tty: serial: amba-pl011: replace TIOCMBIT macros by static functions
tty: serial: amba-pl011: avoid quoted string split across lines
tty: serial: amba-pl011: fix formatting of conditions
tty: serial: amba-pl011: fix miscellaneous checkpatch warnings
tty: serial: amba-pl011: unindent pl011_console_get_options function body
tty: serial: amba-pl011: factor QDF2400 SoC erratum 44 out of probe
drivers/tty/serial/amba-pl011.c | 261 +++++++++++++++++++++-------------------
include/linux/amba/serial.h | 258 ++++++++++++++++++++-------------------
2 files changed, 266 insertions(+), 253 deletions(-)
---
base-commit: 9e47ce5c186d8364f4de3e879a148121b37e5216
change-id: 20231023-mbly-uart-afcacbb98f8b
Best regards,
--
Théo Lebrun <[email protected]>
Follow recommandations from:
$ ./scripts/checkpatch.pl --strict --file \
drivers/tty/serial/amba-pl011.c
We fix 5 warnings and 48 checks, all related to whitespace.
Culprits are:
CHECK: Alignment should match open parenthesis
CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Lines should not end with a '('
CHECK: Please don't use multiple blank lines
CHECK: Please use a blank line after function/struct/union/enum
declarations
CHECK: spaces preferred around that '/' (ctx:VxV)
CHECK: spaces preferred around that '|' (ctx:VxV)
WARNING: Missing a blank line after declarations
WARNING: please, no spaces at the start of a line
Signed-off-by: Théo Lebrun <[email protected]>
---
drivers/tty/serial/amba-pl011.c | 97 +++++++++++++++++++----------------------
1 file changed, 45 insertions(+), 52 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index b7635363373e..7bd0b68ef92f 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -50,7 +50,7 @@
#define AMBA_ISR_PASS_LIMIT 256
-#define UART_DR_ERROR (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE)
+#define UART_DR_ERROR (UART011_DR_OE | UART011_DR_BE | UART011_DR_PE | UART011_DR_FE)
#define UART_DUMMY_DR_RX (1 << 16)
enum {
@@ -125,7 +125,7 @@ static unsigned int get_fifosize_arm(struct amba_device *dev)
static struct vendor_data vendor_arm = {
.reg_offset = pl011_std_offsets,
- .ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8,
+ .ifls = UART011_IFLS_RX4_8 | UART011_IFLS_TX4_8,
.fr_busy = UART01x_FR_BUSY,
.fr_dsr = UART01x_FR_DSR,
.fr_cts = UART01x_FR_CTS,
@@ -203,7 +203,7 @@ static unsigned int get_fifosize_st(struct amba_device *dev)
static struct vendor_data vendor_st = {
.reg_offset = pl011_st_offsets,
- .ifls = UART011_IFLS_RX_HALF|UART011_IFLS_TX_HALF,
+ .ifls = UART011_IFLS_RX_HALF | UART011_IFLS_TX_HALF,
.fr_busy = UART01x_FR_BUSY,
.fr_dsr = UART01x_FR_DSR,
.fr_cts = UART01x_FR_CTS,
@@ -277,13 +277,13 @@ struct uart_amba_port {
static unsigned int pl011_tx_empty(struct uart_port *port);
static unsigned int pl011_reg_to_offset(const struct uart_amba_port *uap,
- unsigned int reg)
+ unsigned int reg)
{
return uap->reg_offset[reg];
}
static unsigned int pl011_read(const struct uart_amba_port *uap,
- unsigned int reg)
+ unsigned int reg)
{
void __iomem *addr = uap->port.membase + pl011_reg_to_offset(uap, reg);
@@ -292,7 +292,7 @@ static unsigned int pl011_read(const struct uart_amba_port *uap,
}
static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
- unsigned int reg)
+ unsigned int reg)
{
void __iomem *addr = uap->port.membase + pl011_reg_to_offset(uap, reg);
@@ -358,7 +358,6 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap)
return fifotaken;
}
-
/*
* All the DMA operation mode stuff goes inside this ifdef.
* This assumes that you have a generic DMA device interface,
@@ -369,7 +368,7 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap)
#define PL011_DMA_BUFFER_SIZE PAGE_SIZE
static int pl011_dmabuf_init(struct dma_chan *chan, struct pl011_dmabuf *db,
- enum dma_data_direction dir)
+ enum dma_data_direction dir)
{
db->buf = dma_alloc_coherent(chan->device->dev, PL011_DMA_BUFFER_SIZE,
&db->dma, GFP_KERNEL);
@@ -381,7 +380,7 @@ static int pl011_dmabuf_init(struct dma_chan *chan, struct pl011_dmabuf *db,
}
static void pl011_dmabuf_free(struct dma_chan *chan, struct pl011_dmabuf *db,
- enum dma_data_direction dir)
+ enum dma_data_direction dir)
{
if (db->buf) {
dma_free_coherent(chan->device->dev,
@@ -424,7 +423,7 @@ static void pl011_dma_probe(struct uart_amba_port *uap)
dma_cap_set(DMA_SLAVE, mask);
chan = dma_request_channel(mask, plat->dma_filter,
- plat->dma_tx_param);
+ plat->dma_tx_param);
if (!chan) {
dev_err(uap->port.dev, "no TX DMA channel!\n");
return;
@@ -470,7 +469,7 @@ static void pl011_dma_probe(struct uart_amba_port *uap)
DMA_RESIDUE_GRANULARITY_DESCRIPTOR) {
dma_release_channel(chan);
dev_info(uap->port.dev,
- "RX DMA disabled - no residue processing\n");
+ "RX DMA disabled - no residue processing\n");
return;
}
}
@@ -499,18 +498,16 @@ static void pl011_dma_probe(struct uart_amba_port *uap)
else
uap->dmarx.poll_timeout = 3000;
} else if (!plat && dev->of_node) {
- uap->dmarx.auto_poll_rate = of_property_read_bool(
- dev->of_node, "auto-poll");
+ uap->dmarx.auto_poll_rate =
+ of_property_read_bool(dev->of_node, "auto-poll");
if (uap->dmarx.auto_poll_rate) {
u32 x;
- if (0 == of_property_read_u32(dev->of_node,
- "poll-rate-ms", &x))
+ if (0 == of_property_read_u32(dev->of_node, "poll-rate-ms", &x))
uap->dmarx.poll_rate = x;
else
uap->dmarx.poll_rate = 100;
- if (0 == of_property_read_u32(dev->of_node,
- "poll-timeout-ms", &x))
+ if (0 == of_property_read_u32(dev->of_node, "poll-timeout-ms", &x))
uap->dmarx.poll_timeout = x;
else
uap->dmarx.poll_timeout = 3000;
@@ -547,7 +544,7 @@ static void pl011_dma_tx_callback(void *data)
uart_port_lock_irqsave(&uap->port, &flags);
if (uap->dmatx.queued)
dma_unmap_single(dmatx->chan->device->dev, dmatx->dma,
- dmatx->len, DMA_TO_DEVICE);
+ dmatx->len, DMA_TO_DEVICE);
dmacr = uap->dmacr;
uap->dmacr = dmacr & ~UART011_TXDMAE;
@@ -643,7 +640,7 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
}
desc = dmaengine_prep_slave_single(chan, dmatx->dma, dmatx->len, DMA_MEM_TO_DEV,
- DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc) {
dma_unmap_single(dma_dev->dev, dmatx->dma, dmatx->len, DMA_TO_DEVICE);
uap->dmatx.queued = false;
@@ -832,8 +829,8 @@ static int pl011_dma_rx_trigger_dma(struct uart_amba_port *uap)
dbuf = uap->dmarx.use_buf_b ?
&uap->dmarx.dbuf_b : &uap->dmarx.dbuf_a;
desc = dmaengine_prep_slave_single(rxchan, dbuf->dma, dbuf->len,
- DMA_DEV_TO_MEM,
- DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+ DMA_DEV_TO_MEM,
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
/*
* If the DMA engine is busy and cannot prepare a
* channel, no big deal, the driver will fall back
@@ -889,14 +886,12 @@ static void pl011_dma_rx_chars(struct uart_amba_port *uap,
/* Pick the remain data from the DMA */
if (pending) {
-
/*
* First take all chars in the DMA pipe, then look in the FIFO.
* Note that tty_insert_flip_buf() tries to take as many chars
* as it can.
*/
- dma_count = tty_insert_flip_string(port, dbuf->buf + dmataken,
- pending);
+ dma_count = tty_insert_flip_string(port, dbuf->buf + dmataken, pending);
uap->port.icount.rx += dma_count;
if (dma_count < pending)
@@ -1072,7 +1067,7 @@ static void pl011_dma_rx_poll(struct timer_list *t)
dmataken = dbuf->len - dmarx->last_residue;
size = dmarx->last_residue - state.residue;
dma_count = tty_insert_flip_string(port, dbuf->buf + dmataken,
- size);
+ size);
if (dma_count == size)
dmarx->last_residue = state.residue;
dmarx->last_jiffies = jiffies;
@@ -1085,7 +1080,6 @@ static void pl011_dma_rx_poll(struct timer_list *t)
*/
if (jiffies_to_msecs(jiffies - dmarx->last_jiffies)
> uap->dmarx.poll_timeout) {
-
uart_port_lock_irqsave(&uap->port, &flags);
pl011_dma_rx_stop(uap);
uap->im |= UART011_RXIM;
@@ -1097,7 +1091,7 @@ static void pl011_dma_rx_poll(struct timer_list *t)
del_timer(&uap->dmarx.timer);
} else {
mod_timer(&uap->dmarx.timer,
- jiffies + msecs_to_jiffies(uap->dmarx.poll_rate));
+ jiffies + msecs_to_jiffies(uap->dmarx.poll_rate));
}
}
@@ -1129,7 +1123,7 @@ static void pl011_dma_startup(struct uart_amba_port *uap)
/* Allocate and map DMA RX buffers */
ret = pl011_dmabuf_init(uap->dmarx.chan, &uap->dmarx.dbuf_a,
- DMA_FROM_DEVICE);
+ DMA_FROM_DEVICE);
if (ret) {
dev_err(uap->port.dev, "failed to init DMA %s: %d\n",
"RX buffer A", ret);
@@ -1137,12 +1131,12 @@ static void pl011_dma_startup(struct uart_amba_port *uap)
}
ret = pl011_dmabuf_init(uap->dmarx.chan, &uap->dmarx.dbuf_b,
- DMA_FROM_DEVICE);
+ DMA_FROM_DEVICE);
if (ret) {
dev_err(uap->port.dev, "failed to init DMA %s: %d\n",
"RX buffer B", ret);
pl011_dmabuf_free(uap->dmarx.chan, &uap->dmarx.dbuf_a,
- DMA_FROM_DEVICE);
+ DMA_FROM_DEVICE);
goto skip_rx;
}
@@ -1169,8 +1163,7 @@ static void pl011_dma_startup(struct uart_amba_port *uap)
if (uap->dmarx.poll_rate) {
timer_setup(&uap->dmarx.timer, pl011_dma_rx_poll, 0);
mod_timer(&uap->dmarx.timer,
- jiffies +
- msecs_to_jiffies(uap->dmarx.poll_rate));
+ jiffies + msecs_to_jiffies(uap->dmarx.poll_rate));
uap->dmarx.last_residue = PL011_DMA_BUFFER_SIZE;
uap->dmarx.last_jiffies = jiffies;
}
@@ -1359,8 +1352,8 @@ static void pl011_stop_rx(struct uart_port *port)
struct uart_amba_port *uap =
container_of(port, struct uart_amba_port, port);
- uap->im &= ~(UART011_RXIM|UART011_RTIM|UART011_FEIM|
- UART011_PEIM|UART011_BEIM|UART011_OEIM);
+ uap->im &= ~(UART011_RXIM | UART011_RTIM | UART011_FEIM |
+ UART011_PEIM | UART011_BEIM | UART011_OEIM);
pl011_write(uap->im, uap, REG_IMSC);
pl011_dma_rx_stop(uap);
@@ -1380,7 +1373,7 @@ static void pl011_enable_ms(struct uart_port *port)
struct uart_amba_port *uap =
container_of(port, struct uart_amba_port, port);
- uap->im |= UART011_RIMIM|UART011_CTSMIM|UART011_DCDMIM|UART011_DSRMIM;
+ uap->im |= UART011_RIMIM | UART011_CTSMIM | UART011_DCDMIM | UART011_DSRMIM;
pl011_write(uap->im, uap, REG_IMSC);
}
@@ -1409,8 +1402,7 @@ __acquires(&uap->port.lock)
uap->dmarx.last_jiffies = jiffies;
uap->dmarx.last_residue = PL011_DMA_BUFFER_SIZE;
mod_timer(&uap->dmarx.timer,
- jiffies +
- msecs_to_jiffies(uap->dmarx.poll_rate));
+ jiffies + msecs_to_jiffies(uap->dmarx.poll_rate));
}
#endif
}
@@ -1557,18 +1549,17 @@ static irqreturn_t pl011_int(int irq, void *dev_id)
do {
check_apply_cts_event_workaround(uap);
- pl011_write(status & ~(UART011_TXIS|UART011_RTIS|
- UART011_RXIS),
+ pl011_write(status & ~(UART011_TXIS | UART011_RTIS | UART011_RXIS),
uap, REG_ICR);
- if (status & (UART011_RTIS|UART011_RXIS)) {
+ if (status & (UART011_RTIS | UART011_RXIS)) {
if (pl011_dma_rx_running(uap))
pl011_dma_rx_irq(uap);
else
pl011_rx_chars(uap);
}
- if (status & (UART011_DSRMIS|UART011_DCDMIS|
- UART011_CTSMIS|UART011_RIMIS))
+ if (status & (UART011_DSRMIS | UART011_DCDMIS |
+ UART011_CTSMIS | UART011_RIMIS))
pl011_modem_status(uap);
if (status & UART011_TXIS)
pl011_tx_chars(uap, true);
@@ -1707,8 +1698,7 @@ static int pl011_get_poll_char(struct uart_port *port)
return pl011_read(uap, REG_DR);
}
-static void pl011_put_poll_char(struct uart_port *port,
- unsigned char ch)
+static void pl011_put_poll_char(struct uart_port *port, unsigned char ch)
{
struct uart_amba_port *uap =
container_of(port, struct uart_amba_port, port);
@@ -1909,14 +1899,13 @@ static int sbsa_uart_startup(struct uart_port *port)
return 0;
}
-static void pl011_shutdown_channel(struct uart_amba_port *uap,
- unsigned int lcrh)
+static void pl011_shutdown_channel(struct uart_amba_port *uap, unsigned int lcrh)
{
- unsigned long val;
+ unsigned long val;
- val = pl011_read(uap, lcrh);
- val &= ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN);
- pl011_write(val, uap, lcrh);
+ val = pl011_read(uap, lcrh);
+ val &= ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN);
+ pl011_write(val, uap, lcrh);
}
/*
@@ -2065,7 +2054,7 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,
uap->dmarx.poll_rate = DIV_ROUND_UP(10000000, baud);
#endif
- if (baud > port->uartclk/16)
+ if (baud > port->uartclk / 16)
quot = DIV_ROUND_CLOSEST(port->uartclk * 8, baud);
else
quot = DIV_ROUND_CLOSEST(port->uartclk * 4, baud);
@@ -2218,13 +2207,14 @@ static void pl011_config_port(struct uart_port *port, int flags)
static int pl011_verify_port(struct uart_port *port, struct serial_struct *ser)
{
int ret = 0;
+
if (ser->type != PORT_UNKNOWN && ser->type != PORT_AMBA)
ret = -EINVAL;
if (ser->irq < 0 || ser->irq >= nr_irqs)
ret = -EINVAL;
if (ser->baud_base < 9600)
ret = -EINVAL;
- if (port->mapbase != (unsigned long) ser->iomem_base)
+ if (port->mapbase != (unsigned long)ser->iomem_base)
ret = -EINVAL;
return ret;
}
@@ -2613,7 +2603,9 @@ static int __init pl011_early_console_setup(struct earlycon_device *device,
return 0;
}
+
OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);
+
OF_EARLYCON_DECLARE(pl011, "arm,sbsa-uart", pl011_early_console_setup);
/*
@@ -2636,6 +2628,7 @@ qdf2400_e44_early_console_setup(struct earlycon_device *device,
device->con->write = qdf2400_e44_early_write;
return 0;
}
+
EARLYCON_DECLARE(qdf2400_e44, qdf2400_e44_early_console_setup);
#else
--
2.43.0
The whole function body is encapsulated inside an if-condition. Reverse
the if logic and early return to remove one indentation level.
Also turn two nested ifs into a single one at the end of the function.
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Théo Lebrun <[email protected]>
---
drivers/tty/serial/amba-pl011.c | 43 ++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index d141af8f8a5f..fe910c5f3489 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2363,35 +2363,34 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
static void pl011_console_get_options(struct uart_amba_port *uap, int *baud,
int *parity, int *bits)
{
- if (pl011_read(uap, REG_CR) & UART01x_CR_UARTEN) {
- unsigned int lcr_h, ibrd, fbrd;
+ unsigned int lcr_h, ibrd, fbrd;
- lcr_h = pl011_read(uap, REG_LCRH_TX);
+ if (!(pl011_read(uap, REG_CR) & UART01x_CR_UARTEN))
+ return;
- *parity = 'n';
- if (lcr_h & UART01x_LCRH_PEN) {
- if (lcr_h & UART01x_LCRH_EPS)
- *parity = 'e';
- else
- *parity = 'o';
- }
+ lcr_h = pl011_read(uap, REG_LCRH_TX);
- if ((lcr_h & 0x60) == UART01x_LCRH_WLEN_7)
- *bits = 7;
+ *parity = 'n';
+ if (lcr_h & UART01x_LCRH_PEN) {
+ if (lcr_h & UART01x_LCRH_EPS)
+ *parity = 'e';
else
- *bits = 8;
+ *parity = 'o';
+ }
- ibrd = pl011_read(uap, REG_IBRD);
- fbrd = pl011_read(uap, REG_FBRD);
+ if ((lcr_h & 0x60) == UART01x_LCRH_WLEN_7)
+ *bits = 7;
+ else
+ *bits = 8;
- *baud = uap->port.uartclk * 4 / (64 * ibrd + fbrd);
+ ibrd = pl011_read(uap, REG_IBRD);
+ fbrd = pl011_read(uap, REG_FBRD);
- if (uap->vendor->oversampling) {
- if (pl011_read(uap, REG_CR)
- & ST_UART011_CR_OVSFACT)
- *baud *= 2;
- }
- }
+ *baud = uap->port.uartclk * 4 / (64 * ibrd + fbrd);
+
+ if (uap->vendor->oversampling &&
+ (pl011_read(uap, REG_CR) & ST_UART011_CR_OVSFACT))
+ *baud *= 2;
}
static int pl011_console_setup(struct console *co, char *options)
--
2.43.0
Remove all instances of quoted strings split across lines. Fix four
checkpatch warnings:
$ ./scripts/checkpatch.pl --strict --file \
drivers/tty/serial/amba-pl011.c
WARNING: quoted string split across lines
[...]
Signed-off-by: Théo Lebrun <[email protected]>
---
drivers/tty/serial/amba-pl011.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 743dee75c68b..be8888db1a37 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -973,8 +973,8 @@ static void pl011_dma_rx_irq(struct uart_amba_port *uap)
/* Switch buffer & re-trigger DMA job */
dmarx->use_buf_b = !dmarx->use_buf_b;
if (pl011_dma_rx_trigger_dma(uap)) {
- dev_dbg(uap->port.dev, "could not retrigger RX DMA job "
- "fall back to interrupt mode\n");
+ dev_dbg(uap->port.dev,
+ "could not retrigger RX DMA job fall back to interrupt mode\n");
uap->im |= UART011_RXIM;
pl011_write(uap->im, uap, REG_IMSC);
}
@@ -1021,8 +1021,8 @@ static void pl011_dma_rx_callback(void *data)
* get some IRQ immediately from RX.
*/
if (ret) {
- dev_dbg(uap->port.dev, "could not retrigger RX DMA job "
- "fall back to interrupt mode\n");
+ dev_dbg(uap->port.dev,
+ "could not retrigger RX DMA job fall back to interrupt mode\n");
uap->im |= UART011_RXIM;
pl011_write(uap->im, uap, REG_IMSC);
}
@@ -1158,8 +1158,8 @@ static void pl011_dma_startup(struct uart_amba_port *uap)
if (uap->using_rx_dma) {
if (pl011_dma_rx_trigger_dma(uap))
- dev_dbg(uap->port.dev, "could not trigger initial "
- "RX DMA job, fall back to interrupt mode\n");
+ dev_dbg(uap->port.dev,
+ "could not trigger initial RX DMA job, fall back to interrupt mode\n");
if (uap->dmarx.poll_rate) {
timer_setup(&uap->dmarx.timer, pl011_dma_rx_poll, 0);
mod_timer(&uap->dmarx.timer,
@@ -1391,8 +1391,8 @@ __acquires(&uap->port.lock)
*/
if (pl011_dma_rx_available(uap)) {
if (pl011_dma_rx_trigger_dma(uap)) {
- dev_dbg(uap->port.dev, "could not trigger RX DMA job "
- "fall back to interrupt mode again\n");
+ dev_dbg(uap->port.dev,
+ "could not trigger RX DMA job fall back to interrupt mode again\n");
uap->im |= UART011_RXIM;
pl011_write(uap->im, uap, REG_IMSC);
} else {
--
2.43.0
Fix whitespace in include/linux/amba/serial.h to match current kernel
coding standards. Fixes about:
- CHECK: spaces preferred around that '|' (ctx:VxV)
- ERROR: code indent should use tabs where possible
- WARNING: Unnecessary space before function pointer arguments
- WARNING: please, no spaces at the start of a line
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Théo Lebrun <[email protected]>
---
include/linux/amba/serial.h | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index a1307b58cc2c..27003ec52114 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -75,10 +75,10 @@
#define UART011_DR_PE (1 << 9)
#define UART011_DR_FE (1 << 8)
-#define UART01x_RSR_OE 0x08
-#define UART01x_RSR_BE 0x04
-#define UART01x_RSR_PE 0x02
-#define UART01x_RSR_FE 0x01
+#define UART01x_RSR_OE 0x08
+#define UART01x_RSR_BE 0x04
+#define UART01x_RSR_PE 0x02
+#define UART01x_RSR_FE 0x01
#define UART011_FR_RI 0x100
#define UART011_FR_TXFE 0x080
@@ -86,9 +86,9 @@
#define UART01x_FR_TXFF 0x020
#define UART01x_FR_RXFE 0x010
#define UART01x_FR_BUSY 0x008
-#define UART01x_FR_DCD 0x004
-#define UART01x_FR_DSR 0x002
-#define UART01x_FR_CTS 0x001
+#define UART01x_FR_DCD 0x004
+#define UART01x_FR_DSR 0x002
+#define UART01x_FR_CTS 0x001
#define UART01x_FR_TMSK (UART01x_FR_TXFF + UART01x_FR_BUSY)
/*
@@ -110,14 +110,14 @@
#define UART011_CR_TXE 0x0100 /* transmit enable */
#define UART011_CR_LBE 0x0080 /* loopback enable */
#define UART010_CR_RTIE 0x0040
-#define UART010_CR_TIE 0x0020
-#define UART010_CR_RIE 0x0010
+#define UART010_CR_TIE 0x0020
+#define UART010_CR_RIE 0x0010
#define UART010_CR_MSIE 0x0008
#define ST_UART011_CR_OVSFACT 0x0008 /* Oversampling factor */
#define UART01x_CR_IIRLP 0x0004 /* SIR low power mode */
#define UART01x_CR_SIREN 0x0002 /* SIR enable */
#define UART01x_CR_UARTEN 0x0001 /* UART enable */
-
+
#define UART011_LCRH_SPS 0x80
#define UART01x_LCRH_WLEN_8 0x60
#define UART01x_LCRH_WLEN_7 0x40
@@ -203,8 +203,8 @@
#define UART011_TXDMAE (1 << 1) /* enable transmit dma */
#define UART011_RXDMAE (1 << 0) /* enable receive dma */
-#define UART01x_RSR_ANY (UART01x_RSR_OE|UART01x_RSR_BE|UART01x_RSR_PE|UART01x_RSR_FE)
-#define UART01x_FR_MODEM_ANY (UART01x_FR_DCD|UART01x_FR_DSR|UART01x_FR_CTS)
+#define UART01x_RSR_ANY (UART01x_RSR_OE | UART01x_RSR_BE | UART01x_RSR_PE | UART01x_RSR_FE)
+#define UART01x_FR_MODEM_ANY (UART01x_FR_DCD | UART01x_FR_DSR | UART01x_FR_CTS)
#ifndef __ASSEMBLY__
struct amba_device; /* in uncompress this is included but amba/bus.h is not */
@@ -220,8 +220,8 @@ struct amba_pl011_data {
bool dma_rx_poll_enable;
unsigned int dma_rx_poll_rate;
unsigned int dma_rx_poll_timeout;
- void (*init) (void);
- void (*exit) (void);
+ void (*init)(void);
+ void (*exit)(void);
};
#endif
--
2.43.0
On this platform, different vendor data is used. That requires a
compile-time check as we access (1) a global boolean & (2) our local
vendor data. Both symbols are accessible only when
CONFIG_ACPI_SPCR_TABLE is enabled.
Factor the vendor data overriding to a separate function that is empty
when CONFIG_ACPI_SPCR_TABLE is not defined.
Suggested-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Théo Lebrun <[email protected]>
---
drivers/tty/serial/amba-pl011.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index fe910c5f3489..d50e3c14b0e4 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2869,6 +2869,22 @@ static int pl011_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(pl011_dev_pm_ops, pl011_suspend, pl011_resume);
+#ifdef CONFIG_ACPI_SPCR_TABLE
+static void qpdf2400_erratum44_workaround(struct device *dev,
+ struct uart_amba_port *uap)
+{
+ if (!qdf2400_e44_present)
+ return;
+
+ dev_info(dev, "working around QDF2400 SoC erratum 44\n");
+ uap->vendor = &vendor_qdt_qdf2400_e44;
+}
+#else
+static void qpdf2400_erratum44_workaround(struct device *dev,
+ struct uart_amba_port *uap)
+{ /* empty */ }
+#endif
+
static int sbsa_uart_probe(struct platform_device *pdev)
{
struct uart_amba_port *uap;
@@ -2904,13 +2920,8 @@ static int sbsa_uart_probe(struct platform_device *pdev)
return ret;
uap->port.irq = ret;
-#ifdef CONFIG_ACPI_SPCR_TABLE
- if (qdf2400_e44_present) {
- dev_info(&pdev->dev, "working around QDF2400 SoC erratum 44\n");
- uap->vendor = &vendor_qdt_qdf2400_e44;
- } else
-#endif
- uap->vendor = &vendor_sbsa;
+ uap->vendor = &vendor_sbsa;
+ qpdf2400_erratum44_workaround(&pdev->dev, uap);
uap->reg_offset = uap->vendor->reg_offset;
uap->fifosize = 32;
--
2.43.0
The driver uses two TIOCMBIT macros inside pl011_{get,set}_mctrl to
simplify the logic. Those look scary to checkpatch because they contain
ifs without do-while loops.
Avoid the macros by creating small equivalent static functions; that
lets the compiler do its type checking & avoids checkpatch errors.
For the second instance __assign_bit is not usable because it deals with
unsigned long pointers whereas we have an unsigned int in
pl011_set_mctrl.
This addresses the following checkpatch warnings:
$ ./scripts/checkpatch.pl --strict --file \
drivers/tty/serial/amba-pl011.c
ERROR: Macros starting with if should be enclosed by a do -
while loop to avoid possible if/else logic defects
CHECK: Macro argument 'uartbit' may be better as '(uartbit)' to
avoid precedence issues
ERROR: Macros starting with if should be enclosed by a do - while
loop to avoid possible if/else logic defects
CHECK: Macro argument 'tiocmbit' may be better as '(tiocmbit)' to
avoid precedence issues
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Théo Lebrun <[email protected]>
---
drivers/tty/serial/amba-pl011.c | 45 ++++++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 7bd0b68ef92f..743dee75c68b 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1589,6 +1589,12 @@ static unsigned int pl011_tx_empty(struct uart_port *port)
0 : TIOCSER_TEMT;
}
+static void pl011_maybe_set_bit(bool cond, unsigned int *ptr, unsigned int mask)
+{
+ if (cond)
+ *ptr |= mask;
+}
+
static unsigned int pl011_get_mctrl(struct uart_port *port)
{
struct uart_amba_port *uap =
@@ -1596,18 +1602,22 @@ static unsigned int pl011_get_mctrl(struct uart_port *port)
unsigned int result = 0;
unsigned int status = pl011_read(uap, REG_FR);
-#define TIOCMBIT(uartbit, tiocmbit) \
- if (status & uartbit) \
- result |= tiocmbit
+ pl011_maybe_set_bit(status & UART01x_FR_DCD, &result, TIOCM_CAR);
+ pl011_maybe_set_bit(status & uap->vendor->fr_dsr, &result, TIOCM_DSR);
+ pl011_maybe_set_bit(status & uap->vendor->fr_cts, &result, TIOCM_CTS);
+ pl011_maybe_set_bit(status & uap->vendor->fr_ri, &result, TIOCM_RNG);
- TIOCMBIT(UART01x_FR_DCD, TIOCM_CAR);
- TIOCMBIT(uap->vendor->fr_dsr, TIOCM_DSR);
- TIOCMBIT(uap->vendor->fr_cts, TIOCM_CTS);
- TIOCMBIT(uap->vendor->fr_ri, TIOCM_RNG);
-#undef TIOCMBIT
return result;
}
+static void pl011_assign_bit(bool cond, unsigned int *ptr, unsigned int mask)
+{
+ if (cond)
+ *ptr |= mask;
+ else
+ *ptr &= ~mask;
+}
+
static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl)
{
struct uart_amba_port *uap =
@@ -1616,23 +1626,16 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl)
cr = pl011_read(uap, REG_CR);
-#define TIOCMBIT(tiocmbit, uartbit) \
- if (mctrl & tiocmbit) \
- cr |= uartbit; \
- else \
- cr &= ~uartbit
-
- TIOCMBIT(TIOCM_RTS, UART011_CR_RTS);
- TIOCMBIT(TIOCM_DTR, UART011_CR_DTR);
- TIOCMBIT(TIOCM_OUT1, UART011_CR_OUT1);
- TIOCMBIT(TIOCM_OUT2, UART011_CR_OUT2);
- TIOCMBIT(TIOCM_LOOP, UART011_CR_LBE);
+ pl011_assign_bit(mctrl & TIOCM_RTS, &cr, UART011_CR_RTS);
+ pl011_assign_bit(mctrl & TIOCM_DTR, &cr, UART011_CR_DTR);
+ pl011_assign_bit(mctrl & TIOCM_OUT1, &cr, UART011_CR_OUT1);
+ pl011_assign_bit(mctrl & TIOCM_OUT2, &cr, UART011_CR_OUT2);
+ pl011_assign_bit(mctrl & TIOCM_LOOP, &cr, UART011_CR_LBE);
if (port->status & UPSTAT_AUTORTS) {
/* We need to disable auto-RTS if we want to turn RTS off */
- TIOCMBIT(TIOCM_RTS, UART011_CR_RTSEN);
+ pl011_assign_bit(mctrl & TIOCM_RTS, &cr, UART011_CR_RTSEN);
}
-#undef TIOCMBIT
pl011_write(cr, uap, REG_CR);
}
--
2.43.0
The driver uses bit shifts and hexadecimal expressions to declare
constants. Replace that with the BIT(), GENMASK() & FIELD_PREP_CONST()
macros to clarify intent.
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Théo Lebrun <[email protected]>
---
include/linux/amba/serial.h | 248 +++++++++++++++++++++++---------------------
1 file changed, 127 insertions(+), 121 deletions(-)
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 27003ec52114..23ab7c4cc34f 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -10,6 +10,8 @@
#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H
#define ASM_ARM_HARDWARE_SERIAL_AMBA_H
+#include <linux/bitfield.h>
+#include <linux/bits.h>
#include <linux/types.h>
/* -------------------------------------------------------------------------------
@@ -70,138 +72,142 @@
#define ZX_UART011_ICR 0x4c
#define ZX_UART011_DMACR 0x50
-#define UART011_DR_OE (1 << 11)
-#define UART011_DR_BE (1 << 10)
-#define UART011_DR_PE (1 << 9)
-#define UART011_DR_FE (1 << 8)
-
-#define UART01x_RSR_OE 0x08
-#define UART01x_RSR_BE 0x04
-#define UART01x_RSR_PE 0x02
-#define UART01x_RSR_FE 0x01
-
-#define UART011_FR_RI 0x100
-#define UART011_FR_TXFE 0x080
-#define UART011_FR_RXFF 0x040
-#define UART01x_FR_TXFF 0x020
-#define UART01x_FR_RXFE 0x010
-#define UART01x_FR_BUSY 0x008
-#define UART01x_FR_DCD 0x004
-#define UART01x_FR_DSR 0x002
-#define UART01x_FR_CTS 0x001
+#define UART011_DR_OE BIT(11)
+#define UART011_DR_BE BIT(10)
+#define UART011_DR_PE BIT(9)
+#define UART011_DR_FE BIT(8)
+
+#define UART01x_RSR_OE BIT(3)
+#define UART01x_RSR_BE BIT(2)
+#define UART01x_RSR_PE BIT(1)
+#define UART01x_RSR_FE BIT(0)
+
+#define UART011_FR_RI BIT(8)
+#define UART011_FR_TXFE BIT(7)
+#define UART011_FR_RXFF BIT(6)
+#define UART01x_FR_TXFF BIT(5)
+#define UART01x_FR_RXFE BIT(4)
+#define UART01x_FR_BUSY BIT(3)
+#define UART01x_FR_DCD BIT(2)
+#define UART01x_FR_DSR BIT(1)
+#define UART01x_FR_CTS BIT(0)
#define UART01x_FR_TMSK (UART01x_FR_TXFF + UART01x_FR_BUSY)
/*
* Some bits of Flag Register on ZTE device have different position from
* standard ones.
*/
-#define ZX_UART01x_FR_BUSY 0x100
-#define ZX_UART01x_FR_DSR 0x008
-#define ZX_UART01x_FR_CTS 0x002
-#define ZX_UART011_FR_RI 0x001
-
-#define UART011_CR_CTSEN 0x8000 /* CTS hardware flow control */
-#define UART011_CR_RTSEN 0x4000 /* RTS hardware flow control */
-#define UART011_CR_OUT2 0x2000 /* OUT2 */
-#define UART011_CR_OUT1 0x1000 /* OUT1 */
-#define UART011_CR_RTS 0x0800 /* RTS */
-#define UART011_CR_DTR 0x0400 /* DTR */
-#define UART011_CR_RXE 0x0200 /* receive enable */
-#define UART011_CR_TXE 0x0100 /* transmit enable */
-#define UART011_CR_LBE 0x0080 /* loopback enable */
-#define UART010_CR_RTIE 0x0040
-#define UART010_CR_TIE 0x0020
-#define UART010_CR_RIE 0x0010
-#define UART010_CR_MSIE 0x0008
-#define ST_UART011_CR_OVSFACT 0x0008 /* Oversampling factor */
-#define UART01x_CR_IIRLP 0x0004 /* SIR low power mode */
-#define UART01x_CR_SIREN 0x0002 /* SIR enable */
-#define UART01x_CR_UARTEN 0x0001 /* UART enable */
-
-#define UART011_LCRH_SPS 0x80
+#define ZX_UART01x_FR_BUSY BIT(8)
+#define ZX_UART01x_FR_DSR BIT(3)
+#define ZX_UART01x_FR_CTS BIT(1)
+#define ZX_UART011_FR_RI BIT(0)
+
+#define UART011_CR_CTSEN BIT(15) /* CTS hardware flow control */
+#define UART011_CR_RTSEN BIT(14) /* RTS hardware flow control */
+#define UART011_CR_OUT2 BIT(13) /* OUT2 */
+#define UART011_CR_OUT1 BIT(12) /* OUT1 */
+#define UART011_CR_RTS BIT(11) /* RTS */
+#define UART011_CR_DTR BIT(10) /* DTR */
+#define UART011_CR_RXE BIT(9) /* receive enable */
+#define UART011_CR_TXE BIT(8) /* transmit enable */
+#define UART011_CR_LBE BIT(7) /* loopback enable */
+#define UART010_CR_RTIE BIT(6)
+#define UART010_CR_TIE BIT(5)
+#define UART010_CR_RIE BIT(4)
+#define UART010_CR_MSIE BIT(3)
+#define ST_UART011_CR_OVSFACT BIT(3) /* Oversampling factor */
+#define UART01x_CR_IIRLP BIT(2) /* SIR low power mode */
+#define UART01x_CR_SIREN BIT(1) /* SIR enable */
+#define UART01x_CR_UARTEN BIT(0) /* UART enable */
+
+#define UART011_LCRH_SPS BIT(7)
#define UART01x_LCRH_WLEN_8 0x60
#define UART01x_LCRH_WLEN_7 0x40
#define UART01x_LCRH_WLEN_6 0x20
#define UART01x_LCRH_WLEN_5 0x00
-#define UART01x_LCRH_FEN 0x10
-#define UART01x_LCRH_STP2 0x08
-#define UART01x_LCRH_EPS 0x04
-#define UART01x_LCRH_PEN 0x02
-#define UART01x_LCRH_BRK 0x01
-
-#define ST_UART011_DMAWM_RX_1 (0 << 3)
-#define ST_UART011_DMAWM_RX_2 (1 << 3)
-#define ST_UART011_DMAWM_RX_4 (2 << 3)
-#define ST_UART011_DMAWM_RX_8 (3 << 3)
-#define ST_UART011_DMAWM_RX_16 (4 << 3)
-#define ST_UART011_DMAWM_RX_32 (5 << 3)
-#define ST_UART011_DMAWM_RX_48 (6 << 3)
-#define ST_UART011_DMAWM_TX_1 0
-#define ST_UART011_DMAWM_TX_2 1
-#define ST_UART011_DMAWM_TX_4 2
-#define ST_UART011_DMAWM_TX_8 3
-#define ST_UART011_DMAWM_TX_16 4
-#define ST_UART011_DMAWM_TX_32 5
-#define ST_UART011_DMAWM_TX_48 6
-
-#define UART010_IIR_RTIS 0x08
-#define UART010_IIR_TIS 0x04
-#define UART010_IIR_RIS 0x02
-#define UART010_IIR_MIS 0x01
-
-#define UART011_IFLS_RX1_8 (0 << 3)
-#define UART011_IFLS_RX2_8 (1 << 3)
-#define UART011_IFLS_RX4_8 (2 << 3)
-#define UART011_IFLS_RX6_8 (3 << 3)
-#define UART011_IFLS_RX7_8 (4 << 3)
-#define UART011_IFLS_TX1_8 (0 << 0)
-#define UART011_IFLS_TX2_8 (1 << 0)
-#define UART011_IFLS_TX4_8 (2 << 0)
-#define UART011_IFLS_TX6_8 (3 << 0)
-#define UART011_IFLS_TX7_8 (4 << 0)
+#define UART01x_LCRH_FEN BIT(4)
+#define UART01x_LCRH_STP2 BIT(3)
+#define UART01x_LCRH_EPS BIT(2)
+#define UART01x_LCRH_PEN BIT(1)
+#define UART01x_LCRH_BRK BIT(0)
+
+#define ST_UART011_DMAWM_RX GENMASK(5, 3)
+#define ST_UART011_DMAWM_RX_1 FIELD_PREP_CONST(ST_UART011_DMAWM_RX, 0)
+#define ST_UART011_DMAWM_RX_2 FIELD_PREP_CONST(ST_UART011_DMAWM_RX, 1)
+#define ST_UART011_DMAWM_RX_4 FIELD_PREP_CONST(ST_UART011_DMAWM_RX, 2)
+#define ST_UART011_DMAWM_RX_8 FIELD_PREP_CONST(ST_UART011_DMAWM_RX, 3)
+#define ST_UART011_DMAWM_RX_16 FIELD_PREP_CONST(ST_UART011_DMAWM_RX, 4)
+#define ST_UART011_DMAWM_RX_32 FIELD_PREP_CONST(ST_UART011_DMAWM_RX, 5)
+#define ST_UART011_DMAWM_RX_48 FIELD_PREP_CONST(ST_UART011_DMAWM_RX, 6)
+#define ST_UART011_DMAWM_TX GENMASK(2, 0)
+#define ST_UART011_DMAWM_TX_1 FIELD_PREP_CONST(ST_UART011_DMAWM_TX, 0)
+#define ST_UART011_DMAWM_TX_2 FIELD_PREP_CONST(ST_UART011_DMAWM_TX, 1)
+#define ST_UART011_DMAWM_TX_4 FIELD_PREP_CONST(ST_UART011_DMAWM_TX, 2)
+#define ST_UART011_DMAWM_TX_8 FIELD_PREP_CONST(ST_UART011_DMAWM_TX, 3)
+#define ST_UART011_DMAWM_TX_16 FIELD_PREP_CONST(ST_UART011_DMAWM_TX, 4)
+#define ST_UART011_DMAWM_TX_32 FIELD_PREP_CONST(ST_UART011_DMAWM_TX, 5)
+#define ST_UART011_DMAWM_TX_48 FIELD_PREP_CONST(ST_UART011_DMAWM_TX, 6)
+
+#define UART010_IIR_RTIS BIT(3)
+#define UART010_IIR_TIS BIT(2)
+#define UART010_IIR_RIS BIT(1)
+#define UART010_IIR_MIS BIT(0)
+
+#define UART011_IFLS_RXIFLSEL GENMASK(5, 3)
+#define UART011_IFLS_RX1_8 FIELD_PREP_CONST(UART011_IFLS_RXIFLSEL, 0)
+#define UART011_IFLS_RX2_8 FIELD_PREP_CONST(UART011_IFLS_RXIFLSEL, 1)
+#define UART011_IFLS_RX4_8 FIELD_PREP_CONST(UART011_IFLS_RXIFLSEL, 2)
+#define UART011_IFLS_RX6_8 FIELD_PREP_CONST(UART011_IFLS_RXIFLSEL, 3)
+#define UART011_IFLS_RX7_8 FIELD_PREP_CONST(UART011_IFLS_RXIFLSEL, 4)
+#define UART011_IFLS_TXIFLSEL GENMASK(2, 0)
+#define UART011_IFLS_TX1_8 FIELD_PREP_CONST(UART011_IFLS_TXIFLSEL, 0)
+#define UART011_IFLS_TX2_8 FIELD_PREP_CONST(UART011_IFLS_TXIFLSEL, 1)
+#define UART011_IFLS_TX4_8 FIELD_PREP_CONST(UART011_IFLS_TXIFLSEL, 2)
+#define UART011_IFLS_TX6_8 FIELD_PREP_CONST(UART011_IFLS_TXIFLSEL, 3)
+#define UART011_IFLS_TX7_8 FIELD_PREP_CONST(UART011_IFLS_TXIFLSEL, 4)
/* special values for ST vendor with deeper fifo */
-#define UART011_IFLS_RX_HALF (5 << 3)
-#define UART011_IFLS_TX_HALF (5 << 0)
-
-#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */
-#define UART011_BEIM (1 << 9) /* break error interrupt mask */
-#define UART011_PEIM (1 << 8) /* parity error interrupt mask */
-#define UART011_FEIM (1 << 7) /* framing error interrupt mask */
-#define UART011_RTIM (1 << 6) /* receive timeout interrupt mask */
-#define UART011_TXIM (1 << 5) /* transmit interrupt mask */
-#define UART011_RXIM (1 << 4) /* receive interrupt mask */
-#define UART011_DSRMIM (1 << 3) /* DSR interrupt mask */
-#define UART011_DCDMIM (1 << 2) /* DCD interrupt mask */
-#define UART011_CTSMIM (1 << 1) /* CTS interrupt mask */
-#define UART011_RIMIM (1 << 0) /* RI interrupt mask */
-
-#define UART011_OEIS (1 << 10) /* overrun error interrupt status */
-#define UART011_BEIS (1 << 9) /* break error interrupt status */
-#define UART011_PEIS (1 << 8) /* parity error interrupt status */
-#define UART011_FEIS (1 << 7) /* framing error interrupt status */
-#define UART011_RTIS (1 << 6) /* receive timeout interrupt status */
-#define UART011_TXIS (1 << 5) /* transmit interrupt status */
-#define UART011_RXIS (1 << 4) /* receive interrupt status */
-#define UART011_DSRMIS (1 << 3) /* DSR interrupt status */
-#define UART011_DCDMIS (1 << 2) /* DCD interrupt status */
-#define UART011_CTSMIS (1 << 1) /* CTS interrupt status */
-#define UART011_RIMIS (1 << 0) /* RI interrupt status */
-
-#define UART011_OEIC (1 << 10) /* overrun error interrupt clear */
-#define UART011_BEIC (1 << 9) /* break error interrupt clear */
-#define UART011_PEIC (1 << 8) /* parity error interrupt clear */
-#define UART011_FEIC (1 << 7) /* framing error interrupt clear */
-#define UART011_RTIC (1 << 6) /* receive timeout interrupt clear */
-#define UART011_TXIC (1 << 5) /* transmit interrupt clear */
-#define UART011_RXIC (1 << 4) /* receive interrupt clear */
-#define UART011_DSRMIC (1 << 3) /* DSR interrupt clear */
-#define UART011_DCDMIC (1 << 2) /* DCD interrupt clear */
-#define UART011_CTSMIC (1 << 1) /* CTS interrupt clear */
-#define UART011_RIMIC (1 << 0) /* RI interrupt clear */
-
-#define UART011_DMAONERR (1 << 2) /* disable dma on error */
-#define UART011_TXDMAE (1 << 1) /* enable transmit dma */
-#define UART011_RXDMAE (1 << 0) /* enable receive dma */
+#define UART011_IFLS_RX_HALF FIELD_PREP_CONST(UART011_IFLS_RXIFLSEL, 5)
+#define UART011_IFLS_TX_HALF FIELD_PREP_CONST(UART011_IFLS_TXIFLSEL, 5)
+
+#define UART011_OEIM BIT(10) /* overrun error interrupt mask */
+#define UART011_BEIM BIT(9) /* break error interrupt mask */
+#define UART011_PEIM BIT(8) /* parity error interrupt mask */
+#define UART011_FEIM BIT(7) /* framing error interrupt mask */
+#define UART011_RTIM BIT(6) /* receive timeout interrupt mask */
+#define UART011_TXIM BIT(5) /* transmit interrupt mask */
+#define UART011_RXIM BIT(4) /* receive interrupt mask */
+#define UART011_DSRMIM BIT(3) /* DSR interrupt mask */
+#define UART011_DCDMIM BIT(2) /* DCD interrupt mask */
+#define UART011_CTSMIM BIT(1) /* CTS interrupt mask */
+#define UART011_RIMIM BIT(0) /* RI interrupt mask */
+
+#define UART011_OEIS BIT(10) /* overrun error interrupt status */
+#define UART011_BEIS BIT(9) /* break error interrupt status */
+#define UART011_PEIS BIT(8) /* parity error interrupt status */
+#define UART011_FEIS BIT(7) /* framing error interrupt status */
+#define UART011_RTIS BIT(6) /* receive timeout interrupt status */
+#define UART011_TXIS BIT(5) /* transmit interrupt status */
+#define UART011_RXIS BIT(4) /* receive interrupt status */
+#define UART011_DSRMIS BIT(3) /* DSR interrupt status */
+#define UART011_DCDMIS BIT(2) /* DCD interrupt status */
+#define UART011_CTSMIS BIT(1) /* CTS interrupt status */
+#define UART011_RIMIS BIT(0) /* RI interrupt status */
+
+#define UART011_OEIC BIT(10) /* overrun error interrupt clear */
+#define UART011_BEIC BIT(9) /* break error interrupt clear */
+#define UART011_PEIC BIT(8) /* parity error interrupt clear */
+#define UART011_FEIC BIT(7) /* framing error interrupt clear */
+#define UART011_RTIC BIT(6) /* receive timeout interrupt clear */
+#define UART011_TXIC BIT(5) /* transmit interrupt clear */
+#define UART011_RXIC BIT(4) /* receive interrupt clear */
+#define UART011_DSRMIC BIT(3) /* DSR interrupt clear */
+#define UART011_DCDMIC BIT(2) /* DCD interrupt clear */
+#define UART011_CTSMIC BIT(1) /* CTS interrupt clear */
+#define UART011_RIMIC BIT(0) /* RI interrupt clear */
+
+#define UART011_DMAONERR BIT(2) /* disable dma on error */
+#define UART011_TXDMAE BIT(1) /* enable transmit dma */
+#define UART011_RXDMAE BIT(0) /* enable receive dma */
#define UART01x_RSR_ANY (UART01x_RSR_OE | UART01x_RSR_BE | UART01x_RSR_PE | UART01x_RSR_FE)
#define UART01x_FR_MODEM_ANY (UART01x_FR_DCD | UART01x_FR_DSR | UART01x_FR_CTS)
--
2.43.0
Fix the following messages from checkpatch:
$ ./scripts/checkpatch.pl --strict --file \
drivers/tty/serial/amba-pl011.c
ERROR: do not initialise statics to false
WARNING: Possible unnecessary 'out of memory' message
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then
dev_info(dev, ... then pr_info(... to
CHECK: Prefer using the BIT macro
Signed-off-by: Théo Lebrun <[email protected]>
---
drivers/tty/serial/amba-pl011.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 3c657bac2359..d141af8f8a5f 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -51,7 +51,7 @@
#define AMBA_ISR_PASS_LIMIT 256
#define UART_DR_ERROR (UART011_DR_OE | UART011_DR_BE | UART011_DR_PE | UART011_DR_FE)
-#define UART_DUMMY_DR_RX (1 << 16)
+#define UART_DUMMY_DR_RX BIT(16)
enum {
REG_DR,
@@ -1109,7 +1109,6 @@ static void pl011_dma_startup(struct uart_amba_port *uap)
uap->dmatx.buf = kmalloc(PL011_DMA_BUFFER_SIZE, GFP_KERNEL | __GFP_DMA);
if (!uap->dmatx.buf) {
- dev_err(uap->port.dev, "no memory for DMA TX buffer\n");
uap->port.fifosize = uap->fifosize;
return;
}
@@ -2528,7 +2527,7 @@ static void qdf2400_e44_putc(struct uart_port *port, unsigned char c)
cpu_relax();
}
-static void qdf2400_e44_early_write(struct console *con, const char *s, unsigned n)
+static void qdf2400_e44_early_write(struct console *con, const char *s, unsigned int n)
{
struct earlycon_device *dev = con->data;
@@ -2547,7 +2546,7 @@ static void pl011_putc(struct uart_port *port, unsigned char c)
cpu_relax();
}
-static void pl011_early_write(struct console *con, const char *s, unsigned n)
+static void pl011_early_write(struct console *con, const char *s, unsigned int n)
{
struct earlycon_device *dev = con->data;
@@ -2653,8 +2652,8 @@ static struct uart_driver amba_reg = {
static int pl011_probe_dt_alias(int index, struct device *dev)
{
struct device_node *np;
- static bool seen_dev_with_alias = false;
- static bool seen_dev_without_alias = false;
+ static bool seen_dev_with_alias;
+ static bool seen_dev_without_alias;
int ret = index;
if (!IS_ENABLED(CONFIG_OF))
@@ -2996,7 +2995,7 @@ static struct amba_driver pl011_driver = {
static int __init pl011_init(void)
{
- printk(KERN_INFO "Serial: AMBA PL011 UART driver\n");
+ pr_info("Serial: AMBA PL011 UART driver\n");
if (platform_driver_register(&arm_sbsa_uart_platform_driver))
pr_warn("could not register SBSA UART platform driver\n");
--
2.43.0
Fix the following checkpatch warnings & checks:
$ ./scripts/checkpatch.pl --strict --file \
drivers/tty/serial/amba-pl011.c
CHECK: Unbalanced braces around else statement
CHECK: Unnecessary parentheses around '[...]'
CHECK: braces {} should be used on all arms of this statement
CHECK: Comparison to NULL could be written "[...]"
WARNING: Comparisons should place the constant on the right side of the test
Signed-off-by: Théo Lebrun <[email protected]>
---
drivers/tty/serial/amba-pl011.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index be8888db1a37..3c657bac2359 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -330,10 +330,11 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap)
uap->port.icount.brk++;
if (uart_handle_break(&uap->port))
continue;
- } else if (ch & UART011_DR_PE)
+ } else if (ch & UART011_DR_PE) {
uap->port.icount.parity++;
- else if (ch & UART011_DR_FE)
+ } else if (ch & UART011_DR_FE) {
uap->port.icount.frame++;
+ }
if (ch & UART011_DR_OE)
uap->port.icount.overrun++;
@@ -464,7 +465,7 @@ static void pl011_dma_probe(struct uart_amba_port *uap)
* If the controller does, check for suitable residue processing
* otherwise assime all is well.
*/
- if (0 == dma_get_slave_caps(chan, &caps)) {
+ if (dma_get_slave_caps(chan, &caps) == 0) {
if (caps.residue_granularity ==
DMA_RESIDUE_GRANULARITY_DESCRIPTOR) {
dma_release_channel(chan);
@@ -503,11 +504,11 @@ static void pl011_dma_probe(struct uart_amba_port *uap)
if (uap->dmarx.auto_poll_rate) {
u32 x;
- if (0 == of_property_read_u32(dev->of_node, "poll-rate-ms", &x))
+ if (of_property_read_u32(dev->of_node, "poll-rate-ms", &x) == 0)
uap->dmarx.poll_rate = x;
else
uap->dmarx.poll_rate = 100;
- if (0 == of_property_read_u32(dev->of_node, "poll-timeout-ms", &x))
+ if (of_property_read_u32(dev->of_node, "poll-timeout-ms", &x) == 0)
uap->dmarx.poll_timeout = x;
else
uap->dmarx.poll_timeout = 3000;
@@ -615,9 +616,9 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
if (count > PL011_DMA_BUFFER_SIZE)
count = PL011_DMA_BUFFER_SIZE;
- if (xmit->tail < xmit->head)
+ if (xmit->tail < xmit->head) {
memcpy(&dmatx->buf[0], &xmit->buf[xmit->tail], count);
- else {
+ } else {
size_t first = UART_XMIT_SIZE - xmit->tail;
size_t second;
@@ -751,8 +752,9 @@ static inline bool pl011_dma_tx_start(struct uart_amba_port *uap)
if (pl011_dma_tx_refill(uap) > 0) {
uap->im &= ~UART011_TXIM;
pl011_write(uap->im, uap, REG_IMSC);
- } else
+ } else {
ret = false;
+ }
} else if (!(uap->dmacr & UART011_TXDMAE)) {
uap->dmacr |= UART011_TXDMAE;
pl011_write(uap->dmacr, uap, REG_DMACR);
@@ -2139,9 +2141,9 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,
* else we see data corruption.
*/
if (uap->vendor->oversampling) {
- if ((baud >= 3000000) && (baud < 3250000) && (quot > 1))
+ if (baud >= 3000000 && baud < 3250000 && quot > 1)
quot -= 1;
- else if ((baud > 3250000) && (quot > 2))
+ else if (baud > 3250000 && quot > 2)
quot -= 2;
}
/* Set baud rate */
@@ -2668,7 +2670,7 @@ static int pl011_probe_dt_alias(int index, struct device *dev)
ret = index;
} else {
seen_dev_with_alias = true;
- if (ret >= ARRAY_SIZE(amba_ports) || amba_ports[ret] != NULL) {
+ if (ret >= ARRAY_SIZE(amba_ports) || amba_ports[ret]) {
dev_warn(dev, "requested serial port %d not available.\n", ret);
ret = index;
}
@@ -2702,7 +2704,7 @@ static int pl011_find_free_port(void)
int i;
for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
- if (amba_ports[i] == NULL)
+ if (!amba_ports[i])
return i;
return -EBUSY;
--
2.43.0
On Thu, 30 Nov 2023, Théo Lebrun wrote:
> Remove all instances of quoted strings split across lines. Fix four
> checkpatch warnings:
>
> $ ./scripts/checkpatch.pl --strict --file \
> drivers/tty/serial/amba-pl011.c
> WARNING: quoted string split across lines
> [...]
>
> Signed-off-by: Théo Lebrun <[email protected]>
Reviewed-by: Ilpo Järvinen <[email protected]>
--
i.
On Thu, Nov 30, 2023 at 3:07 PM Théo Lebrun <[email protected]> wrote:
> On this platform, different vendor data is used. That requires a
> compile-time check as we access (1) a global boolean & (2) our local
> vendor data. Both symbols are accessible only when
> CONFIG_ACPI_SPCR_TABLE is enabled.
>
> Factor the vendor data overriding to a separate function that is empty
> when CONFIG_ACPI_SPCR_TABLE is not defined.
>
> Suggested-by: Ilpo Järvinen <[email protected]>
> Signed-off-by: Théo Lebrun <[email protected]>
Neat.
Reviewed-by: Linus Walleij <[email protected]>
Yours,
Linus Walleij
On Thu, Nov 30, 2023 at 3:07 PM Théo Lebrun <[email protected]> wrote:
> Remove all instances of quoted strings split across lines. Fix four
> checkpatch warnings:
>
> $ ./scripts/checkpatch.pl --strict --file \
> drivers/tty/serial/amba-pl011.c
> WARNING: quoted string split across lines
> [...]
>
> Signed-off-by: Théo Lebrun <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Yours,
Linus Walleij
On Thu, Nov 30, 2023 at 3:07 PM Théo Lebrun <[email protected]> wrote:
> Fix the following checkpatch warnings & checks:
>
> $ ./scripts/checkpatch.pl --strict --file \
> drivers/tty/serial/amba-pl011.c
>
> CHECK: Unbalanced braces around else statement
> CHECK: Unnecessary parentheses around '[...]'
> CHECK: braces {} should be used on all arms of this statement
> CHECK: Comparison to NULL could be written "[...]"
> WARNING: Comparisons should place the constant on the right side of the test
>
> Signed-off-by: Théo Lebrun <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Yours,
Linus Walleij
On Thu, Nov 30, 2023 at 3:07 PM Théo Lebrun <[email protected]> wrote:
> Fix the following messages from checkpatch:
>
> $ ./scripts/checkpatch.pl --strict --file \
> drivers/tty/serial/amba-pl011.c
>
> ERROR: do not initialise statics to false
> WARNING: Possible unnecessary 'out of memory' message
> WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
> WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then
> dev_info(dev, ... then pr_info(... to
> CHECK: Prefer using the BIT macro
>
> Signed-off-by: Théo Lebrun <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Yours,
Linus Walleij
Hi Th?o,
kernel test robot noticed the following build errors:
[auto build test ERROR on tty/tty-linus]
[also build test ERROR on usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.7-rc4 next-20231205]
[cannot apply to tty/tty-testing tty/tty-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Th-o-Lebrun/tty-serial-amba-Use-linux-bits-bitfield-h-macros/20231130-230738
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-linus
patch link: https://lore.kernel.org/r/20231130-mbly-uart-v5-2-6566703a04b5%40bootlin.com
patch subject: [PATCH v5 2/9] tty: serial: amba: Use linux/{bits,bitfield}.h macros
config: arm-ep93xx_defconfig (https://download.01.org/0day-ci/archive/20231206/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231206/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
include/linux/stddef.h: Assembler messages:
>> include/linux/stddef.h:10: Error: bad instruction `enum {'
>> include/linux/stddef.h:11: Error: junk at end of line, first unrecognized character is `,'
include/linux/stddef.h:13: Error: junk at end of line, first unrecognized character is `}'
>> arch/arm/include/uapi/asm/swab.h:28: Error: bad instruction `static inline __attribute_const__ __u32 __arch_swab32(__u32 x)'
>> arch/arm/include/uapi/asm/swab.h:29: Error: junk at end of line, first unrecognized character is `{'
>> arch/arm/include/uapi/asm/swab.h:30: Error: bad instruction `__u32 t'
>> arch/arm/include/uapi/asm/swab.h:33: Error: bad instruction `if (!__builtin_constant_p(x)){'
>> arch/arm/include/uapi/asm/swab.h:39: Error: bad instruction `asm ("eor\t%0, %1, %1, ror #16":"=r"(t):"r"(x))'
arch/arm/include/uapi/asm/swab.h:40: Error: junk at end of line, first unrecognized character is `}'
>> arch/arm/include/uapi/asm/swab.h:45: Error: bad instruction `t &=~0x00FF0000'
>> arch/arm/include/uapi/asm/swab.h:46: Error: bad instruction `x ^=(t>>8)'
>> arch/arm/include/uapi/asm/swab.h:48: Error: bad instruction `return x'
arch/arm/include/uapi/asm/swab.h:49: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/swab.h:48: Error: bad instruction `static inline __attribute_const__ __u16 __fswab16(__u16 val)'
>> include/uapi/linux/swab.h:49: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/swab.h:53: Error: bad instruction `return ((__u16)((((__u16)(val)&(__u16)0x00ffU)<<8)|(((__u16)(val)&(__u16)0xff00U)>>8)))'
include/uapi/linux/swab.h:55: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/swab.h:57: Error: bad instruction `static inline __attribute_const__ __u32 __fswab32(__u32 val)'
include/uapi/linux/swab.h:58: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/swab.h:60: Error: bad instruction `return __arch_swab32(val)'
include/uapi/linux/swab.h:64: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/swab.h:66: Error: bad instruction `static inline __attribute_const__ __u64 __fswab64(__u64 val)'
include/uapi/linux/swab.h:67: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/swab.h:71: Error: bad instruction `__u32 h=val>>32'
>> include/uapi/linux/swab.h:72: Error: bad instruction `__u32 l=val&((1ULL<<32)-1)'
>> include/uapi/linux/swab.h:73: Error: bad instruction `return (((__u64)__fswab32(l))<<32)|((__u64)(__fswab32(h)))'
include/uapi/linux/swab.h:77: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/swab.h:79: Error: bad instruction `static inline __attribute_const__ __u32 __fswahw32(__u32 val)'
include/uapi/linux/swab.h:80: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:84: Error: bad instruction `return ((__u32)((((__u32)(val)&(__u32)0x0000ffffUL)<<16)|(((__u32)(val)&(__u32)0xffff0000UL)>>16)))'
include/uapi/linux/swab.h:86: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:88: Error: bad instruction `static inline __attribute_const__ __u32 __fswahb32(__u32 val)'
include/uapi/linux/swab.h:89: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:93: Error: bad instruction `return ((__u32)((((__u32)(val)&(__u32)0x00ff00ffUL)<<8)|(((__u32)(val)&(__u32)0xff00ff00UL)>>8)))'
include/uapi/linux/swab.h:95: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:136: Error: bad instruction `static inline unsigned long __swab(const unsigned long y)'
include/uapi/linux/swab.h:137: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:141: Error: bad instruction `return (__u32)(__builtin_constant_p(y)?((__u32)((((__u32)(y)&(__u32)0x000000ffUL)<<24)|(((__u32)(y)&(__u32)0x0000ff00UL)<<8)|(((__u32)(y)&(__u32)0x00ff0000UL)>>8)|(((__u32)(y)&(__u32)0xff000000UL)>>24))):__fswab32(y))'
include/uapi/linux/swab.h:143: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:171: Error: bad instruction `static inline __u16 __swab16p(const __u16*p)'
include/uapi/linux/swab.h:172: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:176: Error: bad instruction `return (__u16)(__builtin_constant_p(*p)?((__u16)((((__u16)(*p)&(__u16)0x00ffU)<<8)|(((__u16)(*p)&(__u16)0xff00U)>>8))):__fswab16(*p))'
include/uapi/linux/swab.h:178: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:184: Error: bad instruction `static inline __u32 __swab32p(const __u32*p)'
include/uapi/linux/swab.h:185: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:189: Error: bad instruction `return (__u32)(__builtin_constant_p(*p)?((__u32)((((__u32)(*p)&(__u32)0x000000ffUL)<<24)|(((__u32)(*p)&(__u32)0x0000ff00UL)<<8)|(((__u32)(*p)&(__u32)0x00ff0000UL)>>8)|(((__u32)(*p)&(__u32)0xff000000UL)>>24))):__fswab32(*p))'
include/uapi/linux/swab.h:191: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:197: Error: bad instruction `static inline __u64 __swab64p(const __u64*p)'
include/uapi/linux/swab.h:198: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:202: Error: bad instruction `return (__u64)(__builtin_constant_p(*p)?((__u64)((((__u64)(*p)&(__u64)0x00000000000000ffULL)<<56)|(((__u64)(*p)&(__u64)0x000000000000ff00ULL)<<40)|(((__u64)(*p)&(__u64)0x0000000000ff0000ULL)<<24)|(((__u64)(*p)&(__u64)0x00000000ff000000ULL)<<8)|(((__u64)(*p)&(__u64)0x000000ff00000000ULL)>>8)|(((__u64)(*p)&(__u64)0x0000ff0000000000ULL)>>24)|(((__u64)(*p)&(__u64)0x00ff000000000000ULL)>>40)|(((__u64)(*p)&(__u64)0xff00000000000000ULL)>>56))):__fswab64(*p))'
include/uapi/linux/swab.h:204: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:212: Error: bad instruction `static inline __u32 __swahw32p(const __u32*p)'
include/uapi/linux/swab.h:213: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:217: Error: bad instruction `return (__builtin_constant_p((__u32)(*p))?((__u32)((((__u32)(*p)&(__u32)0x0000ffffUL)<<16)|(((__u32)(*p)&(__u32)0xffff0000UL)>>16))):__fswahw32(*p))'
include/uapi/linux/swab.h:219: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:227: Error: bad instruction `static inline __u32 __swahb32p(const __u32*p)'
include/uapi/linux/swab.h:228: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:232: Error: bad instruction `return (__builtin_constant_p((__u32)(*p))?((__u32)((((__u32)(*p)&(__u32)0x00ff00ffUL)<<8)|(((__u32)(*p)&(__u32)0xff00ff00UL)>>8))):__fswahb32(*p))'
include/uapi/linux/swab.h:234: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:240: Error: bad instruction `static inline void __swab16s(__u16*p)'
include/uapi/linux/swab.h:241: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:245: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:247: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:252: Error: bad instruction `static inline void __swab32s(__u32*p)'
include/uapi/linux/swab.h:253: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:257: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:259: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:265: Error: bad instruction `static inline void __swab64s(__u64*p)'
include/uapi/linux/swab.h:266: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:270: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:272: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:280: Error: bad instruction `static inline void __swahw32s(__u32*p)'
include/uapi/linux/swab.h:281: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:285: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:287: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:295: Error: bad instruction `static inline void __swahb32s(__u32*p)'
include/uapi/linux/swab.h:296: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:300: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:302: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:24: Error: bad instruction `static inline void swab16_array(u16*buf,unsigned int words)'
include/linux/swab.h:25: Error: junk at end of line, first unrecognized character is `{'
include/linux/swab.h:26: Error: bad instruction `while (words--){'
include/linux/swab.h:27: Error: bad instruction `__swab16s(buf)'
include/linux/swab.h:28: Error: bad instruction `buf++'
include/linux/swab.h:29: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:30: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:32: Error: bad instruction `static inline void swab32_array(u32*buf,unsigned int words)'
include/linux/swab.h:33: Error: junk at end of line, first unrecognized character is `{'
include/linux/swab.h:34: Error: bad instruction `while (words--){'
include/linux/swab.h:35: Error: bad instruction `__swab32s(buf)'
include/linux/swab.h:36: Error: bad instruction `buf++'
include/linux/swab.h:37: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:38: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:40: Error: bad instruction `static inline void swab64_array(u64*buf,unsigned int words)'
include/linux/swab.h:41: Error: junk at end of line, first unrecognized character is `{'
include/linux/swab.h:42: Error: bad instruction `while (words--){'
include/linux/swab.h:43: Error: bad instruction `__swab64s(buf)'
include/linux/swab.h:44: Error: bad instruction `buf++'
include/linux/swab.h:45: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:46: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:45: Error: bad instruction `static inline __le64 __cpu_to_le64p(const __u64*p)'
include/uapi/linux/byteorder/little_endian.h:46: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:47: Error: bad instruction `return (__force __le64)*p'
include/uapi/linux/byteorder/little_endian.h:48: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:49: Error: bad instruction `static inline __u64 __le64_to_cpup(const __le64*p)'
include/uapi/linux/byteorder/little_endian.h:50: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:51: Error: bad instruction `return (__force __u64)*p'
include/uapi/linux/byteorder/little_endian.h:52: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:53: Error: bad instruction `static inline __le32 __cpu_to_le32p(const __u32*p)'
include/uapi/linux/byteorder/little_endian.h:54: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:55: Error: bad instruction `return (__force __le32)*p'
include/uapi/linux/byteorder/little_endian.h:56: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:57: Error: bad instruction `static inline __u32 __le32_to_cpup(const __le32*p)'
include/uapi/linux/byteorder/little_endian.h:58: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:59: Error: bad instruction `return (__force __u32)*p'
include/uapi/linux/byteorder/little_endian.h:60: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:61: Error: bad instruction `static inline __le16 __cpu_to_le16p(const __u16*p)'
include/uapi/linux/byteorder/little_endian.h:62: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:63: Error: bad instruction `return (__force __le16)*p'
include/uapi/linux/byteorder/little_endian.h:64: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:65: Error: bad instruction `static inline __u16 __le16_to_cpup(const __le16*p)'
include/uapi/linux/byteorder/little_endian.h:66: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:67: Error: bad instruction `return (__force __u16)*p'
include/uapi/linux/byteorder/little_endian.h:68: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:69: Error: bad instruction `static inline __be64 __cpu_to_be64p(const __u64*p)'
include/uapi/linux/byteorder/little_endian.h:70: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:71: Error: bad instruction `return (__force __be64)__swab64p(p)'
include/uapi/linux/byteorder/little_endian.h:72: Error: junk at end of line, first unrecognized character is `}'
--
include/linux/stddef.h: Assembler messages:
>> include/linux/stddef.h:10: Error: bad instruction `enum {'
>> include/linux/stddef.h:11: Error: junk at end of line, first unrecognized character is `,'
include/linux/stddef.h:13: Error: junk at end of line, first unrecognized character is `}'
>> arch/arm/include/uapi/asm/swab.h:28: Error: bad instruction `static inline __attribute_const__ __u32 __arch_swab32(__u32 x)'
>> arch/arm/include/uapi/asm/swab.h:29: Error: junk at end of line, first unrecognized character is `{'
>> arch/arm/include/uapi/asm/swab.h:30: Error: bad instruction `__u32 t'
>> arch/arm/include/uapi/asm/swab.h:33: Error: bad instruction `if (!__builtin_constant_p(x)){'
>> arch/arm/include/uapi/asm/swab.h:39: Error: bad instruction `asm ("eor\t%0, %1, %1, ror #16":"=r"(t):"r"(x))'
arch/arm/include/uapi/asm/swab.h:40: Error: junk at end of line, first unrecognized character is `}'
>> arch/arm/include/uapi/asm/swab.h:45: Error: bad instruction `t &=~0x00FF0000'
>> arch/arm/include/uapi/asm/swab.h:46: Error: bad instruction `x ^=(t>>8)'
>> arch/arm/include/uapi/asm/swab.h:48: Error: bad instruction `return x'
arch/arm/include/uapi/asm/swab.h:49: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/swab.h:48: Error: bad instruction `static inline __attribute_const__ __u16 __fswab16(__u16 val)'
>> include/uapi/linux/swab.h:49: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/swab.h:53: Error: bad instruction `return ((__u16)((((__u16)(val)&(__u16)0x00ffU)<<8)|(((__u16)(val)&(__u16)0xff00U)>>8)))'
include/uapi/linux/swab.h:55: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/swab.h:57: Error: bad instruction `static inline __attribute_const__ __u32 __fswab32(__u32 val)'
include/uapi/linux/swab.h:58: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/swab.h:60: Error: bad instruction `return __arch_swab32(val)'
include/uapi/linux/swab.h:64: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/swab.h:66: Error: bad instruction `static inline __attribute_const__ __u64 __fswab64(__u64 val)'
include/uapi/linux/swab.h:67: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/swab.h:71: Error: bad instruction `__u32 h=val>>32'
>> include/uapi/linux/swab.h:72: Error: bad instruction `__u32 l=val&((1ULL<<32)-1)'
>> include/uapi/linux/swab.h:73: Error: bad instruction `return (((__u64)__fswab32(l))<<32)|((__u64)(__fswab32(h)))'
include/uapi/linux/swab.h:77: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/swab.h:79: Error: bad instruction `static inline __attribute_const__ __u32 __fswahw32(__u32 val)'
include/uapi/linux/swab.h:80: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:84: Error: bad instruction `return ((__u32)((((__u32)(val)&(__u32)0x0000ffffUL)<<16)|(((__u32)(val)&(__u32)0xffff0000UL)>>16)))'
include/uapi/linux/swab.h:86: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:88: Error: bad instruction `static inline __attribute_const__ __u32 __fswahb32(__u32 val)'
include/uapi/linux/swab.h:89: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:93: Error: bad instruction `return ((__u32)((((__u32)(val)&(__u32)0x00ff00ffUL)<<8)|(((__u32)(val)&(__u32)0xff00ff00UL)>>8)))'
include/uapi/linux/swab.h:95: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:136: Error: bad instruction `static inline unsigned long __swab(const unsigned long y)'
include/uapi/linux/swab.h:137: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:141: Error: bad instruction `return (__u32)(__builtin_constant_p(y)?((__u32)((((__u32)(y)&(__u32)0x000000ffUL)<<24)|(((__u32)(y)&(__u32)0x0000ff00UL)<<8)|(((__u32)(y)&(__u32)0x00ff0000UL)>>8)|(((__u32)(y)&(__u32)0xff000000UL)>>24))):__fswab32(y))'
include/uapi/linux/swab.h:143: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:171: Error: bad instruction `static inline __u16 __swab16p(const __u16*p)'
include/uapi/linux/swab.h:172: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:176: Error: bad instruction `return (__u16)(__builtin_constant_p(*p)?((__u16)((((__u16)(*p)&(__u16)0x00ffU)<<8)|(((__u16)(*p)&(__u16)0xff00U)>>8))):__fswab16(*p))'
include/uapi/linux/swab.h:178: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:184: Error: bad instruction `static inline __u32 __swab32p(const __u32*p)'
include/uapi/linux/swab.h:185: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:189: Error: bad instruction `return (__u32)(__builtin_constant_p(*p)?((__u32)((((__u32)(*p)&(__u32)0x000000ffUL)<<24)|(((__u32)(*p)&(__u32)0x0000ff00UL)<<8)|(((__u32)(*p)&(__u32)0x00ff0000UL)>>8)|(((__u32)(*p)&(__u32)0xff000000UL)>>24))):__fswab32(*p))'
include/uapi/linux/swab.h:191: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:197: Error: bad instruction `static inline __u64 __swab64p(const __u64*p)'
include/uapi/linux/swab.h:198: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:202: Error: bad instruction `return (__u64)(__builtin_constant_p(*p)?((__u64)((((__u64)(*p)&(__u64)0x00000000000000ffULL)<<56)|(((__u64)(*p)&(__u64)0x000000000000ff00ULL)<<40)|(((__u64)(*p)&(__u64)0x0000000000ff0000ULL)<<24)|(((__u64)(*p)&(__u64)0x00000000ff000000ULL)<<8)|(((__u64)(*p)&(__u64)0x000000ff00000000ULL)>>8)|(((__u64)(*p)&(__u64)0x0000ff0000000000ULL)>>24)|(((__u64)(*p)&(__u64)0x00ff000000000000ULL)>>40)|(((__u64)(*p)&(__u64)0xff00000000000000ULL)>>56))):__fswab64(*p))'
include/uapi/linux/swab.h:204: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:212: Error: bad instruction `static inline __u32 __swahw32p(const __u32*p)'
include/uapi/linux/swab.h:213: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:217: Error: bad instruction `return (__builtin_constant_p((__u32)(*p))?((__u32)((((__u32)(*p)&(__u32)0x0000ffffUL)<<16)|(((__u32)(*p)&(__u32)0xffff0000UL)>>16))):__fswahw32(*p))'
include/uapi/linux/swab.h:219: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:227: Error: bad instruction `static inline __u32 __swahb32p(const __u32*p)'
include/uapi/linux/swab.h:228: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:232: Error: bad instruction `return (__builtin_constant_p((__u32)(*p))?((__u32)((((__u32)(*p)&(__u32)0x00ff00ffUL)<<8)|(((__u32)(*p)&(__u32)0xff00ff00UL)>>8))):__fswahb32(*p))'
include/uapi/linux/swab.h:234: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:240: Error: bad instruction `static inline void __swab16s(__u16*p)'
include/uapi/linux/swab.h:241: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:245: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:247: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:252: Error: bad instruction `static inline void __swab32s(__u32*p)'
include/uapi/linux/swab.h:253: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:257: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:259: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:265: Error: bad instruction `static inline void __swab64s(__u64*p)'
include/uapi/linux/swab.h:266: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:270: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:272: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:280: Error: bad instruction `static inline void __swahw32s(__u32*p)'
include/uapi/linux/swab.h:281: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:285: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:287: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:295: Error: bad instruction `static inline void __swahb32s(__u32*p)'
include/uapi/linux/swab.h:296: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:300: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:302: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:24: Error: bad instruction `static inline void swab16_array(u16*buf,unsigned int words)'
include/linux/swab.h:25: Error: junk at end of line, first unrecognized character is `{'
include/linux/swab.h:26: Error: bad instruction `while (words--){'
include/linux/swab.h:27: Error: bad instruction `__swab16s(buf)'
include/linux/swab.h:28: Error: bad instruction `buf++'
include/linux/swab.h:29: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:30: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:32: Error: bad instruction `static inline void swab32_array(u32*buf,unsigned int words)'
include/linux/swab.h:33: Error: junk at end of line, first unrecognized character is `{'
include/linux/swab.h:34: Error: bad instruction `while (words--){'
include/linux/swab.h:35: Error: bad instruction `__swab32s(buf)'
include/linux/swab.h:36: Error: bad instruction `buf++'
include/linux/swab.h:37: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:38: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:40: Error: bad instruction `static inline void swab64_array(u64*buf,unsigned int words)'
include/linux/swab.h:41: Error: junk at end of line, first unrecognized character is `{'
include/linux/swab.h:42: Error: bad instruction `while (words--){'
include/linux/swab.h:43: Error: bad instruction `__swab64s(buf)'
include/linux/swab.h:44: Error: bad instruction `buf++'
include/linux/swab.h:45: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:46: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:45: Error: bad instruction `static inline __le64 __cpu_to_le64p(const __u64*p)'
include/uapi/linux/byteorder/little_endian.h:46: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:47: Error: bad instruction `return (__force __le64)*p'
include/uapi/linux/byteorder/little_endian.h:48: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:49: Error: bad instruction `static inline __u64 __le64_to_cpup(const __le64*p)'
include/uapi/linux/byteorder/little_endian.h:50: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:51: Error: bad instruction `return (__force __u64)*p'
include/uapi/linux/byteorder/little_endian.h:52: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:53: Error: bad instruction `static inline __le32 __cpu_to_le32p(const __u32*p)'
include/uapi/linux/byteorder/little_endian.h:54: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:55: Error: bad instruction `return (__force __le32)*p'
include/uapi/linux/byteorder/little_endian.h:56: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:57: Error: bad instruction `static inline __u32 __le32_to_cpup(const __le32*p)'
include/uapi/linux/byteorder/little_endian.h:58: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:59: Error: bad instruction `return (__force __u32)*p'
include/uapi/linux/byteorder/little_endian.h:60: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:61: Error: bad instruction `static inline __le16 __cpu_to_le16p(const __u16*p)'
include/uapi/linux/byteorder/little_endian.h:62: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:63: Error: bad instruction `return (__force __le16)*p'
include/uapi/linux/byteorder/little_endian.h:64: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:65: Error: bad instruction `static inline __u16 __le16_to_cpup(const __le16*p)'
include/uapi/linux/byteorder/little_endian.h:66: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:67: Error: bad instruction `return (__force __u16)*p'
include/uapi/linux/byteorder/little_endian.h:68: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/little_endian.h:69: Error: bad instruction `static inline __be64 __cpu_to_be64p(const __u64*p)'
include/uapi/linux/byteorder/little_endian.h:70: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/little_endian.h:71: Error: bad instruction `return (__force __be64)__swab64p(p)'
include/uapi/linux/byteorder/little_endian.h:72: Error: junk at end of line, first unrecognized character is `}'
vim +158 include/linux/bitfield.h
e2192de59e457a Johannes Berg 2023-01-18 119
e2192de59e457a Johannes Berg 2023-01-18 120 /**
e2192de59e457a Johannes Berg 2023-01-18 121 * FIELD_PREP_CONST() - prepare a constant bitfield element
e2192de59e457a Johannes Berg 2023-01-18 122 * @_mask: shifted mask defining the field's length and position
e2192de59e457a Johannes Berg 2023-01-18 123 * @_val: value to put in the field
e2192de59e457a Johannes Berg 2023-01-18 124 *
e2192de59e457a Johannes Berg 2023-01-18 125 * FIELD_PREP_CONST() masks and shifts up the value. The result should
e2192de59e457a Johannes Berg 2023-01-18 126 * be combined with other fields of the bitfield using logical OR.
e2192de59e457a Johannes Berg 2023-01-18 127 *
e2192de59e457a Johannes Berg 2023-01-18 128 * Unlike FIELD_PREP() this is a constant expression and can therefore
e2192de59e457a Johannes Berg 2023-01-18 129 * be used in initializers. Error checking is less comfortable for this
e2192de59e457a Johannes Berg 2023-01-18 130 * version, and non-constant masks cannot be used.
e2192de59e457a Johannes Berg 2023-01-18 131 */
e2192de59e457a Johannes Berg 2023-01-18 132 #define FIELD_PREP_CONST(_mask, _val) \
e2192de59e457a Johannes Berg 2023-01-18 133 ( \
e2192de59e457a Johannes Berg 2023-01-18 134 /* mask must be non-zero */ \
e2192de59e457a Johannes Berg 2023-01-18 135 BUILD_BUG_ON_ZERO((_mask) == 0) + \
e2192de59e457a Johannes Berg 2023-01-18 136 /* check if value fits */ \
e2192de59e457a Johannes Berg 2023-01-18 137 BUILD_BUG_ON_ZERO(~((_mask) >> __bf_shf(_mask)) & (_val)) + \
e2192de59e457a Johannes Berg 2023-01-18 138 /* check if mask is contiguous */ \
e2192de59e457a Johannes Berg 2023-01-18 139 __BF_CHECK_POW2((_mask) + (1ULL << __bf_shf(_mask))) + \
e2192de59e457a Johannes Berg 2023-01-18 140 /* and create the value */ \
e2192de59e457a Johannes Berg 2023-01-18 141 (((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask)) \
e2192de59e457a Johannes Berg 2023-01-18 142 )
e2192de59e457a Johannes Berg 2023-01-18 143
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 144 /**
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 145 * FIELD_GET() - extract a bitfield element
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 146 * @_mask: shifted mask defining the field's length and position
7240767450d6d8 Masahiro Yamada 2017-10-03 147 * @_reg: value of entire bitfield
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 148 *
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 149 * FIELD_GET() extracts the field specified by @_mask from the
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 150 * bitfield passed in as @_reg by masking and shifting it down.
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 151 */
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 152 #define FIELD_GET(_mask, _reg) \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 153 ({ \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 154 __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 155 (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 156 })
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 157
e7d4a95da86e0b Johannes Berg 2018-06-20 @158 extern void __compiletime_error("value doesn't fit into mask")
00b0c9b82663ac Al Viro 2017-12-14 @159 __field_overflow(void);
00b0c9b82663ac Al Viro 2017-12-14 @160 extern void __compiletime_error("bad bitfield mask")
00b0c9b82663ac Al Viro 2017-12-14 @161 __bad_mask(void);
00b0c9b82663ac Al Viro 2017-12-14 @162 static __always_inline u64 field_multiplier(u64 field)
00b0c9b82663ac Al Viro 2017-12-14 @163 {
00b0c9b82663ac Al Viro 2017-12-14 @164 if ((field | (field - 1)) & ((field | (field - 1)) + 1))
00b0c9b82663ac Al Viro 2017-12-14 @165 __bad_mask();
00b0c9b82663ac Al Viro 2017-12-14 @166 return field & -field;
00b0c9b82663ac Al Viro 2017-12-14 167 }
00b0c9b82663ac Al Viro 2017-12-14 @168 static __always_inline u64 field_mask(u64 field)
00b0c9b82663ac Al Viro 2017-12-14 169 {
00b0c9b82663ac Al Viro 2017-12-14 @170 return field / field_multiplier(field);
00b0c9b82663ac Al Viro 2017-12-14 171 }
e31a50162feb35 Alex Elder 2020-03-12 172 #define field_max(field) ((typeof(field))field_mask(field))
00b0c9b82663ac Al Viro 2017-12-14 173 #define ____MAKE_OP(type,base,to,from) \
00b0c9b82663ac Al Viro 2017-12-14 174 static __always_inline __##type type##_encode_bits(base v, base field) \
00b0c9b82663ac Al Viro 2017-12-14 175 { \
e7d4a95da86e0b Johannes Berg 2018-06-20 176 if (__builtin_constant_p(v) && (v & ~field_mask(field))) \
00b0c9b82663ac Al Viro 2017-12-14 177 __field_overflow(); \
00b0c9b82663ac Al Viro 2017-12-14 178 return to((v & field_mask(field)) * field_multiplier(field)); \
00b0c9b82663ac Al Viro 2017-12-14 179 } \
00b0c9b82663ac Al Viro 2017-12-14 180 static __always_inline __##type type##_replace_bits(__##type old, \
00b0c9b82663ac Al Viro 2017-12-14 181 base val, base field) \
00b0c9b82663ac Al Viro 2017-12-14 182 { \
00b0c9b82663ac Al Viro 2017-12-14 183 return (old & ~to(field)) | type##_encode_bits(val, field); \
00b0c9b82663ac Al Viro 2017-12-14 184 } \
00b0c9b82663ac Al Viro 2017-12-14 185 static __always_inline void type##p_replace_bits(__##type *p, \
00b0c9b82663ac Al Viro 2017-12-14 186 base val, base field) \
00b0c9b82663ac Al Viro 2017-12-14 187 { \
00b0c9b82663ac Al Viro 2017-12-14 188 *p = (*p & ~to(field)) | type##_encode_bits(val, field); \
00b0c9b82663ac Al Viro 2017-12-14 189 } \
00b0c9b82663ac Al Viro 2017-12-14 190 static __always_inline base type##_get_bits(__##type v, base field) \
00b0c9b82663ac Al Viro 2017-12-14 191 { \
00b0c9b82663ac Al Viro 2017-12-14 192 return (from(v) & field)/field_multiplier(field); \
00b0c9b82663ac Al Viro 2017-12-14 193 }
00b0c9b82663ac Al Viro 2017-12-14 194 #define __MAKE_OP(size) \
00b0c9b82663ac Al Viro 2017-12-14 195 ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
00b0c9b82663ac Al Viro 2017-12-14 196 ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
00b0c9b82663ac Al Viro 2017-12-14 197 ____MAKE_OP(u##size,u##size,,)
37a3862e123826 Johannes Berg 2018-06-20 @198 ____MAKE_OP(u8,u8,,)
00b0c9b82663ac Al Viro 2017-12-14 @199 __MAKE_OP(16)
00b0c9b82663ac Al Viro 2017-12-14 @200 __MAKE_OP(32)
00b0c9b82663ac Al Viro 2017-12-14 @201 __MAKE_OP(64)
00b0c9b82663ac Al Viro 2017-12-14 202 #undef __MAKE_OP
00b0c9b82663ac Al Viro 2017-12-14 203 #undef ____MAKE_OP
00b0c9b82663ac Al Viro 2017-12-14 204
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
On Thu, Nov 30, 2023 at 03:07:14PM +0100, Th?o Lebrun wrote:
> The driver uses bit shifts and hexadecimal expressions to declare
> constants. Replace that with the BIT(), GENMASK() & FIELD_PREP_CONST()
> macros to clarify intent.
>
> Reviewed-by: Linus Walleij <[email protected]>
> Reviewed-by: Ilpo J?rvinen <[email protected]>
> Signed-off-by: Th?o Lebrun <[email protected]>
> ---
> include/linux/amba/serial.h | 248 +++++++++++++++++++++++---------------------
> 1 file changed, 127 insertions(+), 121 deletions(-)
As 0-day had a problem with this patch, I've applied only patch 1 of
this series. Can you fix it up and rebase and resend the rest again
(while adding the collected reviewed-by that some patches in this series
had)?
thanks,
greg k-h
Hello,
On Thu Dec 7, 2023 at 2:37 AM CET, Greg Kroah-Hartman wrote:
> On Thu, Nov 30, 2023 at 03:07:14PM +0100, Théo Lebrun wrote:
> > The driver uses bit shifts and hexadecimal expressions to declare
> > constants. Replace that with the BIT(), GENMASK() & FIELD_PREP_CONST()
> > macros to clarify intent.
> >
> > Reviewed-by: Linus Walleij <[email protected]>
> > Reviewed-by: Ilpo Järvinen <[email protected]>
> > Signed-off-by: Théo Lebrun <[email protected]>
> > ---
> > include/linux/amba/serial.h | 248 +++++++++++++++++++++++---------------------
> > 1 file changed, 127 insertions(+), 121 deletions(-)
>
> As 0-day had a problem with this patch, I've applied only patch 1 of
> this series. Can you fix it up and rebase and resend the rest again
> (while adding the collected reviewed-by that some patches in this series
> had)?
So the issue is this: the header file gets included in
arch/arm/include/debug/pl01x.S that gets included in arch/arm/kernel/debug.S
(see #include CONFIG_DEBUG_LL_INCLUDE).
I don't see any easy way out of this, so I guess it means the patch must be
dropped. If someone confirms that there are indeed no solution to have BIT(),
GENMASK() & FIELD_PREP_CONST() accessible from assembly, I'll send the next
version.
Thanks,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
On Thu, 7 Dec 2023, Th?o Lebrun wrote:
> Hello,
>
> On Thu Dec 7, 2023 at 2:37 AM CET, Greg Kroah-Hartman wrote:
> > On Thu, Nov 30, 2023 at 03:07:14PM +0100, Th?o Lebrun wrote:
> > > The driver uses bit shifts and hexadecimal expressions to declare
> > > constants. Replace that with the BIT(), GENMASK() & FIELD_PREP_CONST()
> > > macros to clarify intent.
> > >
> > > Reviewed-by: Linus Walleij <[email protected]>
> > > Reviewed-by: Ilpo J?rvinen <[email protected]>
> > > Signed-off-by: Th?o Lebrun <[email protected]>
> > > ---
> > > include/linux/amba/serial.h | 248 +++++++++++++++++++++++---------------------
> > > 1 file changed, 127 insertions(+), 121 deletions(-)
> >
> > As 0-day had a problem with this patch, I've applied only patch 1 of
> > this series. Can you fix it up and rebase and resend the rest again
> > (while adding the collected reviewed-by that some patches in this series
> > had)?
>
> So the issue is this: the header file gets included in
> arch/arm/include/debug/pl01x.S that gets included in arch/arm/kernel/debug.S
> (see #include CONFIG_DEBUG_LL_INCLUDE).
>
> I don't see any easy way out of this, so I guess it means the patch must be
> dropped. If someone confirms that there are indeed no solution to have BIT(),
> GENMASK() & FIELD_PREP_CONST() accessible from assembly, I'll send the next
> version.
Yeah, it seems to require UART01x_FR_TXFF and UART01x_FR_BUSY, plus
UART01x_DR and UART01x_FR that are not touched by your patch.
I suppose the rest might be convertable though..
--
i.
Hello,
On Thu Dec 7, 2023 at 10:56 AM CET, Ilpo Järvinen wrote:
> On Thu, 7 Dec 2023, Théo Lebrun wrote:
> > On Thu Dec 7, 2023 at 2:37 AM CET, Greg Kroah-Hartman wrote:
> > > On Thu, Nov 30, 2023 at 03:07:14PM +0100, Théo Lebrun wrote:
> > > > The driver uses bit shifts and hexadecimal expressions to declare
> > > > constants. Replace that with the BIT(), GENMASK() & FIELD_PREP_CONST()
> > > > macros to clarify intent.
> > > >
> > > > Reviewed-by: Linus Walleij <[email protected]>
> > > > Reviewed-by: Ilpo Järvinen <[email protected]>
> > > > Signed-off-by: Théo Lebrun <[email protected]>
> > > > ---
> > > > include/linux/amba/serial.h | 248 +++++++++++++++++++++++---------------------
> > > > 1 file changed, 127 insertions(+), 121 deletions(-)
> > >
> > > As 0-day had a problem with this patch, I've applied only patch 1 of
> > > this series. Can you fix it up and rebase and resend the rest again
> > > (while adding the collected reviewed-by that some patches in this series
> > > had)?
> >
> > So the issue is this: the header file gets included in
> > arch/arm/include/debug/pl01x.S that gets included in arch/arm/kernel/debug.S
> > (see #include CONFIG_DEBUG_LL_INCLUDE).
> >
> > I don't see any easy way out of this, so I guess it means the patch must be
> > dropped. If someone confirms that there are indeed no solution to have BIT(),
> > GENMASK() & FIELD_PREP_CONST() accessible from assembly, I'll send the next
> > version.
>
> Yeah, it seems to require UART01x_FR_TXFF and UART01x_FR_BUSY, plus
> UART01x_DR and UART01x_FR that are not touched by your patch.
>
> I suppose the rest might be convertable though..
Thanks Greg and Ilpo! v6 has been sent.
Regards,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Hi Th?o,
kernel test robot noticed the following build errors:
[auto build test ERROR on tty/tty-linus]
[also build test ERROR on usb/usb-testing usb/usb-next usb/usb-linus linus/master v6.7-rc4 next-20231208]
[cannot apply to tty/tty-testing tty/tty-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Th-o-Lebrun/tty-serial-amba-Use-linux-bits-bitfield-h-macros/20231130-230738
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-linus
patch link: https://lore.kernel.org/r/20231130-mbly-uart-v5-2-6566703a04b5%40bootlin.com
patch subject: [PATCH v5 2/9] tty: serial: amba: Use linux/{bits,bitfield}.h macros
config: arm-randconfig-r052-20231206 (https://download.01.org/0day-ci/archive/20231209/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231209/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
include/linux/stddef.h: Assembler messages:
include/linux/stddef.h:10: Error: bad instruction `enum {'
include/linux/stddef.h:11: Error: junk at end of line, first unrecognized character is `,'
include/linux/stddef.h:13: Error: junk at end of line, first unrecognized character is `}'
>> arch/arm/include/asm/swab.h:23: Error: bad instruction `static inline __attribute_const__ __u32 __arch_swahb32(__u32 x)'
>> arch/arm/include/asm/swab.h:24: Error: junk at end of line, first unrecognized character is `{'
>> arch/arm/include/asm/swab.h:25: Error: bad instruction `__asm__ ("rev16 %0, %1":"=r"(x):"r"(x))'
>> arch/arm/include/asm/swab.h:26: Error: bad instruction `return x'
arch/arm/include/asm/swab.h:27: Error: junk at end of line, first unrecognized character is `}'
>> arch/arm/include/asm/swab.h:31: Error: bad instruction `static inline __attribute_const__ __u32 __arch_swab32(__u32 x)'
arch/arm/include/asm/swab.h:32: Error: junk at end of line, first unrecognized character is `{'
>> arch/arm/include/asm/swab.h:33: Error: bad instruction `__asm__ ("rev %0, %1":"=r"(x):"r"(x))'
arch/arm/include/asm/swab.h:34: Error: bad instruction `return x'
arch/arm/include/asm/swab.h:35: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:48: Error: bad instruction `static inline __attribute_const__ __u16 __fswab16(__u16 val)'
include/uapi/linux/swab.h:49: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/swab.h:51: Error: bad instruction `return ((__u16)__arch_swahb32(val))'
include/uapi/linux/swab.h:55: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:57: Error: bad instruction `static inline __attribute_const__ __u32 __fswab32(__u32 val)'
include/uapi/linux/swab.h:58: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:60: Error: bad instruction `return __arch_swab32(val)'
include/uapi/linux/swab.h:64: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:66: Error: bad instruction `static inline __attribute_const__ __u64 __fswab64(__u64 val)'
include/uapi/linux/swab.h:67: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:71: Error: bad instruction `__u32 h=val>>32'
include/uapi/linux/swab.h:72: Error: bad instruction `__u32 l=val&((1ULL<<32)-1)'
include/uapi/linux/swab.h:73: Error: bad instruction `return (((__u64)__fswab32(l))<<32)|((__u64)(__fswab32(h)))'
include/uapi/linux/swab.h:77: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:79: Error: bad instruction `static inline __attribute_const__ __u32 __fswahw32(__u32 val)'
include/uapi/linux/swab.h:80: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:84: Error: bad instruction `return ((__u32)((((__u32)(val)&(__u32)0x0000ffffUL)<<16)|(((__u32)(val)&(__u32)0xffff0000UL)>>16)))'
include/uapi/linux/swab.h:86: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:88: Error: bad instruction `static inline __attribute_const__ __u32 __fswahb32(__u32 val)'
include/uapi/linux/swab.h:89: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/swab.h:91: Error: bad instruction `return __arch_swahb32(val)'
include/uapi/linux/swab.h:95: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:136: Error: bad instruction `static inline unsigned long __swab(const unsigned long y)'
include/uapi/linux/swab.h:137: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:141: Error: bad instruction `return (__u32)(__builtin_constant_p(y)?((__u32)((((__u32)(y)&(__u32)0x000000ffUL)<<24)|(((__u32)(y)&(__u32)0x0000ff00UL)<<8)|(((__u32)(y)&(__u32)0x00ff0000UL)>>8)|(((__u32)(y)&(__u32)0xff000000UL)>>24))):__fswab32(y))'
include/uapi/linux/swab.h:143: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:171: Error: bad instruction `static inline __u16 __swab16p(const __u16*p)'
include/uapi/linux/swab.h:172: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:176: Error: bad instruction `return (__u16)(__builtin_constant_p(*p)?((__u16)((((__u16)(*p)&(__u16)0x00ffU)<<8)|(((__u16)(*p)&(__u16)0xff00U)>>8))):__fswab16(*p))'
include/uapi/linux/swab.h:178: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:184: Error: bad instruction `static inline __u32 __swab32p(const __u32*p)'
include/uapi/linux/swab.h:185: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:189: Error: bad instruction `return (__u32)(__builtin_constant_p(*p)?((__u32)((((__u32)(*p)&(__u32)0x000000ffUL)<<24)|(((__u32)(*p)&(__u32)0x0000ff00UL)<<8)|(((__u32)(*p)&(__u32)0x00ff0000UL)>>8)|(((__u32)(*p)&(__u32)0xff000000UL)>>24))):__fswab32(*p))'
include/uapi/linux/swab.h:191: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:197: Error: bad instruction `static inline __u64 __swab64p(const __u64*p)'
include/uapi/linux/swab.h:198: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:202: Error: bad instruction `return (__u64)(__builtin_constant_p(*p)?((__u64)((((__u64)(*p)&(__u64)0x00000000000000ffULL)<<56)|(((__u64)(*p)&(__u64)0x000000000000ff00ULL)<<40)|(((__u64)(*p)&(__u64)0x0000000000ff0000ULL)<<24)|(((__u64)(*p)&(__u64)0x00000000ff000000ULL)<<8)|(((__u64)(*p)&(__u64)0x000000ff00000000ULL)>>8)|(((__u64)(*p)&(__u64)0x0000ff0000000000ULL)>>24)|(((__u64)(*p)&(__u64)0x00ff000000000000ULL)>>40)|(((__u64)(*p)&(__u64)0xff00000000000000ULL)>>56))):__fswab64(*p))'
include/uapi/linux/swab.h:204: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:212: Error: bad instruction `static inline __u32 __swahw32p(const __u32*p)'
include/uapi/linux/swab.h:213: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:217: Error: bad instruction `return (__builtin_constant_p((__u32)(*p))?((__u32)((((__u32)(*p)&(__u32)0x0000ffffUL)<<16)|(((__u32)(*p)&(__u32)0xffff0000UL)>>16))):__fswahw32(*p))'
include/uapi/linux/swab.h:219: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:227: Error: bad instruction `static inline __u32 __swahb32p(const __u32*p)'
include/uapi/linux/swab.h:228: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:232: Error: bad instruction `return (__builtin_constant_p((__u32)(*p))?((__u32)((((__u32)(*p)&(__u32)0x00ff00ffUL)<<8)|(((__u32)(*p)&(__u32)0xff00ff00UL)>>8))):__fswahb32(*p))'
include/uapi/linux/swab.h:234: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:240: Error: bad instruction `static inline void __swab16s(__u16*p)'
include/uapi/linux/swab.h:241: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:245: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:247: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:252: Error: bad instruction `static inline void __swab32s(__u32*p)'
include/uapi/linux/swab.h:253: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:257: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:259: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:265: Error: bad instruction `static inline void __swab64s(__u64*p)'
include/uapi/linux/swab.h:266: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:270: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:272: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:280: Error: bad instruction `static inline void __swahw32s(__u32*p)'
include/uapi/linux/swab.h:281: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:285: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:287: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/swab.h:295: Error: bad instruction `static inline void __swahb32s(__u32*p)'
include/uapi/linux/swab.h:296: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/swab.h:300: Error: junk at end of line, first unrecognized character is `*'
include/uapi/linux/swab.h:302: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:24: Error: bad instruction `static inline void swab16_array(u16*buf,unsigned int words)'
include/linux/swab.h:25: Error: junk at end of line, first unrecognized character is `{'
include/linux/swab.h:26: Error: bad instruction `while (words--){'
include/linux/swab.h:27: Error: bad instruction `__swab16s(buf)'
include/linux/swab.h:28: Error: bad instruction `buf++'
include/linux/swab.h:29: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:30: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:32: Error: bad instruction `static inline void swab32_array(u32*buf,unsigned int words)'
include/linux/swab.h:33: Error: junk at end of line, first unrecognized character is `{'
include/linux/swab.h:34: Error: bad instruction `while (words--){'
include/linux/swab.h:35: Error: bad instruction `__swab32s(buf)'
include/linux/swab.h:36: Error: bad instruction `buf++'
include/linux/swab.h:37: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:38: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:40: Error: bad instruction `static inline void swab64_array(u64*buf,unsigned int words)'
include/linux/swab.h:41: Error: junk at end of line, first unrecognized character is `{'
include/linux/swab.h:42: Error: bad instruction `while (words--){'
include/linux/swab.h:43: Error: bad instruction `__swab64s(buf)'
include/linux/swab.h:44: Error: bad instruction `buf++'
include/linux/swab.h:45: Error: junk at end of line, first unrecognized character is `}'
include/linux/swab.h:46: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/byteorder/big_endian.h:45: Error: bad instruction `static inline __le64 __cpu_to_le64p(const __u64*p)'
>> include/uapi/linux/byteorder/big_endian.h:46: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/byteorder/big_endian.h:47: Error: bad instruction `return (__force __le64)__swab64p(p)'
include/uapi/linux/byteorder/big_endian.h:48: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/byteorder/big_endian.h:49: Error: bad instruction `static inline __u64 __le64_to_cpup(const __le64*p)'
include/uapi/linux/byteorder/big_endian.h:50: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/byteorder/big_endian.h:51: Error: bad instruction `return __swab64p((__u64*)p)'
include/uapi/linux/byteorder/big_endian.h:52: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/byteorder/big_endian.h:53: Error: bad instruction `static inline __le32 __cpu_to_le32p(const __u32*p)'
include/uapi/linux/byteorder/big_endian.h:54: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/byteorder/big_endian.h:55: Error: bad instruction `return (__force __le32)__swab32p(p)'
include/uapi/linux/byteorder/big_endian.h:56: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/byteorder/big_endian.h:57: Error: bad instruction `static inline __u32 __le32_to_cpup(const __le32*p)'
include/uapi/linux/byteorder/big_endian.h:58: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/byteorder/big_endian.h:59: Error: bad instruction `return __swab32p((__u32*)p)'
include/uapi/linux/byteorder/big_endian.h:60: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/byteorder/big_endian.h:61: Error: bad instruction `static inline __le16 __cpu_to_le16p(const __u16*p)'
include/uapi/linux/byteorder/big_endian.h:62: Error: junk at end of line, first unrecognized character is `{'
>> include/uapi/linux/byteorder/big_endian.h:63: Error: bad instruction `return (__force __le16)__swab16p(p)'
include/uapi/linux/byteorder/big_endian.h:64: Error: junk at end of line, first unrecognized character is `}'
>> include/uapi/linux/byteorder/big_endian.h:65: Error: bad instruction `static inline __u16 __le16_to_cpup(const __le16*p)'
include/uapi/linux/byteorder/big_endian.h:66: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/big_endian.h:67: Error: bad instruction `return __swab16p((__u16*)p)'
include/uapi/linux/byteorder/big_endian.h:68: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/big_endian.h:69: Error: bad instruction `static inline __be64 __cpu_to_be64p(const __u64*p)'
include/uapi/linux/byteorder/big_endian.h:70: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/big_endian.h:71: Error: bad instruction `return (__force __be64)*p'
include/uapi/linux/byteorder/big_endian.h:72: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/big_endian.h:73: Error: bad instruction `static inline __u64 __be64_to_cpup(const __be64*p)'
include/uapi/linux/byteorder/big_endian.h:74: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/big_endian.h:75: Error: bad instruction `return (__force __u64)*p'
include/uapi/linux/byteorder/big_endian.h:76: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/big_endian.h:77: Error: bad instruction `static inline __be32 __cpu_to_be32p(const __u32*p)'
include/uapi/linux/byteorder/big_endian.h:78: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/big_endian.h:79: Error: bad instruction `return (__force __be32)*p'
include/uapi/linux/byteorder/big_endian.h:80: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/big_endian.h:81: Error: bad instruction `static inline __u32 __be32_to_cpup(const __be32*p)'
include/uapi/linux/byteorder/big_endian.h:82: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/big_endian.h:83: Error: bad instruction `return (__force __u32)*p'
include/uapi/linux/byteorder/big_endian.h:84: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/big_endian.h:85: Error: bad instruction `static inline __be16 __cpu_to_be16p(const __u16*p)'
include/uapi/linux/byteorder/big_endian.h:86: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/big_endian.h:87: Error: bad instruction `return (__force __be16)*p'
include/uapi/linux/byteorder/big_endian.h:88: Error: junk at end of line, first unrecognized character is `}'
include/uapi/linux/byteorder/big_endian.h:89: Error: bad instruction `static inline __u16 __be16_to_cpup(const __be16*p)'
include/uapi/linux/byteorder/big_endian.h:90: Error: junk at end of line, first unrecognized character is `{'
include/uapi/linux/byteorder/big_endian.h:91: Error: bad instruction `return (__force __u16)*p'
include/uapi/linux/byteorder/big_endian.h:92: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:144: Error: bad instruction `static inline void le16_add_cpu(__le16*var,u16 val)'
include/linux/byteorder/generic.h:145: Error: junk at end of line, first unrecognized character is `{'
include/linux/byteorder/generic.h:146: Error: junk at end of line, first unrecognized character is `*'
include/linux/byteorder/generic.h:147: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:149: Error: bad instruction `static inline void le32_add_cpu(__le32*var,u32 val)'
include/linux/byteorder/generic.h:150: Error: junk at end of line, first unrecognized character is `{'
include/linux/byteorder/generic.h:151: Error: junk at end of line, first unrecognized character is `*'
include/linux/byteorder/generic.h:152: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:154: Error: bad instruction `static inline void le64_add_cpu(__le64*var,u64 val)'
include/linux/byteorder/generic.h:155: Error: junk at end of line, first unrecognized character is `{'
include/linux/byteorder/generic.h:156: Error: junk at end of line, first unrecognized character is `*'
include/linux/byteorder/generic.h:157: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:160: Error: bad instruction `static inline void le32_to_cpu_array(u32*buf,unsigned int words)'
include/linux/byteorder/generic.h:161: Error: junk at end of line, first unrecognized character is `{'
include/linux/byteorder/generic.h:162: Error: bad instruction `while (words--){'
include/linux/byteorder/generic.h:163: Error: bad instruction `__swab32s((buf))'
include/linux/byteorder/generic.h:164: Error: bad instruction `buf++'
include/linux/byteorder/generic.h:165: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:166: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:168: Error: bad instruction `static inline void cpu_to_le32_array(u32*buf,unsigned int words)'
include/linux/byteorder/generic.h:169: Error: junk at end of line, first unrecognized character is `{'
include/linux/byteorder/generic.h:170: Error: bad instruction `while (words--){'
include/linux/byteorder/generic.h:171: Error: bad instruction `__swab32s((buf))'
include/linux/byteorder/generic.h:172: Error: bad instruction `buf++'
include/linux/byteorder/generic.h:173: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:174: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:176: Error: bad instruction `static inline void be16_add_cpu(__be16*var,u16 val)'
include/linux/byteorder/generic.h:177: Error: junk at end of line, first unrecognized character is `{'
include/linux/byteorder/generic.h:178: Error: junk at end of line, first unrecognized character is `*'
include/linux/byteorder/generic.h:179: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:181: Error: bad instruction `static inline void be32_add_cpu(__be32*var,u32 val)'
include/linux/byteorder/generic.h:182: Error: junk at end of line, first unrecognized character is `{'
include/linux/byteorder/generic.h:183: Error: junk at end of line, first unrecognized character is `*'
include/linux/byteorder/generic.h:184: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:186: Error: bad instruction `static inline void be64_add_cpu(__be64*var,u64 val)'
include/linux/byteorder/generic.h:187: Error: junk at end of line, first unrecognized character is `{'
include/linux/byteorder/generic.h:188: Error: junk at end of line, first unrecognized character is `*'
include/linux/byteorder/generic.h:189: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:191: Error: bad instruction `static inline void cpu_to_be32_array(__be32*dst,const u32*src,size_t len)'
include/linux/byteorder/generic.h:192: Error: junk at end of line, first unrecognized character is `{'
include/linux/byteorder/generic.h:193: Error: bad instruction `size_t i'
include/linux/byteorder/generic.h:195: Error: bad instruction `for (i=0'
include/linux/byteorder/generic.h:195: Error: bad instruction `i <len'
include/linux/byteorder/generic.h:195: Error: bad instruction `i++)'
include/linux/byteorder/generic.h:196: Error: bad instruction `dst[i] =((__force __be32)(__u32)(src[i]))'
include/linux/byteorder/generic.h:197: Error: junk at end of line, first unrecognized character is `}'
include/linux/byteorder/generic.h:199: Error: bad instruction `static inline void be32_to_cpu_array(u32*dst,const __be32*src,size_t len)'
include/linux/byteorder/generic.h:200: Error: junk at end of line, first unrecognized character is `{'
include/linux/byteorder/generic.h:201: Error: bad instruction `size_t i'
include/linux/byteorder/generic.h:203: Error: bad instruction `for (i=0'
include/linux/byteorder/generic.h:203: Error: bad instruction `i <len'
include/linux/byteorder/generic.h:203: Error: bad instruction `i++)'
include/linux/byteorder/generic.h:204: Error: bad instruction `dst[i] =((__force __u32)(__be32)(src[i]))'
include/linux/byteorder/generic.h:205: Error: junk at end of line, first unrecognized character is `}'
include/linux/bitfield.h:158: Error: bad instruction `extern void __compiletime_error("value doesn't fit into mask")'
include/linux/bitfield.h:159: Error: bad instruction `__field_overflow(void)'
include/linux/bitfield.h:160: Error: bad instruction `extern void __compiletime_error("bad bitfield mask")'
include/linux/bitfield.h:161: Error: bad instruction `__bad_mask(void)'
include/linux/bitfield.h:162: Error: bad instruction `static inline u64 field_multiplier(u64 field)'
include/linux/bitfield.h:163: Error: junk at end of line, first unrecognized character is `{'
include/linux/bitfield.h:164: Error: bad instruction `if ((field|(field-1))&((field|(field-1))+1))'
include/linux/bitfield.h:165: Error: bad instruction `__bad_mask()'
include/linux/bitfield.h:166: Error: bad instruction `return field&-field'
include/linux/bitfield.h:167: Error: junk at end of line, first unrecognized character is `}'
include/linux/bitfield.h:168: Error: bad instruction `static inline u64 field_mask(u64 field)'
include/linux/bitfield.h:169: Error: junk at end of line, first unrecognized character is `{'
include/linux/bitfield.h:170: Error: bad instruction `return field/field_multiplier(field)'
include/linux/bitfield.h:171: Error: junk at end of line, first unrecognized character is `}'
include/linux/bitfield.h:198: Error: bad instruction `static inline __u8 u8_encode_bits(u8 v,u8 field){ if(__builtin_constant_p(v)&&(v&~field_mask(field)))__field_overflow()'
include/linux/bitfield.h:198: Error: bad instruction `return ((v&field_mask(field))*field_multiplier(field))'
include/linux/bitfield.h:198: Error: junk at end of line, first unrecognized character is `}'
include/linux/bitfield.h:198: Error: junk at end of line, first unrecognized character is `}'
include/linux/bitfield.h:198: Error: junk at end of line, first unrecognized character is `}'
vim +199 include/linux/bitfield.h
e2192de59e457a Johannes Berg 2023-01-18 119
e2192de59e457a Johannes Berg 2023-01-18 120 /**
e2192de59e457a Johannes Berg 2023-01-18 121 * FIELD_PREP_CONST() - prepare a constant bitfield element
e2192de59e457a Johannes Berg 2023-01-18 122 * @_mask: shifted mask defining the field's length and position
e2192de59e457a Johannes Berg 2023-01-18 123 * @_val: value to put in the field
e2192de59e457a Johannes Berg 2023-01-18 124 *
e2192de59e457a Johannes Berg 2023-01-18 125 * FIELD_PREP_CONST() masks and shifts up the value. The result should
e2192de59e457a Johannes Berg 2023-01-18 126 * be combined with other fields of the bitfield using logical OR.
e2192de59e457a Johannes Berg 2023-01-18 127 *
e2192de59e457a Johannes Berg 2023-01-18 128 * Unlike FIELD_PREP() this is a constant expression and can therefore
e2192de59e457a Johannes Berg 2023-01-18 129 * be used in initializers. Error checking is less comfortable for this
e2192de59e457a Johannes Berg 2023-01-18 130 * version, and non-constant masks cannot be used.
e2192de59e457a Johannes Berg 2023-01-18 131 */
e2192de59e457a Johannes Berg 2023-01-18 132 #define FIELD_PREP_CONST(_mask, _val) \
e2192de59e457a Johannes Berg 2023-01-18 133 ( \
e2192de59e457a Johannes Berg 2023-01-18 134 /* mask must be non-zero */ \
e2192de59e457a Johannes Berg 2023-01-18 135 BUILD_BUG_ON_ZERO((_mask) == 0) + \
e2192de59e457a Johannes Berg 2023-01-18 136 /* check if value fits */ \
e2192de59e457a Johannes Berg 2023-01-18 137 BUILD_BUG_ON_ZERO(~((_mask) >> __bf_shf(_mask)) & (_val)) + \
e2192de59e457a Johannes Berg 2023-01-18 138 /* check if mask is contiguous */ \
e2192de59e457a Johannes Berg 2023-01-18 139 __BF_CHECK_POW2((_mask) + (1ULL << __bf_shf(_mask))) + \
e2192de59e457a Johannes Berg 2023-01-18 140 /* and create the value */ \
e2192de59e457a Johannes Berg 2023-01-18 141 (((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask)) \
e2192de59e457a Johannes Berg 2023-01-18 142 )
e2192de59e457a Johannes Berg 2023-01-18 143
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 144 /**
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 145 * FIELD_GET() - extract a bitfield element
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 146 * @_mask: shifted mask defining the field's length and position
7240767450d6d8 Masahiro Yamada 2017-10-03 147 * @_reg: value of entire bitfield
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 148 *
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 149 * FIELD_GET() extracts the field specified by @_mask from the
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 150 * bitfield passed in as @_reg by masking and shifting it down.
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 151 */
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 152 #define FIELD_GET(_mask, _reg) \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 153 ({ \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 154 __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 155 (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 156 })
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 157
e7d4a95da86e0b Johannes Berg 2018-06-20 158 extern void __compiletime_error("value doesn't fit into mask")
00b0c9b82663ac Al Viro 2017-12-14 159 __field_overflow(void);
00b0c9b82663ac Al Viro 2017-12-14 160 extern void __compiletime_error("bad bitfield mask")
00b0c9b82663ac Al Viro 2017-12-14 161 __bad_mask(void);
00b0c9b82663ac Al Viro 2017-12-14 162 static __always_inline u64 field_multiplier(u64 field)
00b0c9b82663ac Al Viro 2017-12-14 163 {
00b0c9b82663ac Al Viro 2017-12-14 164 if ((field | (field - 1)) & ((field | (field - 1)) + 1))
00b0c9b82663ac Al Viro 2017-12-14 165 __bad_mask();
00b0c9b82663ac Al Viro 2017-12-14 166 return field & -field;
00b0c9b82663ac Al Viro 2017-12-14 167 }
00b0c9b82663ac Al Viro 2017-12-14 168 static __always_inline u64 field_mask(u64 field)
00b0c9b82663ac Al Viro 2017-12-14 169 {
00b0c9b82663ac Al Viro 2017-12-14 170 return field / field_multiplier(field);
00b0c9b82663ac Al Viro 2017-12-14 171 }
e31a50162feb35 Alex Elder 2020-03-12 172 #define field_max(field) ((typeof(field))field_mask(field))
00b0c9b82663ac Al Viro 2017-12-14 173 #define ____MAKE_OP(type,base,to,from) \
00b0c9b82663ac Al Viro 2017-12-14 174 static __always_inline __##type type##_encode_bits(base v, base field) \
00b0c9b82663ac Al Viro 2017-12-14 175 { \
e7d4a95da86e0b Johannes Berg 2018-06-20 176 if (__builtin_constant_p(v) && (v & ~field_mask(field))) \
00b0c9b82663ac Al Viro 2017-12-14 177 __field_overflow(); \
00b0c9b82663ac Al Viro 2017-12-14 178 return to((v & field_mask(field)) * field_multiplier(field)); \
00b0c9b82663ac Al Viro 2017-12-14 179 } \
00b0c9b82663ac Al Viro 2017-12-14 180 static __always_inline __##type type##_replace_bits(__##type old, \
00b0c9b82663ac Al Viro 2017-12-14 181 base val, base field) \
00b0c9b82663ac Al Viro 2017-12-14 182 { \
00b0c9b82663ac Al Viro 2017-12-14 183 return (old & ~to(field)) | type##_encode_bits(val, field); \
00b0c9b82663ac Al Viro 2017-12-14 184 } \
00b0c9b82663ac Al Viro 2017-12-14 185 static __always_inline void type##p_replace_bits(__##type *p, \
00b0c9b82663ac Al Viro 2017-12-14 186 base val, base field) \
00b0c9b82663ac Al Viro 2017-12-14 187 { \
00b0c9b82663ac Al Viro 2017-12-14 188 *p = (*p & ~to(field)) | type##_encode_bits(val, field); \
00b0c9b82663ac Al Viro 2017-12-14 189 } \
00b0c9b82663ac Al Viro 2017-12-14 190 static __always_inline base type##_get_bits(__##type v, base field) \
00b0c9b82663ac Al Viro 2017-12-14 191 { \
00b0c9b82663ac Al Viro 2017-12-14 192 return (from(v) & field)/field_multiplier(field); \
00b0c9b82663ac Al Viro 2017-12-14 193 }
00b0c9b82663ac Al Viro 2017-12-14 194 #define __MAKE_OP(size) \
00b0c9b82663ac Al Viro 2017-12-14 195 ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
00b0c9b82663ac Al Viro 2017-12-14 196 ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
00b0c9b82663ac Al Viro 2017-12-14 197 ____MAKE_OP(u##size,u##size,,)
37a3862e123826 Johannes Berg 2018-06-20 198 ____MAKE_OP(u8,u8,,)
00b0c9b82663ac Al Viro 2017-12-14 @199 __MAKE_OP(16)
00b0c9b82663ac Al Viro 2017-12-14 @200 __MAKE_OP(32)
00b0c9b82663ac Al Viro 2017-12-14 @201 __MAKE_OP(64)
00b0c9b82663ac Al Viro 2017-12-14 202 #undef __MAKE_OP
00b0c9b82663ac Al Viro 2017-12-14 203 #undef ____MAKE_OP
00b0c9b82663ac Al Viro 2017-12-14 204
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Le 30/11/2023 à 15:07, Théo Lebrun a écrit :
> Remove all instances of quoted strings split across lines. Fix four
> checkpatch warnings:
>
> $ ./scripts/checkpatch.pl --strict --file \
> drivers/tty/serial/amba-pl011.c
> WARNING: quoted string split across lines
> [...]
>
> Signed-off-by: Théo Lebrun <[email protected]>
> ---
> drivers/tty/serial/amba-pl011.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 743dee75c68b..be8888db1a37 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -973,8 +973,8 @@ static void pl011_dma_rx_irq(struct uart_amba_port *uap)
> /* Switch buffer & re-trigger DMA job */
> dmarx->use_buf_b = !dmarx->use_buf_b;
> if (pl011_dma_rx_trigger_dma(uap)) {
> - dev_dbg(uap->port.dev, "could not retrigger RX DMA job "
> - "fall back to interrupt mode\n");
> + dev_dbg(uap->port.dev,
> + "could not retrigger RX DMA job fall back to interrupt mode\n");
> uap->im |= UART011_RXIM;
> pl011_write(uap->im, uap, REG_IMSC);
> }
> @@ -1021,8 +1021,8 @@ static void pl011_dma_rx_callback(void *data)
> * get some IRQ immediately from RX.
> */
> if (ret) {
> - dev_dbg(uap->port.dev, "could not retrigger RX DMA job "
> - "fall back to interrupt mode\n");
> + dev_dbg(uap->port.dev,
> + "could not retrigger RX DMA job fall back to interrupt mode\n");
> uap->im |= UART011_RXIM;
> pl011_write(uap->im, uap, REG_IMSC);
> }
> @@ -1158,8 +1158,8 @@ static void pl011_dma_startup(struct uart_amba_port *uap)
>
> if (uap->using_rx_dma) {
> if (pl011_dma_rx_trigger_dma(uap))
> - dev_dbg(uap->port.dev, "could not trigger initial "
> - "RX DMA job, fall back to interrupt mode\n");
> + dev_dbg(uap->port.dev,
> + "could not trigger initial RX DMA job, fall back to interrupt mode\n");
> if (uap->dmarx.poll_rate) {
Hi,
I think that having a comma just before "fall back", as done here, would
make the other 3 messages clearer.
CJ
> timer_setup(&uap->dmarx.timer, pl011_dma_rx_poll, 0);
> mod_timer(&uap->dmarx.timer,
> @@ -1391,8 +1391,8 @@ __acquires(&uap->port.lock)
> */
> if (pl011_dma_rx_available(uap)) {
> if (pl011_dma_rx_trigger_dma(uap)) {
> - dev_dbg(uap->port.dev, "could not trigger RX DMA job "
> - "fall back to interrupt mode again\n");
> + dev_dbg(uap->port.dev,
> + "could not trigger RX DMA job fall back to interrupt mode again\n");
> uap->im |= UART011_RXIM;
> pl011_write(uap->im, uap, REG_IMSC);
> } else {
>