From: Artem Shimko Date: Tue, 4 Nov 2025 14:54:26 +0000 (+0300) Subject: serial: 8250_dw: fix runtime PM initialization sequence X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=485c13d9bc7a83532c038757c2f155728bb4bb38;p=thirdparty%2Fkernel%2Flinux.git serial: 8250_dw: fix runtime PM initialization sequence Move pm_runtime_set_active() call earlier in probe to simplify error handling and add proper error checking to ensure the device is marked as active before any runtime PM operations can occur. Additionally, replace the const struct dev_pm_ops declaration with _DEFINE_DEV_PM_OPS macro for better consistency with modern kernel PM patterns. Signed-off-by: Artem Shimko Link: https://patch.msgid.link/20251104145433.2316165-3-a.shimko.dev@gmail.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 0f8207652efe..db73b2ae17fa 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -643,6 +643,10 @@ static int dw8250_probe(struct platform_device *pdev) if (err) return err; + err = pm_runtime_set_active(dev); + if (err) + return dev_err_probe(dev, err, "Failed to set the runtime suspend as active\n"); + data->uart_16550_compatible = device_property_read_bool(dev, "snps,uart-16550-compatible"); data->pdata = device_get_match_data(p->dev); @@ -685,7 +689,6 @@ static int dw8250_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); - pm_runtime_set_active(dev); pm_runtime_enable(dev); return 0; @@ -757,10 +760,9 @@ static int dw8250_runtime_resume(struct device *dev) return 0; } -static const struct dev_pm_ops dw8250_pm_ops = { - SYSTEM_SLEEP_PM_OPS(dw8250_suspend, dw8250_resume) - RUNTIME_PM_OPS(dw8250_runtime_suspend, dw8250_runtime_resume, NULL) -}; +static _DEFINE_DEV_PM_OPS(dw8250_pm_ops, dw8250_suspend, dw8250_resume, + dw8250_runtime_suspend, dw8250_runtime_resume, + NULL); static const struct dw8250_platform_data dw8250_dw_apb = { .usr_reg = DW_UART_USR,