* [PATCH 1/2] serial: ce4100: fix build after serial_in/out() changes
@ 2025-06-23 10:12 Jiri Slaby (SUSE)
2025-06-23 10:12 ` [PATCH 2/2] serial: ce4100: clean up serial_in/out() hooks Jiri Slaby (SUSE)
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby (SUSE) @ 2025-06-23 10:12 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), kernel test robot,
Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin
This x86_32 driver remain unnoticed, so after the commit below, the
compilation now fails with:
arch/x86/platform/ce4100/ce4100.c:107:16: error: incompatible function pointer types assigning to '...' from '...'
To fix the error, convert also ce4100 to the new
uart_port::serial_{in,out}() types.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Fixes: fc9ceb501e38 ("serial: 8250: sanitize uart_port::serial_{in,out}() types")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506190552.TqNasrC3-lkp@intel.com/
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
arch/x86/platform/ce4100/ce4100.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c
index f8126821a94d..f19d20f0dfa4 100644
--- a/arch/x86/platform/ce4100/ce4100.c
+++ b/arch/x86/platform/ce4100/ce4100.c
@@ -49,9 +49,9 @@ static unsigned int mem_serial_in(struct uart_port *p, int offset)
* errata number 9 in Errata - B step.
*/
-static unsigned int ce4100_mem_serial_in(struct uart_port *p, int offset)
+static u32 ce4100_mem_serial_in(struct uart_port *p, unsigned int offset)
{
- unsigned int ret, ier, lsr;
+ u32 ret, ier, lsr;
if (offset == UART_IIR) {
offset = offset << p->regshift;
@@ -73,7 +73,7 @@ static unsigned int ce4100_mem_serial_in(struct uart_port *p, int offset)
return ret;
}
-static void ce4100_mem_serial_out(struct uart_port *p, int offset, int value)
+static void ce4100_mem_serial_out(struct uart_port *p, unsigned int offset, u32 value)
{
offset = offset << p->regshift;
writel(value, p->membase + offset);
--
2.50.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] serial: ce4100: clean up serial_in/out() hooks
2025-06-23 10:12 [PATCH 1/2] serial: ce4100: fix build after serial_in/out() changes Jiri Slaby (SUSE)
@ 2025-06-23 10:12 ` Jiri Slaby (SUSE)
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby (SUSE) @ 2025-06-23 10:12 UTC (permalink / raw)
To: gregkh
Cc: linux-serial, linux-kernel, Jiri Slaby (SUSE), Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin
ce4100_mem_serial_in() unnecessarily contains 4 nested 'if's. That makes
the code hard to follow. Invert the conditions and return early if the
particular conditions do not hold.
And use "<<=" for shifting the offset in both of the hooks.
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
arch/x86/platform/ce4100/ce4100.c | 39 +++++++++++++++++--------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c
index f19d20f0dfa4..08492bea9713 100644
--- a/arch/x86/platform/ce4100/ce4100.c
+++ b/arch/x86/platform/ce4100/ce4100.c
@@ -53,29 +53,32 @@ static u32 ce4100_mem_serial_in(struct uart_port *p, unsigned int offset)
{
u32 ret, ier, lsr;
- if (offset == UART_IIR) {
- offset = offset << p->regshift;
- ret = readl(p->membase + offset);
- if (ret & UART_IIR_NO_INT) {
- /* see if the TX interrupt should have really set */
- ier = mem_serial_in(p, UART_IER);
- /* see if the UART's XMIT interrupt is enabled */
- if (ier & UART_IER_THRI) {
- lsr = mem_serial_in(p, UART_LSR);
- /* now check to see if the UART should be
- generating an interrupt (but isn't) */
- if (lsr & (UART_LSR_THRE | UART_LSR_TEMT))
- ret &= ~UART_IIR_NO_INT;
- }
- }
- } else
- ret = mem_serial_in(p, offset);
+ if (offset != UART_IIR)
+ return mem_serial_in(p, offset);
+
+ offset <<= p->regshift;
+
+ ret = readl(p->membase + offset);
+ if (!(ret & UART_IIR_NO_INT))
+ return ret;
+
+ /* see if the TX interrupt should have really set */
+ ier = mem_serial_in(p, UART_IER);
+ /* see if the UART's XMIT interrupt is enabled */
+ if (!(ier & UART_IER_THRI))
+ return ret;
+
+ lsr = mem_serial_in(p, UART_LSR);
+ /* now check to see if the UART should be generating an interrupt (but isn't) */
+ if (lsr & (UART_LSR_THRE | UART_LSR_TEMT))
+ ret &= ~UART_IIR_NO_INT;
+
return ret;
}
static void ce4100_mem_serial_out(struct uart_port *p, unsigned int offset, u32 value)
{
- offset = offset << p->regshift;
+ offset <<= p->regshift;
writel(value, p->membase + offset);
}
--
2.50.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-23 10:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23 10:12 [PATCH 1/2] serial: ce4100: fix build after serial_in/out() changes Jiri Slaby (SUSE)
2025-06-23 10:12 ` [PATCH 2/2] serial: ce4100: clean up serial_in/out() hooks Jiri Slaby (SUSE)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).