From nobody Wed Dec 17 11:15:07 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A73A2C25B6B for ; Thu, 26 Oct 2023 10:42:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344770AbjJZKmV (ORCPT ); Thu, 26 Oct 2023 06:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235014AbjJZKl5 (ORCPT ); Thu, 26 Oct 2023 06:41:57 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB2BE1BC; Thu, 26 Oct 2023 03:41:51 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id E9066240005; Thu, 26 Oct 2023 10:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1698316910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e0pn22QEalvAdxGRil4GSkrSD6cK+IWSqwv6PL7OxdI=; b=fYNh1Vm6xRmQeRb20WclKxyTtgIge5IvFX1tRU8rwwNPSe4V6Sb3vx8TpWurnUAPq/Afe2 8byWc4DIvAPQ4LEgxg8E1UPwVmZNy67UOiiTwicTA2EHna/IXbA4iL21UmtjyGUrHJWTIc G3NHq1XRlgbodVXUfyJ2XHonnuMYsuGpcnaPU6ZqAegAdbWCe2LIGlYXYFPhd7oZeNJUkC d09eCcA/Bcxyu3qEK6dOl9D6jaj40qIklgPFLx4XJqqPVoF7O+bRfWm0pEgNfjz7+cBvK/ /p9SvSUU75mMi6LZT23W0C+Bc02CLEDYyh9URVyvVvh90RlnsRyqChnlHQCzKQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 26 Oct 2023 12:41:20 +0200 Subject: [PATCH 3/6] tty: serial: amba-pl011: cleanup driver MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20231026-mbly-uart-v1-3-9258eea297d3@bootlin.com> References: <20231026-mbly-uart-v1-0-9258eea297d3@bootlin.com> In-Reply-To: <20231026-mbly-uart-v1-0-9258eea297d3@bootlin.com> To: Russell King , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Linus Walleij , Gregory CLEMENT , Alexandre Belloni , Thomas Petazzoni , Vladimir Kondratiev , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.12.3 X-GND-Sasl: theo.lebrun@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Follow recommandations from: $ ./scripts/checkpatch.pl --strict --file \ drivers/tty/serial/amba-pl011.c It does NOT fix alerts relative to TIOCMBIT which will be dealt with in another patch. Fixes following alerts: CHECK: Alignment should match open parenthesis CHECK: Blank lines aren't necessary after an open brace '{' CHECK: Comparison to NULL could be written [...] 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 declara= tions CHECK: Prefer using the BIT macro CHECK: Unbalanced braces around else statement CHECK: Unnecessary parentheses around [...] CHECK: braces {} should be used on all arms of this statement CHECK: spaces preferred around that '/' (ctx:VxV) CHECK: spaces preferred around that '|' (ctx:VxV) ERROR: do not initialise statics to false WARNING: Comparisons should place the constant on the right side of the= test 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 de= v_info(dev, ... then pr_info(... to printk(KERN_INFO ... WARNING: quoted string split across lines Signed-off-by: Th=C3=A9o Lebrun Reviewed-by: Linus Walleij --- drivers/tty/serial/amba-pl011.c | 153 ++++++++++++++++++++----------------= ---- 1 file changed, 76 insertions(+), 77 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl01= 1.c index 3dc9b0fcab1c..0d53973374de 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -50,8 +50,8 @@ =20 #define AMBA_ISR_PASS_LIMIT 256 =20 -#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_DR_ERROR (UART011_DR_OE | UART011_DR_BE | UART011_DR_PE | UA= RT011_DR_FE) +#define UART_DUMMY_DR_RX BIT(16) =20 enum { REG_DR, @@ -125,7 +125,7 @@ static unsigned int get_fifosize_arm(struct amba_device= *dev) =20 static struct vendor_data vendor_arm =3D { .reg_offset =3D pl011_std_offsets, - .ifls =3D UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, + .ifls =3D UART011_IFLS_RX4_8 | UART011_IFLS_TX4_8, .fr_busy =3D UART01x_FR_BUSY, .fr_dsr =3D UART01x_FR_DSR, .fr_cts =3D UART01x_FR_CTS, @@ -203,7 +203,7 @@ static unsigned int get_fifosize_st(struct amba_device = *dev) =20 static struct vendor_data vendor_st =3D { .reg_offset =3D pl011_st_offsets, - .ifls =3D UART011_IFLS_RX_HALF|UART011_IFLS_TX_HALF, + .ifls =3D UART011_IFLS_RX_HALF | UART011_IFLS_TX_HALF, .fr_busy =3D UART01x_FR_BUSY, .fr_dsr =3D UART01x_FR_DSR, .fr_cts =3D UART01x_FR_CTS, @@ -275,13 +275,13 @@ struct uart_amba_port { static unsigned int pl011_tx_empty(struct uart_port *port); =20 static unsigned int pl011_reg_to_offset(const struct uart_amba_port *uap, - unsigned int reg) + unsigned int reg) { return uap->reg_offset[reg]; } =20 static unsigned int pl011_read(const struct uart_amba_port *uap, - unsigned int reg) + unsigned int reg) { void __iomem *addr =3D uap->port.membase + pl011_reg_to_offset(uap, reg); =20 @@ -290,7 +290,7 @@ static unsigned int pl011_read(const struct uart_amba_p= ort *uap, } =20 static void pl011_write(unsigned int val, const struct uart_amba_port *uap, - unsigned int reg) + unsigned int reg) { void __iomem *addr =3D uap->port.membase + pl011_reg_to_offset(uap, reg); =20 @@ -328,10 +328,12 @@ static int pl011_fifo_to_tty(struct uart_amba_port *u= ap) 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++; =20 @@ -356,7 +358,6 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap) return fifotaken; } =20 - /* * All the DMA operation mode stuff goes inside this ifdef. * This assumes that you have a generic DMA device interface, @@ -367,18 +368,18 @@ static int pl011_fifo_to_tty(struct uart_amba_port *u= ap) #define PL011_DMA_BUFFER_SIZE PAGE_SIZE =20 static int pl011_sgbuf_init(struct dma_chan *chan, struct pl011_sgbuf *sg, - enum dma_data_direction dir) + enum dma_data_direction dir) { dma_addr_t dma_addr; =20 sg->buf =3D dma_alloc_coherent(chan->device->dev, - PL011_DMA_BUFFER_SIZE, &dma_addr, GFP_KERNEL); + PL011_DMA_BUFFER_SIZE, &dma_addr, GFP_KERNEL); if (!sg->buf) return -ENOMEM; =20 sg_init_table(&sg->sg, 1); sg_set_page(&sg->sg, phys_to_page(dma_addr), - PL011_DMA_BUFFER_SIZE, offset_in_page(dma_addr)); + PL011_DMA_BUFFER_SIZE, offset_in_page(dma_addr)); sg_dma_address(&sg->sg) =3D dma_addr; sg_dma_len(&sg->sg) =3D PL011_DMA_BUFFER_SIZE; =20 @@ -386,12 +387,11 @@ static int pl011_sgbuf_init(struct dma_chan *chan, st= ruct pl011_sgbuf *sg, } =20 static void pl011_sgbuf_free(struct dma_chan *chan, struct pl011_sgbuf *sg, - enum dma_data_direction dir) + enum dma_data_direction dir) { if (sg->buf) { - dma_free_coherent(chan->device->dev, - PL011_DMA_BUFFER_SIZE, sg->buf, - sg_dma_address(&sg->sg)); + dma_free_coherent(chan->device->dev, PL011_DMA_BUFFER_SIZE, + sg->buf, sg_dma_address(&sg->sg)); } } =20 @@ -430,7 +430,7 @@ static void pl011_dma_probe(struct uart_amba_port *uap) dma_cap_set(DMA_SLAVE, mask); =20 chan =3D 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; @@ -471,12 +471,12 @@ static void pl011_dma_probe(struct uart_amba_port *ua= p) * If the controller does, check for suitable residue processing * otherwise assime all is well. */ - if (0 =3D=3D dma_get_slave_caps(chan, &caps)) { + if (dma_get_slave_caps(chan, &caps) =3D=3D 0) { if (caps.residue_granularity =3D=3D 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; } } @@ -505,18 +505,16 @@ static void pl011_dma_probe(struct uart_amba_port *ua= p) else uap->dmarx.poll_timeout =3D 3000; } else if (!plat && dev->of_node) { - uap->dmarx.auto_poll_rate =3D of_property_read_bool( - dev->of_node, "auto-poll"); + uap->dmarx.auto_poll_rate =3D + of_property_read_bool(dev->of_node, "auto-poll"); if (uap->dmarx.auto_poll_rate) { u32 x; =20 - if (0 =3D=3D of_property_read_u32(dev->of_node, - "poll-rate-ms", &x)) + if (of_property_read_u32(dev->of_node, "poll-rate-ms", &x) =3D=3D 0) uap->dmarx.poll_rate =3D x; else uap->dmarx.poll_rate =3D 100; - if (0 =3D=3D of_property_read_u32(dev->of_node, - "poll-timeout-ms", &x)) + if (of_property_read_u32(dev->of_node, "poll-timeout-ms", &x) =3D=3D 0) uap->dmarx.poll_timeout =3D x; else uap->dmarx.poll_timeout =3D 3000; @@ -624,9 +622,9 @@ static int pl011_dma_tx_refill(struct uart_amba_port *u= ap) if (count > PL011_DMA_BUFFER_SIZE) count =3D PL011_DMA_BUFFER_SIZE; =20 - if (xmit->tail < xmit->head) + if (xmit->tail < xmit->head) { memcpy(&dmatx->buf[0], &xmit->buf[xmit->tail], count); - else { + } else { size_t first =3D UART_XMIT_SIZE - xmit->tail; size_t second; =20 @@ -648,7 +646,7 @@ static int pl011_dma_tx_refill(struct uart_amba_port *u= ap) } =20 desc =3D dmaengine_prep_slave_sg(chan, &dmatx->sg, 1, DMA_MEM_TO_DEV, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); if (!desc) { dma_unmap_sg(dma_dev->dev, &dmatx->sg, 1, DMA_TO_DEVICE); uap->dmatx.queued =3D false; @@ -759,8 +757,9 @@ static inline bool pl011_dma_tx_start(struct uart_amba_= port *uap) if (pl011_dma_tx_refill(uap) > 0) { uap->im &=3D ~UART011_TXIM; pl011_write(uap->im, uap, REG_IMSC); - } else + } else { ret =3D false; + } } else if (!(uap->dmacr & UART011_TXDMAE)) { uap->dmacr |=3D UART011_TXDMAE; pl011_write(uap->dmacr, uap, REG_DMACR); @@ -836,9 +835,8 @@ static int pl011_dma_rx_trigger_dma(struct uart_amba_po= rt *uap) /* Start the RX DMA job */ sgbuf =3D uap->dmarx.use_buf_b ? &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a; - desc =3D dmaengine_prep_slave_sg(rxchan, &sgbuf->sg, 1, - DMA_DEV_TO_MEM, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + desc =3D dmaengine_prep_slave_sg(rxchan, &sgbuf->sg, 1, 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 @@ -894,14 +892,13 @@ static void pl011_dma_rx_chars(struct uart_amba_port = *uap, =20 /* 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 =3D tty_insert_flip_string(port, sgbuf->buf + dmataken, - pending); + pending); =20 uap->port.icount.rx +=3D dma_count; if (dma_count < pending) @@ -983,8 +980,8 @@ static void pl011_dma_rx_irq(struct uart_amba_port *uap) /* Switch buffer & re-trigger DMA job */ dmarx->use_buf_b =3D !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 |=3D UART011_RXIM; pl011_write(uap->im, uap, REG_IMSC); } @@ -1031,8 +1028,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 |=3D UART011_RXIM; pl011_write(uap->im, uap, REG_IMSC); } @@ -1077,7 +1074,7 @@ static void pl011_dma_rx_poll(struct timer_list *t) dmataken =3D sgbuf->sg.length - dmarx->last_residue; size =3D dmarx->last_residue - state.residue; dma_count =3D tty_insert_flip_string(port, sgbuf->buf + dmataken, - size); + size); if (dma_count =3D=3D size) dmarx->last_residue =3D state.residue; dmarx->last_jiffies =3D jiffies; @@ -1102,7 +1099,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)); } } =20 @@ -1118,7 +1115,6 @@ static void pl011_dma_startup(struct uart_amba_port *= uap) =20 uap->dmatx.buf =3D 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 =3D uap->fifosize; return; } @@ -1169,13 +1165,12 @@ static void pl011_dma_startup(struct uart_amba_port= *uap) =20 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, - jiffies + - msecs_to_jiffies(uap->dmarx.poll_rate)); + jiffies + msecs_to_jiffies(uap->dmarx.poll_rate)); uap->dmarx.last_residue =3D PL011_DMA_BUFFER_SIZE; uap->dmarx.last_jiffies =3D jiffies; } @@ -1363,8 +1358,8 @@ static void pl011_stop_rx(struct uart_port *port) struct uart_amba_port *uap =3D container_of(port, struct uart_amba_port, port); =20 - uap->im &=3D ~(UART011_RXIM|UART011_RTIM|UART011_FEIM| - UART011_PEIM|UART011_BEIM|UART011_OEIM); + uap->im &=3D ~(UART011_RXIM | UART011_RTIM | UART011_FEIM | + UART011_PEIM | UART011_BEIM | UART011_OEIM); pl011_write(uap->im, uap, REG_IMSC); =20 pl011_dma_rx_stop(uap); @@ -1384,7 +1379,7 @@ static void pl011_enable_ms(struct uart_port *port) struct uart_amba_port *uap =3D container_of(port, struct uart_amba_port, port); =20 - uap->im |=3D UART011_RIMIM|UART011_CTSMIM|UART011_DCDMIM|UART011_DSRMIM; + uap->im |=3D UART011_RIMIM | UART011_CTSMIM | UART011_DCDMIM | UART011_DS= RMIM; pl011_write(uap->im, uap, REG_IMSC); } =20 @@ -1402,8 +1397,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 |=3D UART011_RXIM; pl011_write(uap->im, uap, REG_IMSC); } else { @@ -1413,8 +1408,7 @@ __acquires(&uap->port.lock) uap->dmarx.last_jiffies =3D jiffies; uap->dmarx.last_residue =3D 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 } @@ -1561,18 +1555,17 @@ static irqreturn_t pl011_int(int irq, void *dev_id) do { check_apply_cts_event_workaround(uap); =20 - pl011_write(status & ~(UART011_TXIS|UART011_RTIS| - UART011_RXIS), + pl011_write(status & ~(UART011_TXIS | UART011_RTIS | UART011_RXIS), uap, REG_ICR); =20 - 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); @@ -1712,7 +1705,7 @@ static int pl011_get_poll_char(struct uart_port *port) } =20 static void pl011_put_poll_char(struct uart_port *port, - unsigned char ch) + unsigned char ch) { struct uart_amba_port *uap =3D container_of(port, struct uart_amba_port, port); @@ -1914,13 +1907,13 @@ static int sbsa_uart_startup(struct uart_port *port) } =20 static void pl011_shutdown_channel(struct uart_amba_port *uap, - unsigned int lcrh) + unsigned int lcrh) { - unsigned long val; + unsigned long val; =20 - val =3D pl011_read(uap, lcrh); - val &=3D ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN); - pl011_write(val, uap, lcrh); + val =3D pl011_read(uap, lcrh); + val &=3D ~(UART01x_LCRH_BRK | UART01x_LCRH_FEN); + pl011_write(val, uap, lcrh); } =20 /* @@ -2069,7 +2062,7 @@ pl011_set_termios(struct uart_port *port, struct kter= mios *termios, uap->dmarx.poll_rate =3D DIV_ROUND_UP(10000000, baud); #endif =20 - if (baud > port->uartclk/16) + if (baud > port->uartclk / 16) quot =3D DIV_ROUND_CLOSEST(port->uartclk * 8, baud); else quot =3D DIV_ROUND_CLOSEST(port->uartclk * 4, baud); @@ -2151,9 +2144,9 @@ pl011_set_termios(struct uart_port *port, struct kter= mios *termios, * else we see data corruption. */ if (uap->vendor->oversampling) { - if ((baud >=3D 3000000) && (baud < 3250000) && (quot > 1)) + if (baud >=3D 3000000 && baud < 3250000 && quot > 1) quot -=3D 1; - else if ((baud > 3250000) && (quot > 2)) + else if (baud > 3250000 && quot > 2) quot -=3D 2; } /* Set baud rate */ @@ -2222,13 +2215,14 @@ static void pl011_config_port(struct uart_port *por= t, int flags) static int pl011_verify_port(struct uart_port *port, struct serial_struct = *ser) { int ret =3D 0; + if (ser->type !=3D PORT_UNKNOWN && ser->type !=3D PORT_AMBA) ret =3D -EINVAL; if (ser->irq < 0 || ser->irq >=3D nr_irqs) ret =3D -EINVAL; if (ser->baud_base < 9600) ret =3D -EINVAL; - if (port->mapbase !=3D (unsigned long) ser->iomem_base) + if (port->mapbase !=3D (unsigned long)ser->iomem_base) ret =3D -EINVAL; return ret; } @@ -2537,7 +2531,7 @@ static void qdf2400_e44_putc(struct uart_port *port, = unsigned char c) cpu_relax(); } =20 -static void qdf2400_e44_early_write(struct console *con, const char *s, un= signed n) +static void qdf2400_e44_early_write(struct console *con, const char *s, un= signed int n) { struct earlycon_device *dev =3D con->data; =20 @@ -2556,7 +2550,7 @@ static void pl011_putc(struct uart_port *port, unsign= ed char c) cpu_relax(); } =20 -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 =3D con->data; =20 @@ -2617,6 +2611,7 @@ static int __init pl011_early_console_setup(struct ea= rlycon_device *device, =20 return 0; } + OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup); OF_EARLYCON_DECLARE(pl011, "arm,sbsa-uart", pl011_early_console_setup); =20 @@ -2640,6 +2635,7 @@ qdf2400_e44_early_console_setup(struct earlycon_devic= e *device, device->con->write =3D qdf2400_e44_early_write; return 0; } + EARLYCON_DECLARE(qdf2400_e44, qdf2400_e44_early_console_setup); =20 #else @@ -2659,8 +2655,8 @@ static struct uart_driver amba_reg =3D { static int pl011_probe_dt_alias(int index, struct device *dev) { struct device_node *np; - static bool seen_dev_with_alias =3D false; - static bool seen_dev_without_alias =3D false; + static bool seen_dev_with_alias; + static bool seen_dev_without_alias; int ret =3D index; =20 if (!IS_ENABLED(CONFIG_OF)) @@ -2676,7 +2672,7 @@ static int pl011_probe_dt_alias(int index, struct dev= ice *dev) ret =3D index; } else { seen_dev_with_alias =3D true; - if (ret >=3D ARRAY_SIZE(amba_ports) || amba_ports[ret] !=3D NULL) { + if (ret >=3D ARRAY_SIZE(amba_ports) || amba_ports[ret]) { dev_warn(dev, "requested serial port %d not available.\n", ret); ret =3D index; } @@ -2710,7 +2706,7 @@ static int pl011_find_free_port(void) int i; =20 for (i =3D 0; i < ARRAY_SIZE(amba_ports); i++) - if (amba_ports[i] =3D=3D NULL) + if (!amba_ports[i]) return i; =20 return -EBUSY; @@ -2916,9 +2912,12 @@ static int sbsa_uart_probe(struct platform_device *p= dev) if (qdf2400_e44_present) { dev_info(&pdev->dev, "working around QDF2400 SoC erratum 44\n"); uap->vendor =3D &vendor_qdt_qdf2400_e44; - } else -#endif + } else { uap->vendor =3D &vendor_sbsa; + } +#else + uap->vendor =3D &vendor_sbsa; +#endif =20 uap->reg_offset =3D uap->vendor->reg_offset; uap->fifosize =3D 32; @@ -3002,7 +3001,7 @@ static struct amba_driver pl011_driver =3D { =20 static int __init pl011_init(void) { - printk(KERN_INFO "Serial: AMBA PL011 UART driver\n"); + pr_info("Serial: AMBA PL011 UART driver\n"); =20 if (platform_driver_register(&arm_sbsa_uart_platform_driver)) pr_warn("could not register SBSA UART platform driver\n"); --=20 2.41.0