Commit cc04428b authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240812154901.1068407-7-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4596d2bd
...@@ -105,7 +105,7 @@ void __init serial8250_isa_init_ports(void) ...@@ -105,7 +105,7 @@ void __init serial8250_isa_init_ports(void)
/* /*
* Generic 16550A platform devices * 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 device *dev = &pdev->dev;
struct uart_8250_port uart = { }; struct uart_8250_port uart = { };
...@@ -157,25 +157,11 @@ static int serial8250_platform_probe(struct platform_device *pdev) ...@@ -157,25 +157,11 @@ static int serial8250_platform_probe(struct platform_device *pdev)
return 0; return 0;
} }
/* static int serial8250_probe_platform(struct platform_device *dev, struct plat_serial8250_port *p)
* 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)
{ {
struct plat_serial8250_port *p = dev_get_platdata(&dev->dev);
struct uart_8250_port uart; struct uart_8250_port uart;
int ret, i, irqflag = 0; 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)); memset(&uart, 0, sizeof(uart));
if (share_irqs) if (share_irqs)
...@@ -220,6 +206,31 @@ static int serial8250_probe(struct platform_device *dev) ...@@ -220,6 +206,31 @@ static int serial8250_probe(struct platform_device *dev)
return 0; 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 *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. * Remove serial ports registered against a platform device.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment