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 <a.shimko.dev@gmail.com> Link: https://patch.msgid.link/20251104145433.2316165-3-a.shimko.dev@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>master
parent
d31228143a
commit
485c13d9bc
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue