Skip to content

Commit 239f112

Browse files
claudiubezneagregkh
authored andcommitted
serial: sh-sci: Move runtime PM enable to sci_probe_single()
Relocate the runtime PM enable operation to sci_probe_single(). This change prepares the codebase for upcoming fixes. While at it, replace the existing logic with a direct call to devm_pm_runtime_enable() and remove sci_cleanup_single(). The devm_pm_runtime_enable() function automatically handles disabling runtime PM during driver removal. Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Claudiu Beznea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent eaeee42 commit 239f112

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

drivers/tty/serial/sh-sci.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,10 +3056,6 @@ static int sci_init_single(struct platform_device *dev,
30563056
ret = sci_init_clocks(sci_port, &dev->dev);
30573057
if (ret < 0)
30583058
return ret;
3059-
3060-
port->dev = &dev->dev;
3061-
3062-
pm_runtime_enable(&dev->dev);
30633059
}
30643060

30653061
port->type = p->type;
@@ -3086,11 +3082,6 @@ static int sci_init_single(struct platform_device *dev,
30863082
return 0;
30873083
}
30883084

3089-
static void sci_cleanup_single(struct sci_port *port)
3090-
{
3091-
pm_runtime_disable(port->port.dev);
3092-
}
3093-
30943085
#if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) || \
30953086
defined(CONFIG_SERIAL_SH_SCI_EARLYCON)
30963087
static void serial_console_putchar(struct uart_port *port, unsigned char ch)
@@ -3260,8 +3251,6 @@ static void sci_remove(struct platform_device *dev)
32603251
sci_ports_in_use &= ~BIT(port->port.line);
32613252
uart_remove_one_port(&sci_uart_driver, &port->port);
32623253

3263-
sci_cleanup_single(port);
3264-
32653254
if (port->port.fifosize > 1)
32663255
device_remove_file(&dev->dev, &dev_attr_rx_fifo_trigger);
32673256
if (type == PORT_SCIFA || type == PORT_SCIFB || type == PORT_HSCIF)
@@ -3425,6 +3414,11 @@ static int sci_probe_single(struct platform_device *dev,
34253414
if (ret)
34263415
return ret;
34273416

3417+
sciport->port.dev = &dev->dev;
3418+
ret = devm_pm_runtime_enable(&dev->dev);
3419+
if (ret)
3420+
return ret;
3421+
34283422
sciport->gpios = mctrl_gpio_init(&sciport->port, 0);
34293423
if (IS_ERR(sciport->gpios))
34303424
return PTR_ERR(sciport->gpios);
@@ -3438,13 +3432,7 @@ static int sci_probe_single(struct platform_device *dev,
34383432
sciport->port.flags |= UPF_HARD_FLOW;
34393433
}
34403434

3441-
ret = uart_add_one_port(&sci_uart_driver, &sciport->port);
3442-
if (ret) {
3443-
sci_cleanup_single(sciport);
3444-
return ret;
3445-
}
3446-
3447-
return 0;
3435+
return uart_add_one_port(&sci_uart_driver, &sciport->port);
34483436
}
34493437

34503438
static int sci_probe(struct platform_device *dev)

0 commit comments

Comments
 (0)