From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387555; b=vjuNxCtY4ls8ma5ss/oY2iIKVHxxfmx9skHtdDVzKgxaWfHfoenYj7g3FyH4KDUaPn+8 V1h1Po1yIqZLfmi40uhRJ/ZZoDr/CvY8Z+0Fk/lngmfRcjBlfMyNXtZD4QY/5pzWpz5oh 8GWoQ1lX/hQeuxDF59a2THpapD1BBDX9lvsPVtZdzCipidsWvUPmLOChT4JFn2DfNmXWW NrbLGl2KjYu0Hkg9bu8788RHahpYeKbK1h7dfoYuHfMv4872ZHKOPBq3XUJju7H9eHwEv FpmilNhuljMMrMs9clwNoMbHGGez5cuRjxbTDnnB2XKjWxRdkMdYr3qYRHvjdamU8YQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387555; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=J54ktf7T1NNqCfRpSaCWfQXTFZtkGW3rsJXxDCGBTtw=; b=lKVr9JbOYJtD0IYavZzUtAyZiQkCaTTXSnTYEfG4QIUasBH+2PPOdYaSQNv1UXlHq455 jjMd6eVgiK8AQdRSiR8BNEuwc3IZMXrMFVPPdZpCyfUm3lYVwdP3Hhc0FLqG1q8FlmSaq 7sHxCXGNG1tm4wPvGvlI1kCbc/AYPQnxAmkDhoXQAp65MvfhmnpIqnD58A6pRr7gzdD4k M2q5oC9HjSU6a976Eq/L6jvYKsm0r/9+fcBg4ZazmJ1TefF5h6CoNOaLCa5DADFvc+WyR ysyGGddFMBW7h+L7X5qJGnsLY7sGdFgfRjPw8Qo51MH46x93Tb8veqLdGwm3dXbwrzA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=cp9nrcrg; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 44D1D606A322; Fri, 4 Dec 2026 12:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=cp9nrcrg Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD95B1F000CE; Fri, 4 Dec 2026 12:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387555; bh=J54ktf7T1NNqCfRpSaCWfQXTFZtkGW3rsJXxDCGBTtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cp9nrcrgsri5CYe0pMcTQqxUjGlNBg8Wlct1OtP5992VBgc1yP5vrMVWTbHgKEcDR CdZPcBeS4Ue6quxH8qM4hNQdzm6XNOhRWVTvhi9wJh3eF6MqxWmgDnOJ0Fj622wbmX dKcv/OcB6LquIqFa8GidBYGPIEU2bYDv9t5WzQaE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Atsushi Nemoto , Geert Uytterhoeven , Andy Shevchenko , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20 ?= , Sasha Levin Subject: [PATCH 6.1 0294/1059] serial: txx9: Drop noop probe function and dangerous remove callback Date: Fri, 4 Dec 2026 18:57:05 +0900 Message-ID: <20261204100651.893953419@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Uwe Kleine-König (The Capable Hub) [ Upstream commit 22c6a6ac74c2434735638e7ef1101597ae263aec ] 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 == &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") Reviewed-by: Atsushi Nemoto Tested-by: Geert Uytterhoeven Acked-by: Andy Shevchenko Signed-off-by: Uwe Kleine-König (The Capable Hub) Link: https://patch.msgid.link/cd4fce2cef14907ebe4713c147f8896924380e44.1786697789.git.u.kleine-koenig@baylibre.com Signed-off-by: Greg Kroah-Hartman [ sashal: Changed the removed platform driver's remove function from void to int return type (with return 0;) to match the older base; the rest is identical apart from context offsets. ] Signed-off-by: Sasha Levin --- drivers/tty/serial/serial_txx9.c | 56 ++------------------------------ 1 file changed, 3 insertions(+), 53 deletions(-) diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c index e12f1dc18c38b..5f71333bb2dd5 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c @@ -1031,7 +1031,8 @@ static void serial_txx9_unregister_port(int line) struct uart_port *uart = &serial_txx9_ports[line]; mutex_lock(&serial_txx9_mutex); - uart_remove_one_port(&serial_txx9_reg, uart); + if (uart->iobase || uart->mapbase) + uart_remove_one_port(&serial_txx9_reg, uart); uart->flags = 0; uart->type = PORT_UNKNOWN; uart->iobase = 0; @@ -1041,53 +1042,6 @@ static void serial_txx9_unregister_port(int line) mutex_unlock(&serial_txx9_mutex); } -/* - * Register a set of serial devices attached to a platform device. - */ -static int serial_txx9_probe(struct platform_device *dev) -{ - struct uart_port *p = dev_get_platdata(&dev->dev); - struct uart_port port; - int ret, i; - - memset(&port, 0, sizeof(struct uart_port)); - for (i = 0; p && p->uartclk != 0; p++, i++) { - port.iobase = p->iobase; - port.membase = p->membase; - port.irq = p->irq; - port.uartclk = p->uartclk; - port.iotype = p->iotype; - port.flags = p->flags; - port.mapbase = p->mapbase; - port.dev = &dev->dev; - port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_TXX9_CONSOLE); - ret = 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 int serial_txx9_remove(struct platform_device *dev) -{ - int i; - - for (i = 0; i < UART_NR; i++) { - struct uart_port *up = &serial_txx9_ports[i]; - - if (up->dev == &dev->dev) - serial_txx9_unregister_port(i); - } - return 0; -} - #ifdef CONFIG_PM static int serial_txx9_suspend(struct platform_device *dev, pm_message_t state) { @@ -1119,8 +1073,6 @@ static int serial_txx9_resume(struct platform_device *dev) #endif static struct platform_driver serial_txx9_plat_driver = { - .probe = serial_txx9_probe, - .remove = serial_txx9_remove, #ifdef CONFIG_PM .suspend = serial_txx9_suspend, .resume = serial_txx9_resume, @@ -1274,9 +1226,7 @@ static void __exit serial_txx9_exit(void) platform_driver_unregister(&serial_txx9_plat_driver); platform_device_unregister(serial_txx9_plat_devs); for (i = 0; i < UART_NR; i++) { - struct uart_port *up = &serial_txx9_ports[i]; - if (up->iobase || up->mapbase) - uart_remove_one_port(&serial_txx9_reg, up); + serial_txx9_unregister_port(i); } uart_unregister_driver(&serial_txx9_reg); -- 2.53.0