From nobody Fri Oct 2 13:03:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CC6B3A4F26; Fri, 31 Jul 2026 09:39:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490779; cv=none; b=U/RptE9QmM2IjwHJypzyxpJFg1RtWOyXNGbTswxcZL8o0J5WRHahDqi5TsycMbO714CfdPgAcVib/pBXV4GqgXQFbGEL6CNyIf7FH3jKHwiadUiADlp/ojc6rPcB9xjJlJokUDucIdRbpVZrpukGfjFJrf+3nO7JHg06xzmJNbs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490779; c=relaxed/simple; bh=n9Ty9fFbfeSt37AJjyEY+9KmMlPmIhv6yCQOpVeFrMM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uQgVwGHke/M7BV73wvFAVpxFBxSvc9HP8A99Kb7NEH4uxP/MvD167PMtjaa5V5gfUXZtP6vjrE8yOiepQQNwq5hq9R2AXbKUO+cf2Y7uKgF0DsnIj28ERlZ+Lq0fVpGyOo9RhO+nUjpN7oG42slVr2ftXq0zcxsHYYAtzam1ze4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=F44qzywT; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="F44qzywT" Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 70A991F000E9; Fri, 31 Jul 2026 09:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785490778; bh=22Ilw/IkI0k96901vA78kHlE2RFXy9U+AV3Jr6io4iY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=F44qzywT1iWydYzd/CpjTCvrU9zxNL1vCs26xvmkRPIsw2hfYKxAiZKExSf9scyFn 4wDLUb45oEBHlhb6If2nMcwE/FjW9zefObMlFS/YCpY06/aizD1RSmjcME11d116al Buy/bcODq+UX2hxkc1grUKwJS6EYs69Ee4eilhlNrFJIR+avgVqXlVJHfatal6CSeC BOHf6TqxNgSLBycg/EB+v3e+9G1c4bE3AoBatkDAFsM5myrf8V9egpdDCZ0pYmhay5 6qH/Ch4I1oiQAVGibT9ehSWphJ6Vfxvv/Tbl0Jbt91zzAgmiSK39cwi6nnL9MJo9db hGtSTqow3Alzg== From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Greg Kroah-Hartman , Jiri Slaby Cc: Hugo Villeneuve , John Ogness , Atsushi Nemoto , Alan Cox , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH v1 1/6] serial: txx9: Drop noop probe function and dangerous remove callback Date: Fri, 31 Jul 2026 11:39:04 +0200 Message-ID: <25e2b1d699652b095ee69be030850c8818bf78d8.1785489518.git.ukleinek@kernel.org> X-Mailer: git-send-email 2.55.0.11.g153666a7d9bb In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=3716; i=ukleinek@kernel.org; h=from:subject:message-id; bh=n9Ty9fFbfeSt37AJjyEY+9KmMlPmIhv6yCQOpVeFrMM=; b=owGbwMvMwMXY3/A7olbonx/jabUkhqycXKc57jfjXG7dmJP3cknbA4Mf5+9pSBX/LKrS/J8ud f+14iHdTkZjFgZGLgZZMUUW+8Y1mVZVcpGda/9dhhnEygQyhYGLUwAmcvYFB0PndWvj4KlHkyxa nXY9tF0wY3r2vzPrf3s4ls7MqBLLmKw7PTv4KZ/l4dyff210q9fF289KZGKeacWxRyeh/sKkLc3 Jp5Z3XAyvn/1NsYdj39WT7t8j8rtvL4t4129p/JDzWvCR9EgpwXP3W/v2TzR8/tDxvH7aLqPaA6 cTfW+pGy5O+lx8yt58267SzFlxpTbC/QLlxm0/RAO8XnRZ13arB2jMrt9vNLH220yppi0Lb+bp2 fLfmGn20FlqaX5ZYWtax68lYvyrGAyjMstOKife3FXU32OkJyihEKt+nHnZkWN1jDl9ufJpaRyi MrcfRfDZ+KctWbKw6p93pIdEJLtA+fwpX0xszV3PqcsDAA== X-Developer-Key: i=ukleinek@kernel.org; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable The only platform device that can be bound to the driver is allocated by the driver itself. That device doesn't have platdata, so the probe function only consists of a loop that is never run and thus can be dropped without loss of functionality. The remove function then should better not undo things that were not done in the first place. That happens because serial_txx9_init() calls serial_txx9_register_ports() with the created platform device and so up->dev =3D=3D &dev->dev evaluates to true and uart_remove_one_port() is called twice for each port. So let serial_txx9_exit() undo exactly what serial_txx9_init() does and remove the useless respectively wrong functions. Fixes: 0970769aceb9 ("[SERIAL] serial_txx9 driver update") Signed-off-by: Uwe Kleine-K=C3=B6nig --- drivers/tty/serial/serial_txx9.c | 55 ++------------------------------ 1 file changed, 3 insertions(+), 52 deletions(-) diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_t= xx9.c index 4ae9a45c8e3a..5ed20129b44b 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c @@ -1009,7 +1009,8 @@ static void serial_txx9_unregister_port(int line) struct uart_port *uart =3D &serial_txx9_ports[line]; =20 mutex_lock(&serial_txx9_mutex); - uart_remove_one_port(&serial_txx9_reg, uart); + if (up->iobase || up->mapbase) + uart_remove_one_port(&serial_txx9_reg, uart); uart->flags =3D 0; uart->type =3D PORT_UNKNOWN; uart->iobase =3D 0; @@ -1019,52 +1020,6 @@ static void serial_txx9_unregister_port(int line) mutex_unlock(&serial_txx9_mutex); } =20 -/* - * Register a set of serial devices attached to a platform device. - */ -static int serial_txx9_probe(struct platform_device *dev) -{ - struct uart_port *p =3D dev_get_platdata(&dev->dev); - struct uart_port port; - int ret, i; - - memset(&port, 0, sizeof(struct uart_port)); - for (i =3D 0; p && p->uartclk !=3D 0; p++, i++) { - port.iobase =3D p->iobase; - port.membase =3D p->membase; - port.irq =3D p->irq; - port.uartclk =3D p->uartclk; - port.iotype =3D p->iotype; - port.flags =3D p->flags; - port.mapbase =3D p->mapbase; - port.dev =3D &dev->dev; - port.has_sysrq =3D IS_ENABLED(CONFIG_SERIAL_TXX9_CONSOLE); - ret =3D serial_txx9_register_port(&port); - if (ret < 0) { - dev_err(&dev->dev, "unable to register port at index %d " - "(IO%lx MEM%llx IRQ%d): %d\n", i, - p->iobase, (unsigned long long)p->mapbase, - p->irq, ret); - } - } - return 0; -} - -/* - * Remove serial ports registered against a platform device. - */ -static void serial_txx9_remove(struct platform_device *dev) -{ - int i; - - for (i =3D 0; i < UART_NR; i++) { - struct uart_port *up =3D &serial_txx9_ports[i]; - - if (up->dev =3D=3D &dev->dev) - serial_txx9_unregister_port(i); - } -} - #ifdef CONFIG_PM static int serial_txx9_suspend(struct platform_device *dev, pm_message_t s= tate) { @@ -1096,8 +1051,6 @@ static int serial_txx9_resume(struct platform_device = *dev) #endif =20 static struct platform_driver serial_txx9_plat_driver =3D { - .probe =3D serial_txx9_probe, - .remove =3D serial_txx9_remove, #ifdef CONFIG_PM .suspend =3D serial_txx9_suspend, .resume =3D serial_txx9_resume, @@ -1251,9 +1204,7 @@ static void __exit serial_txx9_exit(void) platform_driver_unregister(&serial_txx9_plat_driver); platform_device_unregister(serial_txx9_plat_devs); for (i =3D 0; i < UART_NR; i++) { - struct uart_port *up =3D &serial_txx9_ports[i]; - if (up->iobase || up->mapbase) - uart_remove_one_port(&serial_txx9_reg, up); + serial_txx9_unregister_port(i); } =20 uart_unregister_driver(&serial_txx9_reg); --=20 2.55.0.11.g153666a7d9bb From nobody Fri Oct 2 13:03:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BCA43A1A21; Fri, 31 Jul 2026 09:39:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490782; cv=none; b=am3zJZ+J9zOJRlZThsUei5WnSl4eASzM2nzGP01xVvtwF3KzQt14ke4quBkvUxgxvDy5T0ZM9vRIPf6NXFNnGj1DPxjQFjgpkO3xjGgHc9Wvw9mJurCEOfLNlMGL2HiIAGQBRc7o50qT1nrOGt6yoJsBnXUj8yWUN1kEZZae+Bo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490782; c=relaxed/simple; bh=XpKGrJ8oeXzH26hyilRihK3VPy1Ez2VuqWzcp8ptPoE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jgNpMvZh8z0DNG1z4RqWfR+d/S0wNkxVzjyyM5nl8x4ymskI+lZ5ffupAlpw6y6t2Atmp61CtaUDO8q89BEPe34Kvk9TypVB6UMQwCRYcPD1WvMu51d7gUUp3MBLKHbS9aPmkqrsZ9a/iGBCi/heDGzTOOLlEBmEEfPSCX4ObAs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eHiAxf8J; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eHiAxf8J" Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 1D0941F000E9; Fri, 31 Jul 2026 09:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785490780; bh=tatdY3mN2Ik5NNo+hhHKTNHL5NnvD1XtiBjZs0k9aEY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eHiAxf8JYynLQ/+nN74e62XGIgeVM7665wJGEHzURSmhWt/8n7VAzI9FRHqgopxXC vc+3vLTHeaX7WalhZWPDBCIhNIYpMgk/434u3B3GOljxOa0NmqNJdFj945KQGVcLJl BQ3JLch3dgme88m8tg6eNkxW7Ah1wYdzxsgI4/z7LQZ4+gt2fvlbqKmHyouaZ+EgJ2 ZLY/MQyc5daROh2Og++JWceITpxPeInGPb7ME8Jmy7neJ8Fq/Mf6GuZCKsurGhJeT9 QxS7iWXt/naAeMVZ6sjWlwGSzJIlq2zQ9A317/Wljob3CkMowEgBEdA5ne2cSciqYa Ylu8kh3RtIJ5w== From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Greg Kroah-Hartman , Jiri Slaby Cc: Hugo Villeneuve , John Ogness , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH v1 2/6] serial: txx9: Drop usage of uart_match_port() Date: Fri, 31 Jul 2026 11:39:05 +0200 Message-ID: X-Mailer: git-send-email 2.55.0.11.g153666a7d9bb In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=933; i=ukleinek@kernel.org; h=from:subject:message-id; bh=XpKGrJ8oeXzH26hyilRihK3VPy1Ez2VuqWzcp8ptPoE=; b=owGbwMvMwMXY3/A7olbonx/jabUkhqycXJdprmn8i8svMEuHmG+0jy9ymvgkyO/99wm9JcW7k 286MR3oZDRmYWDkYpAVU2Sxb1yTaVUlF9m59t9lmEGsTCBTGLg4BWAiWQvZ/xfelfjvzy0/Wf1U lMFMjVkPnGc8njc37F3Hvt7iaf0BTZkrjeoPClxRO2ntkM5Zk65e5/fobbq5Jdcm/4Zdi6X9A11 tXxus9WDqy1J8PXO2esgrhsbOSeXsmhKcIllab9LWs0kasZdee2DCGByS1pmbX9sSVajDyzLr0c J5YlcTvym+LRRyKnUozDD90eb18UCM6EXx4/V37Tcv3H1sW1OkgOTf5hX3zv37f3iWyudnbc9Zo 7uTvEU8M63mZi79fK6mNfd8xbNyTcb3Se8Uy2sPlK1XjtHQmGS63lrY2nPSGfeaX8zxlbsWMdwT e8Lz/ZWlj4QkU1dyor3m2+v1Hl3ZZb+aW+aUfJX2eQsA X-Developer-Key: i=ukleinek@kernel.org; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable In this driver .iotype is always UPIO_PORT. So uart_match_port() is equivalent to comparing .iobase. Remove the call to uart_match_port() which then only has a single caller that is handled in the next commit. Signed-off-by: Uwe Kleine-K=C3=B6nig --- drivers/tty/serial/serial_txx9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_t= xx9.c index 5ed20129b44b..2368081c3742 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c @@ -965,7 +965,7 @@ static int serial_txx9_register_port(struct uart_port *= port) mutex_lock(&serial_txx9_mutex); for (i =3D 0; i < UART_NR; i++) { uart =3D &serial_txx9_ports[i]; - if (uart_match_port(uart, port)) { + if (uart->iobase =3D=3D port->iobase) uart_remove_one_port(&serial_txx9_reg, uart); break; } --=20 2.55.0.11.g153666a7d9bb From nobody Fri Oct 2 13:03:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8FCD3B3C01; Fri, 31 Jul 2026 09:39:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490785; cv=none; b=ZRsS7pXzDrKN+59zeMItr4lEAKMarjZJsUqZ6Moo7rt8w3Vc2XRyvs7NGP6Mkx7fzDgxR2gcMyMi5yqLQHzcu/Cr38dmTSgWfK9WpQNzlVH1yO3xP7k3bDWBzew+t0ClWKG9qcKgGgBh9cxHlEBFRKxPjDwhoeTF+Yji1YKeBoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490785; c=relaxed/simple; bh=BuctfOC8i6cKchdnIiDE94iJ0LouwLYFc/zc3PhPiuE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RG0bJa0fIVg8A0tPUht4mDu3JcS7gW8B4c+JTB0kK5hr9IOwyRbZIWm/t38Hx5jEHSjWoXX026e/zF1lRqF42WQkygF4op5GrUaVXUD71Pqzi/jWbr39v5Z5tIie666ne9atN9rMvEyPhe8dYhZHGpct5nYPOcjHc1T4V+zh46M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WGaKNPXp; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WGaKNPXp" Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id C412D1F00A3A; Fri, 31 Jul 2026 09:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785490783; bh=7rWkVEBbXHPWFlMkYxOYL/pB06ym1Kh75wRMniM1bhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WGaKNPXpNS84y/O0w0/FfnxhfhaaoUkCMNDNVC4E01PlLSJ85fFQ1SK2l3UaqoblQ SNfFvIx0MoG6JFb6WeK25HcVOhuJDGSrOC+ySfHx/rKdU8eLYM0FfRrv2gT3/E/Zk2 qwjYUvgvHqvHJdEXdHvcQk8oOu2Cy8x4ZeFun4v3BEZ0xFu66KBtgnRgp2WNVceSLA WN5pP4DMqP8rLHxa4p+zkJofEARavz2App9fXZEbwqK1v4/YWzi5HZ74UxEHtT4Hh3 uPKcqcBEI9g5hk7Gg6C00fig6fQ8J7OoeKoQgjRss8LwFDa1WK6GF91UC0Mktj9w4T cW6ZRX8Tvnvpw== From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Greg Kroah-Hartman , Jiri Slaby Cc: Jonathan Corbet , Shuah Khan , John Ogness , Stepan Ionichev , Fushuai Wang , Osama Abdelkader , Hugo Villeneuve , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v1 3/6] serial: 8250: Make uart_match_port() a 8250 specific function Date: Fri, 31 Jul 2026 11:39:06 +0200 Message-ID: <8f707b41d462afcf7a2237869adece5fc16a9a77.1785489518.git.ukleinek@kernel.org> X-Mailer: git-send-email 2.55.0.11.g153666a7d9bb In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=4950; i=ukleinek@kernel.org; h=from:subject:message-id; bh=BuctfOC8i6cKchdnIiDE94iJ0LouwLYFc/zc3PhPiuE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBqbG1HxXnff/geZcbUysE5+C6xmiUCoQ4OJWGik sYqhFKUTaqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCamxtRwAKCRCPgPtYfRL+ To1fCACR5dNpcpzmDL7bEc+JE/I6k6lSCRgxUWJpZLtuIE3fzP6OYYKkC9gIwXRn8sJHWW7R4vF 5sY7MdBb8f7LVPV8pPSn79+1goaUe/Dw6q8sZGY+yzdc+LBBIsx01BqC2UuDFPpAVKEdAAxj5mX Toc5oaaiNOoFmbUQwHjOVdGt12MteoIOt6aaNjaBcoS68I3NaOjND/3E+3GCRH1mIZ1X30+QkEJ bjYFOjNqJ4lp2rNl/uYXz6c7fEF1S4KZET9HPS0zjJNab0bWedCSN8i3A2dQLNSVVB74NetWEgQ JOOu1CIlnVdE70y11ZxlQfhq9Gj26f3MHKBUbi5u42JKxFXR X-Developer-Key: i=ukleinek@kernel.org; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable The 8250 driver conglomerate is the only user of this function and in fact it already is 8250 specific as it uses hub6_match_port() which is defined in drivers/tty/serial/8250/8250_hub6.c unless the dummy implementation is in use. Signed-off-by: Uwe Kleine-K=C3=B6nig --- Documentation/driver-api/serial/driver.rst | 2 +- drivers/tty/serial/8250/8250_core.c | 27 +++++++++++++++++++++- drivers/tty/serial/serial_core.c | 27 ---------------------- include/linux/serial_core.h | 2 -- 4 files changed, 27 insertions(+), 31 deletions(-) diff --git a/Documentation/driver-api/serial/driver.rst b/Documentation/dri= ver-api/serial/driver.rst index c1db6a1a67c4..975b0ba53e98 100644 --- a/Documentation/driver-api/serial/driver.rst +++ b/Documentation/driver-api/serial/driver.rst @@ -70,7 +70,7 @@ Other functions =20 .. kernel-doc:: drivers/tty/serial/serial_core.c :identifiers: uart_update_timeout uart_get_baud_rate uart_get_divisor - uart_match_port uart_write_wakeup uart_register_driver + uart_write_wakeup uart_register_driver uart_unregister_driver uart_suspend_port uart_resume_port uart_add_one_port uart_remove_one_port uart_console_write uart_parse_earlycon uart_parse_options uart_set_options diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/= 8250_core.c index c0e8a4efbdcc..6059b84d8364 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -630,6 +630,31 @@ EXPORT_SYMBOL(serial8250_resume_port); */ static DEFINE_MUTEX(serial_mutex); =20 +/** + * serial8250_match_port - are the two ports equivalent? + * @port1: first port + * @port2: second port + * + * This utility function can be used to determine whether two uart_port + * structures describe the same port. + */ +static bool serial8250_match_port(const struct uart_port *port1, + const struct uart_port *port2) +{ + if (port1->iotype !=3D port2->iotype) + return false; + else if (port1->iotype =3D=3D UPIO_PORT) + return port1->iobase =3D=3D port2->iobase; + else if (port1->iotype =3D=3D UPIO_HUB6) + return hub6_match_port(port1, port2); + else if (uart_iotype_mmio(port1->iotype)) + return port1->mapbase =3D=3D port2->mapbase; + else if (port1->iotype =3D=3D UPIO_BUS) + return true; + else + return false; +} + static struct uart_8250_port *serial8250_find_match_or_unused(const struct= uart_port *port) { int i; @@ -638,7 +663,7 @@ static struct uart_8250_port *serial8250_find_match_or_= unused(const struct uart_ * First, find a port entry which matches. */ for (i =3D 0; i < nr_uarts; i++) - if (uart_match_port(&serial8250_ports[i].port, port)) + if (serial8250_match_port(&serial8250_ports[i].port, port)) return &serial8250_ports[i]; =20 /* try line number first if still available */ diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_c= ore.c index edd1e7be2a5c..8a6c53a9996e 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -33,7 +33,6 @@ #include =20 #include "serial_base.h" -#include "8250/8250.h" /* For hub6_match_port() */ =20 /* * This is used to lock changes in serial line configuration. @@ -3229,32 +3228,6 @@ static void serial_core_remove_one_port(struct uart_= driver *drv, state->uart_port =3D NULL; } =20 -/** - * uart_match_port - are the two ports equivalent? - * @port1: first port - * @port2: second port - * - * This utility function can be used to determine whether two uart_port - * structures describe the same port. - */ -bool uart_match_port(const struct uart_port *port1, - const struct uart_port *port2) -{ - if (port1->iotype !=3D port2->iotype) - return false; - else if (port1->iotype =3D=3D UPIO_PORT) - return port1->iobase =3D=3D port2->iobase; - else if (port1->iotype =3D=3D UPIO_HUB6) - return hub6_match_port(port1, port2); - else if (uart_iotype_mmio(port1->iotype)) - return port1->mapbase =3D=3D port2->mapbase; - else if (port1->iotype =3D=3D UPIO_BUS) - return true; - else - return false; -} -EXPORT_SYMBOL(uart_match_port); - static struct serial_ctrl_device * serial_core_get_ctrl_dev(struct serial_port_device *port_dev) { diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index c4cc4f66af4b..1659805e2233 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -1137,8 +1137,6 @@ int uart_add_one_port(struct uart_driver *reg, struct= uart_port *port); void uart_remove_one_port(struct uart_driver *reg, struct uart_port *port); int uart_read_port_properties(struct uart_port *port); int uart_read_and_validate_port_properties(struct uart_port *port); -bool uart_match_port(const struct uart_port *port1, - const struct uart_port *port2); =20 /* * Power Management --=20 2.55.0.11.g153666a7d9bb From nobody Fri Oct 2 13:03:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B8E93B71DC; Fri, 31 Jul 2026 09:39:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490788; cv=none; b=KwE/GgqTQQPKMtrzG+wixNawjeSvPEU3uWpszO1WzVpqbJqMfRcx08fitL712Xh8G7TAsenZd4Q5Ih3QBCjSZ/+h3nI4ZakspLicJEeok3KNyaVktCnvkmqyRXSyJ1NMftqROcGvVo4V0WjiQs0mMIq9qwP9HoTc+jbRbDWdNoc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490788; c=relaxed/simple; bh=uc/yvEK+VclM8tTXzAItkKWAjw0OBuiiRvd82pubQ38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Yh88ri/iicF6gP+fcrE9+XrIxNNKHSrK1cHMpxX0g3H+2J3cqJVobT89j9w2go8AgSVZNOWiDar1llDl8phn5RIZtJXaDJcoxj46gau4Izx4TjWdwPIWt8qY1FA2DE2PcWmAwD2Yfa7DlB2/4dPO8nOo7JZ93fiAC9RofpLzrnQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gLVxeWZC; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gLVxeWZC" Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 741661F000E9; Fri, 31 Jul 2026 09:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785490786; bh=8N1pdeyofShmR8lA4oJSjBbnr6Z3a/P3MA5cJ8/nLKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gLVxeWZCb6BG3kq7HZ2QuvreJ1IdgfRd6jk7Zk68gpQwBbg+HCgXdkjw9JgHjiyUS 2LFcnKCF67J0eyW8Ldy3tmnmEVzDYnBz+CtfcfAuDDeff5S0i+li0YHq+UmXYP9HRD jU+XNBsc+uYU5l1uDadteZMmShlfY2rCERzqw3FYJbuFsBacjCSfryMGRVKivHQW4N /f9I3T1wxXbQAmApSlsXPRcl5D6nHD4pYyihYGE0VRg/kzt9pP/q6bt1vdQ34BcI5h BEiMl4NhHrbMcMRMMrs2OH0slVQcI9lRJE9s4nROhtS25e5rUQbb5jl+i4KNpwX3Q2 I35PlI04TiEug== From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Greg Kroah-Hartman , Jiri Slaby Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko , Hugo Villeneuve , Abinash Singh , Kees Cook , Gerhard Engleder , Lukas Wunner , Huacai Chen , Binbin Zhou , Rong Zhang , Randy Dunlap , Haowei Zheng , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH v1 4/6] serial: 8250: Fix corner case for port matching Date: Fri, 31 Jul 2026 11:39:07 +0200 Message-ID: <7c105c23bcb12328536cda06d52e6c9cec7d7d22.1785489518.git.ukleinek@kernel.org> X-Mailer: git-send-email 2.55.0.11.g153666a7d9bb In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=4834; i=ukleinek@kernel.org; h=from:subject:message-id; bh=uc/yvEK+VclM8tTXzAItkKWAjw0OBuiiRvd82pubQ38=; b=owGbwMvMwMXY3/A7olbonx/jabUkhqycXM8zNlZ3Ft5t3ryv/EDGL7uW51sjHyyUaJ6VXSt5u CBj1RG5TkZjFgZGLgZZMUUW+8Y1mVZVcpGda/9dhhnEygQyhYGLUwAmIrqDg6FFn0npRze/xZof z5oj1dz2ht6LVdXetDnQ/li0s0JpgnaV1Pxq100H5r+tPhKwUOg9w/4LUefLt+wQWSeldivKW/a u5YSb3r12AX7zmr3215udXDdd8tgCrQP80+SvxipfUZN+dKX7cvD/9v1y8zZ+WuF+ml3NvrYs9b DkpqPxP84fFUyJe1yp8nq57EQNDzfHU9zOkrxez+UkRE0DjZ2b7S+0udlpszDqrs8XXR56NvnAH OfL3yI8JusneBswxrja3Ju9WIht2XLeFrVNswvs3FRygq/EqTovSPqvbq/RcYG1b0unnO/k7Z8W WIbslPPu0GH2UJWPu2jzifPzNd3DPfpBHLcCltzwVDsJAA== X-Developer-Key: i=ukleinek@kernel.org; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable In the case CONFIG_SERIAL_8250=3Dy + CONFIG_SERIAL_8250_HUB6=3Dm hub6_match_port() evaluates statically to false in serial8250_match_port() which is a bug and a change in behavior compared to before commit 7ab80d1e7243 ("serial: 8250: fix compile error with hub6_match_port() when compiled as a module"). To make the comparison correct, the dummy implementation of hub6_match_port() must only be used if CONFIG_SERIAL_8250_HUB6 is disabled. Then as there is a bidirectional dependency between 8250_hub6.c and 8250_core.c, put both in the same module. Fixes: 7ab80d1e7243 ("serial: 8250: fix compile error with hub6_match_port(= ) when compiled as a module") Signed-off-by: Uwe Kleine-K=C3=B6nig --- drivers/tty/serial/8250/8250.h | 8 +++++++- drivers/tty/serial/8250/8250_hub6.c | 8 +------- drivers/tty/serial/8250/8250_platform.c | 4 ++++ drivers/tty/serial/8250/Kconfig | 4 ++-- drivers/tty/serial/8250/Makefile | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index b62f88eec881..39d72f1480c0 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -315,6 +315,12 @@ static inline int serial8250_pnp_init(void) { return 0= ; } static inline void serial8250_pnp_exit(void) { } #endif =20 +#ifdef CONFIG_SERIAL_8250_HUB6 +int serial8250_hub6_init(void); +#else +static inline int serial8250_hub6_init(void) { return 0; } +#endif + #ifdef CONFIG_SERIAL_8250_RSA void univ8250_rsa_support(struct uart_ops *ops, const struct uart_ops *cor= e_ops); void rsa_enable(struct uart_8250_port *up); @@ -335,7 +341,7 @@ int fintek_8250_probe(struct uart_8250_port *uart); static inline int fintek_8250_probe(struct uart_8250_port *uart) { return = 0; } #endif =20 -#if IS_REACHABLE(CONFIG_SERIAL_8250_HUB6) +#if IS_ENABLED(CONFIG_SERIAL_8250_HUB6) bool hub6_match_port(const struct uart_port *port1, const struct uart_port= *port2); #else static inline bool hub6_match_port(const struct uart_port *port1, const st= ruct uart_port *port2) diff --git a/drivers/tty/serial/8250/8250_hub6.c b/drivers/tty/serial/8250/= 8250_hub6.c index b6767633c966..3e548530ec4e 100644 --- a/drivers/tty/serial/8250/8250_hub6.c +++ b/drivers/tty/serial/8250/8250_hub6.c @@ -49,13 +49,7 @@ bool hub6_match_port(const struct uart_port *port1, cons= t struct uart_port *port } EXPORT_SYMBOL_GPL(hub6_match_port); =20 -static int __init hub6_init(void) +int __init serial8250_hub6_init(void) { return platform_device_register(&hub6_device); } - -module_init(hub6_init); - -MODULE_AUTHOR("Russell King"); -MODULE_DESCRIPTION("8250 serial probe module for Hub6 cards"); -MODULE_LICENSE("GPL"); diff --git a/drivers/tty/serial/8250/8250_platform.c b/drivers/tty/serial/8= 250/8250_platform.c index 5a0bc1fae11d..e8524d545de9 100644 --- a/drivers/tty/serial/8250/8250_platform.c +++ b/drivers/tty/serial/8250/8250_platform.c @@ -319,6 +319,10 @@ static int __init serial8250_init(void) if (ret) goto unreg_uart_drv; =20 + ret =3D serial8250_hub6_init(); + if (ret) + goto unreg_pnp; + serial8250_isa_devs =3D platform_device_alloc("serial8250", PLAT8250_DEV_= LEGACY); if (!serial8250_isa_devs) { ret =3D -ENOMEM; diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kcon= fig index fc3e58d62233..00c2ced12717 100644 --- a/drivers/tty/serial/8250/Kconfig +++ b/drivers/tty/serial/8250/Kconfig @@ -294,8 +294,8 @@ config SERIAL_8250_EXAR_ST16C554 will be called 8250_exar_st16c554. =20 config SERIAL_8250_HUB6 - tristate "Support Hub6 cards" - depends on SERIAL_8250 !=3D n && ISA && SERIAL_8250_MANY_PORTS + bool "Support Hub6 cards" + depends on SERIAL_8250_MANY_PORTS && ISA help Say Y here if you have a HUB6 serial board. =20 diff --git a/drivers/tty/serial/8250/Makefile b/drivers/tty/serial/8250/Mak= efile index 6d21402b4435..416c32e3aba2 100644 --- a/drivers/tty/serial/8250/Makefile +++ b/drivers/tty/serial/8250/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_SERIAL_8250) +=3D 8250.o 8250-y :=3D 8250_core.o 8250-y +=3D 8250_platform.o 8250-$(CONFIG_SERIAL_8250_PNP) +=3D 8250_pnp.o +8250-$(CONFIG_SERIAL_8250_HUB6) +=3D 8250_hub6.o =20 obj-$(CONFIG_SERIAL_8250) +=3D 8250_base.o 8250_base-y :=3D 8250_port.o @@ -35,7 +36,6 @@ obj-$(CONFIG_SERIAL_8250_EXAR_ST16C554) +=3D 8250_exar_st= 16c554.o obj-$(CONFIG_SERIAL_8250_FOURPORT) +=3D 8250_fourport.o obj-$(CONFIG_SERIAL_8250_FSL) +=3D 8250_fsl.o obj-$(CONFIG_SERIAL_8250_HP300) +=3D 8250_hp300.o -obj-$(CONFIG_SERIAL_8250_HUB6) +=3D 8250_hub6.o obj-$(CONFIG_SERIAL_8250_INGENIC) +=3D 8250_ingenic.o obj-$(CONFIG_SERIAL_8250_IOC3) +=3D 8250_ioc3.o obj-$(CONFIG_SERIAL_8250_KEBA) +=3D 8250_keba.o --=20 2.55.0.11.g153666a7d9bb From nobody Fri Oct 2 13:03:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D59F2571B8; Fri, 31 Jul 2026 09:39:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490793; cv=none; b=A67/FzI/I2ShkxNisUfSzeqNFTaLdsd7/nULl4d6nCGzx+ZrLgZ3tEwYh2QdLd7U4eT6dqEdHVapvV/JKSDe1f+WHwXtTn74+J5mNSsDI7nWbG8rIUdOqZio/QOrjHa37vCWVAOdd/gdk+amzqsPDJxeqd4yvDWkGxYOQ7aVlYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490793; c=relaxed/simple; bh=qpY7AgeLtloKboCTPUJdGHGeqUKP2v6Av7OeXI92rLk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j8gmM32DmaL3eZAU54YsA0adqmbsgaJ7RUK5I54bv4FzNO2X/tUJXiDTwwcEsmzeKQTWX2/Xg6Pt9gqbkcP9Y9/Hgp6F2iitTCiWCF75xfJMmBo0e/BwuFv80DtYKVaKtyY49OhvQ8K9S9Yxw5qsajZ5twggm6Is0qPtUHUQodM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CgODjDdu; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CgODjDdu" Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id 2205A1F00A3A; Fri, 31 Jul 2026 09:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785490788; bh=gCnifO7YGokBDy4pddwRpI2M8VTQL87Sux7PhHHvXJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CgODjDdu+xTEn7jd2pY2iQ2fx3qyA9jezsF/hIf/0er39cDmS3O9qvvveidNcllku e1jKj3AENIptIenuACJA4FLCq4JPgpHJrPYqs6wgW8V67kY6TnxtUhLpAEu0vBpJuD RkaJpz0nT7Bb6apk8i5UqHN9we6r7HNAITQ7J2xmMYTgAQQH+to54v37urVAUYA79E JBrQpcGz2W14az9QzzLLkpRqTTGqwtfuo8P85UFiv47xjWcizPQ7VOLopoGuD8CXVz fNIoXPa2cqUFHrRvbcEIYzfQWRs0ratW8FhUYCZpyv4W2iTeVYPGAHeswRjbgL4C4O wrsletjtQB53A== From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Greg Kroah-Hartman , Jiri Slaby Cc: Hugo Villeneuve , Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Abinash Singh , Rahul Bukte , Kees Cook , Russell King , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH v1 5/6] serial: 8250: hub6: Add cleanup code Date: Fri, 31 Jul 2026 11:39:08 +0200 Message-ID: <7f55243755253d7c76c5f2e188fd1df4f923a265.1785489518.git.ukleinek@kernel.org> X-Mailer: git-send-email 2.55.0.11.g153666a7d9bb In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=2470; i=ukleinek@kernel.org; h=from:subject:message-id; bh=qpY7AgeLtloKboCTPUJdGHGeqUKP2v6Av7OeXI92rLk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBqbG1MU1fbVCbY/yRGe54TazsRu2JJjc1Gdbw/V sDyqJj1Ss+JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCamxtTAAKCRCPgPtYfRL+ TgbSCACQrruUuvTzPOOsk6DvCyBLQQPFgEmfO5kpz5XExmK6u5rgNWHd4O7qfl+a2cDEI6O0DpK P3D51oYbvbrYg3gzNS267PHpN3It93WSK+p9pQR/YYx7uLuuSOJbmmzs+Efgvi0nCJmmCHiV7sD ziOKk3QafkCQzhOaa8irAdqDeCM6vf7FDejRBJXDfaSP0ULSDFmzCqKUA7QNieJJZm3h4JpmnIu 0Jzf3oktY7UTcLlbgIuIwCbrWXVjep8BZ5pHT04yUcvLUd6Pe/9Br7XqX2+7LPKp+3+NeKBNjnp jepL058EMKSshfURc4LkdMTNb1bYE/19pSUal41PIiLpYtSZ X-Developer-Key: i=ukleinek@kernel.org; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable At module load time a platform device is registered. That should be undone when the module is unloaded. Fixes: ec9f47cd6a14 ("[PATCH] Serial: Split 8250 port table") Signed-off-by: Uwe Kleine-K=C3=B6nig --- drivers/tty/serial/8250/8250.h | 2 ++ drivers/tty/serial/8250/8250_hub6.c | 5 +++++ drivers/tty/serial/8250/8250_platform.c | 5 ++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 39d72f1480c0..01fed8d44b7b 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -317,8 +317,10 @@ static inline void serial8250_pnp_exit(void) { } =20 #ifdef CONFIG_SERIAL_8250_HUB6 int serial8250_hub6_init(void); +void serial8250_hub6_exit(void); #else static inline int serial8250_hub6_init(void) { return 0; } +static inline void serial8250_hub6_exit(void) { } #endif =20 #ifdef CONFIG_SERIAL_8250_RSA diff --git a/drivers/tty/serial/8250/8250_hub6.c b/drivers/tty/serial/8250/= 8250_hub6.c index 3e548530ec4e..55320b794165 100644 --- a/drivers/tty/serial/8250/8250_hub6.c +++ b/drivers/tty/serial/8250/8250_hub6.c @@ -53,3 +53,8 @@ int __init serial8250_hub6_init(void) { return platform_device_register(&hub6_device); } + +int __init_or_module serial8250_hub6_exit(void) +{ + return platform_device_unregister(&hub6_device); +} diff --git a/drivers/tty/serial/8250/8250_platform.c b/drivers/tty/serial/8= 250/8250_platform.c index e8524d545de9..72076ccb5bde 100644 --- a/drivers/tty/serial/8250/8250_platform.c +++ b/drivers/tty/serial/8250/8250_platform.c @@ -326,7 +326,7 @@ static int __init serial8250_init(void) serial8250_isa_devs =3D platform_device_alloc("serial8250", PLAT8250_DEV_= LEGACY); if (!serial8250_isa_devs) { ret =3D -ENOMEM; - goto unreg_pnp; + goto unreg_hub6; } =20 ret =3D platform_device_add(serial8250_isa_devs); @@ -342,6 +342,8 @@ static int __init serial8250_init(void) platform_device_del(serial8250_isa_devs); put_dev: platform_device_put(serial8250_isa_devs); +unreg_hub6: + serial8250_hub6_exit(); unreg_pnp: serial8250_pnp_exit(); unreg_uart_drv: @@ -369,6 +371,7 @@ static void __exit serial8250_exit(void) platform_driver_unregister(&serial8250_isa_driver); platform_device_unregister(isa_dev); =20 + serial8250_hub6_exit(); serial8250_pnp_exit(); =20 #ifdef CONFIG_SPARC --=20 2.55.0.11.g153666a7d9bb From nobody Fri Oct 2 13:03:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F9243B9D8C; Fri, 31 Jul 2026 09:39:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490793; cv=none; b=XDxjKmo+epLv0OtJI/NaxzlT/xzNH6WE1GRESox9UcKUgxGH1xb5O3prN3QfB6ajRwdEIN/UdYqxb8CQPqFLOo04a1JTvft6T9pJhD594PiliCvSJVZ+JXgR9tvy5AyKMGYA+TMTwMVghv47IKHhfU1oqaPAEWRo9MdTdeD7Tlw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785490793; c=relaxed/simple; bh=xQ57vSGhfk+spwSnO7P+psnMJ//Su5Tt12ziizj7xNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RUmbbHwztb+39RVJr1mmQBZhmmmOSJ6ZZ831ZN2UUYWqXFnspAS3hmABhkQCf+XxmAnxjTC+y+a++KrQkU1DPN3wYT+3EMHAOcH1SUxQqE9xVwG7Lsb2v68xVVKt7kyE2PKBeS7qaR/IZ+dit6yP6wk2XoJYkGqwP91UVwv0H/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eOaw//U+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eOaw//U+" Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id C01991F000E9; Fri, 31 Jul 2026 09:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785490791; bh=dT/pxT080sVpjDaix5JB0lJEcHzpIeZgjHJASWqeng4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eOaw//U+R1dX9vodh5yPy0D/vD7hqUL19/CTjlY+gNyGVVrXDmTPjS5gwQkNgJbMg NSZtReRXy+KUISWau4tA8ST3Pk7LRLmLvPcffr7z/d8hDKkZOkneWbFDgIe4DdQrZM 3uFhqLPe1j5ClGOLU106u4E99ziPaqwr9nSZuzpD4PiJRsmKKU+PHGQ2zN33bcNEv4 V1mzWIKwKeHZ4zOMMA5MC+CUfT+yb1IP/SGCMcl9zl280UhRj2oajy3K9STqLZW5+M HMSJDxvQis+T/+KKWRm2chtvKFosC+1eQ1P1FLtO9pl6albuOWIOR4einJCOooE2cN 0eRTj4VQHEkAA== From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Greg Kroah-Hartman , Jiri Slaby Cc: Hugo Villeneuve , Rahul Bukte , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH v1 6/6] serial: 8250: pnp: Annotate init and exit functions for conditional discarding Date: Fri, 31 Jul 2026 11:39:09 +0200 Message-ID: <8db68a66238fec8be60620ff78e8e02b8f139c4f.1785489518.git.ukleinek@kernel.org> X-Mailer: git-send-email 2.55.0.11.g153666a7d9bb In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Developer-Signature: v=1; a=openpgp-sha256; l=1040; i=ukleinek@kernel.org; h=from:subject:message-id; bh=xQ57vSGhfk+spwSnO7P+psnMJ//Su5Tt12ziizj7xNo=; b=kA0DAAoBj4D7WH0S/k4ByyZiAGpsbU6hFkpnwCTs92laVg459iW95s9es3sY5J+q7A4vH4wQz 4kBMwQAAQoAHRYhBD+BrGk6eh5Zia3+04+A+1h9Ev5OBQJqbG1OAAoJEI+A+1h9Ev5OpyAH/1zE D94KegFZyP78iBFbhmX+EZkD40b4C0uMi9V0zJ6Bvq/BddvLGdADJ8irgitKt5xwdx34j0IBHUW TDz3RWq0o7M23ugErvpt3LSyJ6M4c89hweSgTH9uKOzRuQ/0XZwznA+P3NIpF1QsOSxfhEPuVUz DdSzOa2gP5LNyXMKdJ1yIaw+4xWjUWh9N1BJTw21uKMubWtdt+tng3OX0d3cBDP/44t1Oj6rzVJ JhsxbhDFSAcJjC+BuNGdQKPvc3ksVfF41Dugg4vNIElc0QXNyWOQlm/aaPrBIbCTHpBQFjBOFmf Wn0i9l5aDh0ZI3qmROKTXrXUTc/LUtsoQMa1bPo= X-Developer-Key: i=ukleinek@kernel.org; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: quoted-printable serial8250_pnp_init() is only called from serial8250_init() which is marked with __init, so the pnp init function can also get the same marking. serial8250_pnp_exit() is only called from __init and __exit code, so __init_or_module is appropriate for that. Signed-off-by: Uwe Kleine-K=C3=B6nig --- drivers/tty/serial/8250/8250_pnp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8= 250_pnp.c index b39f005f11cf..e142f4296062 100644 --- a/drivers/tty/serial/8250/8250_pnp.c +++ b/drivers/tty/serial/8250/8250_pnp.c @@ -526,12 +526,12 @@ static struct pnp_driver serial_pnp_driver =3D { .id_table =3D pnp_dev_table, }; =20 -int serial8250_pnp_init(void) +int __init serial8250_pnp_init(void) { return pnp_register_driver(&serial_pnp_driver); } =20 -void serial8250_pnp_exit(void) +void __init_or_module serial8250_pnp_exit(void) { pnp_unregister_driver(&serial_pnp_driver); } --=20 2.55.0.11.g153666a7d9bb