summaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2024-08-12 17:47:08 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-14 08:22:50 +0200
commitcc04428b2e9ea60b620e5ad5412cfcb2f07f3cd6 (patch)
tree19948cb16a0c48bd10d8ed4e32ed5a621ce2f992 /drivers/tty
parentserial: 8250_platform: Switch to use platform_get_mem_or_io() (diff)
downloadlinux-cc04428b2e9ea60b620e5ad5412cfcb2f07f3cd6.tar.xz
linux-cc04428b2e9ea60b620e5ad5412cfcb2f07f3cd6.zip
serial: 8250_platform: Refactor serial8250_probe()
Make it clear that it supports two cases, pure platform device and ACPI. With this in mind, split serial8250_probe() to two functions and rename the ACPI case accordingly. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240812154901.1068407-7-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/8250/8250_platform.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/drivers/tty/serial/8250/8250_platform.c b/drivers/tty/serial/8250/8250_platform.c
index 5953ce5ea32a..2e7503718f79 100644
--- a/drivers/tty/serial/8250/8250_platform.c
+++ b/drivers/tty/serial/8250/8250_platform.c
@@ -105,7 +105,7 @@ void __init serial8250_isa_init_ports(void)
/*
* Generic 16550A platform devices
*/
-static int serial8250_platform_probe(struct platform_device *pdev)
+static int serial8250_probe_acpi(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct uart_8250_port uart = { };
@@ -157,25 +157,11 @@ static int serial8250_platform_probe(struct platform_device *pdev)
return 0;
}
-/*
- * Register a set of serial devices attached to a platform device. The
- * list is terminated with a zero flags entry, which means we expect
- * all entries to have at least UPF_BOOT_AUTOCONF set.
- */
-static int serial8250_probe(struct platform_device *dev)
+static int serial8250_probe_platform(struct platform_device *dev, struct plat_serial8250_port *p)
{
- struct plat_serial8250_port *p = dev_get_platdata(&dev->dev);
struct uart_8250_port uart;
int ret, i, irqflag = 0;
- /*
- * Probe platform UART devices defined using standard hardware
- * discovery mechanism like ACPI or DT. Support only ACPI based
- * serial device for now.
- */
- if (!p && has_acpi_companion(&dev->dev))
- return serial8250_platform_probe(dev);
-
memset(&uart, 0, sizeof(uart));
if (share_irqs)
@@ -221,6 +207,31 @@ static int serial8250_probe(struct platform_device *dev)
}
/*
+ * Register a set of serial devices attached to a platform device. The
+ * list is terminated with a zero flags entry, which means we expect
+ * all entries to have at least UPF_BOOT_AUTOCONF set.
+ */
+static int serial8250_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct plat_serial8250_port *p;
+
+ p = dev_get_platdata(dev);
+ if (p)
+ return serial8250_probe_platform(pdev, p);
+
+ /*
+ * Probe platform UART devices defined using standard hardware
+ * discovery mechanism like ACPI or DT. Support only ACPI based
+ * serial device for now.
+ */
+ if (has_acpi_companion(dev))
+ return serial8250_probe_acpi(pdev);
+
+ return 0;
+}
+
+/*
* Remove serial ports registered against a platform device.
*/
static void serial8250_remove(struct platform_device *dev)