Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] tty: serial: mvebu-uart: use device_get_match_data()
@ 2026-10-26  7:46 Bramwel Barack
  2026-10-26  9:11 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Bramwel Barack @ 2026-10-26  7:46 UTC (permalink / raw)
  To: pali, gregkh, jirislaby; +Cc: linux-serial, linux-kernel, Bramwel Barack

Modernize the driver by replacing the legacy of_match_device() call
with the modern device_get_match_data() helper API. This cleans up
the boilerplate code by extracting the match driver data configuration
directly.

Consequently, drop the explicit inclusions of <linux/of_device.h> and
<linux/of_platform.h> as they are no longer required by the driver.

Signed-off-by: Bramwel Barack <bramwelbarack89@gmail.com>
---
 drivers/tty/serial/mvebu-uart.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
index 33ea496c93b2..adc2cf7ee65d 100644
--- a/drivers/tty/serial/mvebu-uart.c
+++ b/drivers/tty/serial/mvebu-uart.c
@@ -18,9 +18,7 @@
 #include <linux/math64.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
-#include <linux/of_device.h>
 #include <linux/of_irq.h>
-#include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/serial.h>
 #include <linux/serial_core.h>
@@ -866,8 +864,6 @@ static int uart_num_counter;
 
 static int mvebu_uart_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match = of_match_device(mvebu_uart_of_match,
-							   &pdev->dev);
 	struct uart_port *port;
 	struct mvebu_uart *mvuart;
 	struct resource *reg;
@@ -919,7 +915,7 @@ static int mvebu_uart_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	/* Get controller data depending on the compatible string */
-	mvuart->data = (struct mvebu_uart_driver_data *)match->data;
+	mvuart->data = (struct mvebu_uart_driver_data *)device_get_match_data(&pdev->dev);
 	mvuart->port = port;
 
 	port->private_data = mvuart;
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tty: serial: mvebu-uart: use device_get_match_data()
  2026-10-26  7:46 [PATCH] tty: serial: mvebu-uart: use device_get_match_data() Bramwel Barack
@ 2026-10-26  9:11 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-26  9:11 UTC (permalink / raw)
  To: Bramwel Barack; +Cc: linux-serial

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] tty: serial: mvebu-uart: unused mvebu_uart_of_match when !CONFIG_OF
--

commit 0c58839f587a9fd9238f4c8d5f0c179c6753ed36
Author: Bramwel Barack <bramwelbarack89@gmail.com>

tty: serial: mvebu-uart: use device_get_match_data()

This commit replaces the of_match_device() call in mvebu_uart_probe() with
device_get_match_data() and removes the <linux/of_device.h> and
<linux/of_platform.h> header includes.

> diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
> index 33ea496c93b29..adc2cf7ee65d1 100644
> --- a/drivers/tty/serial/mvebu-uart.c
> +++ b/drivers/tty/serial/mvebu-uart.c

[ ... ]

> @@ -866,8 +864,6 @@ static int uart_num_counter;
>  
>  static int mvebu_uart_probe(struct platform_device *pdev)
>  {
> -	const struct of_device_id *match = of_match_device(mvebu_uart_of_match,
> -							   &pdev->dev);
>  	struct uart_port *port;
>  	struct mvebu_uart *mvuart;
>  	struct resource *reg;
> @@ -919,7 +915,7 @@ static int mvebu_uart_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	/* Get controller data depending on the compatible string */
> -	mvuart->data = (struct mvebu_uart_driver_data *)match->data;
> +	mvuart->data = (struct mvebu_uart_driver_data *)device_get_match_data(&pdev->dev);

[Severity: Low]
Does removing of_match_device(mvebu_uart_of_match, &pdev->dev) in
mvebu_uart_probe() leave mvebu_uart_of_match unused when building with
compile test enabled and devicetree disabled?

Previously, passing mvebu_uart_of_match to the static inline stub
of_match_device() kept the table referenced when devicetree support was
disabled. Now the only remaining reference in mvebu_uart_platform_driver
is wrapped in of_match_ptr():

drivers/tty/serial/mvebu-uart.c:
    static const struct of_device_id mvebu_uart_of_match[] = {
        ...
    };

    static struct platform_driver mvebu_uart_platform_driver = {
        .probe	= mvebu_uart_probe,
        .driver	= {
            .name  = "mvebu-uart",
            .of_match_table = of_match_ptr(mvebu_uart_of_match),

When devicetree is disabled, of_match_ptr(mvebu_uart_of_match) expands to
null, causing an unused const variable warning on mvebu_uart_of_match. In
addition, the forward declaration above mvebu_uart_probe() is no longer
needed:

drivers/tty/serial/mvebu-uart.c:
    static const struct of_device_id mvebu_uart_of_match[];

Should the forward declaration of mvebu_uart_of_match be removed and
of_match_ptr() dropped from mvebu_uart_platform_driver (or __maybe_unused
added to mvebu_uart_of_match)?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261026074644.17464-1-bramwelbarack89@gmail.com?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-26  9:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-26  7:46 [PATCH] tty: serial: mvebu-uart: use device_get_match_data() Bramwel Barack
2026-10-26  9:11 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox