Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: esp32_uart: Use device_get_match_data()

Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Error checking for matching was not necessary as matching is always
successful if we're already in probe and the match tables always have data
pointers.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231207162632.2650356-2-robh@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rob Herring and committed by
Greg Kroah-Hartman
3d19ff56 2600d993

+3 -7
+3 -7
drivers/tty/serial/esp32_uart.c
··· 9 9 #include <linux/irq.h> 10 10 #include <linux/module.h> 11 11 #include <linux/of.h> 12 - #include <linux/of_device.h> 12 + #include <linux/platform_device.h> 13 + #include <linux/property.h> 13 14 #include <linux/serial_core.h> 14 15 #include <linux/slab.h> 15 16 #include <linux/tty_flip.h> ··· 679 678 static int esp32_uart_probe(struct platform_device *pdev) 680 679 { 681 680 struct device_node *np = pdev->dev.of_node; 682 - static const struct of_device_id *match; 683 681 struct uart_port *port; 684 682 struct esp32_port *sport; 685 683 struct resource *res; 686 684 int ret; 687 - 688 - match = of_match_device(esp32_uart_dt_ids, &pdev->dev); 689 - if (!match) 690 - return -ENODEV; 691 685 692 686 sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); 693 687 if (!sport) ··· 724 728 port->flags = UPF_BOOT_AUTOCONF; 725 729 port->has_sysrq = 1; 726 730 port->fifosize = ESP32_UART_TX_FIFO_SIZE; 727 - port->private_data = (void *)match->data; 731 + port->private_data = (void *)device_get_match_data(&pdev->dev); 728 732 729 733 esp32_uart_ports[port->line] = sport; 730 734