mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 18:56:24 +00:00
serial: Make uart_remove_one_port() return void
The return value is only ever used as a return value for remove callbacks of platform drivers. This return value is ignored by the driver core. (The only effect is an error message, but uart_remove_one_port() already emitted one in this case.) So the return value isn't used at all and uart_remove_one_port() can be changed to return void without any loss. Also this better matches the Linux device model as remove functions are not supposed to fail. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230512173810.131447-3-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6bd6cd29c9
commit
d5b3d02d0b
@ -3006,14 +3006,13 @@ static int atmel_serial_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct uart_port *port = platform_get_drvdata(pdev);
|
||||
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
|
||||
int ret = 0;
|
||||
|
||||
tasklet_kill(&atmel_port->tasklet_rx);
|
||||
tasklet_kill(&atmel_port->tasklet_tx);
|
||||
|
||||
device_init_wakeup(&pdev->dev, 0);
|
||||
|
||||
ret = uart_remove_one_port(&atmel_uart, port);
|
||||
uart_remove_one_port(&atmel_uart, port);
|
||||
|
||||
kfree(atmel_port->rx_ring.buf);
|
||||
|
||||
@ -3023,7 +3022,7 @@ static int atmel_serial_remove(struct platform_device *pdev)
|
||||
|
||||
pdev->dev.of_node = NULL;
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(atmel_serial_pm_ops, atmel_serial_suspend,
|
||||
|
@ -514,7 +514,9 @@ static int uart_clps711x_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct clps711x_port *s = platform_get_drvdata(pdev);
|
||||
|
||||
return uart_remove_one_port(&clps711x_uart, &s->port);
|
||||
uart_remove_one_port(&clps711x_uart, &s->port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id __maybe_unused clps711x_uart_dt_ids[] = {
|
||||
|
@ -1431,7 +1431,10 @@ static int cpm_uart_probe(struct platform_device *ofdev)
|
||||
static int cpm_uart_remove(struct platform_device *ofdev)
|
||||
{
|
||||
struct uart_cpm_port *pinfo = platform_get_drvdata(ofdev);
|
||||
return uart_remove_one_port(&cpm_reg, &pinfo->port);
|
||||
|
||||
uart_remove_one_port(&cpm_reg, &pinfo->port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id cpm_uart_match[] = {
|
||||
|
@ -2467,7 +2467,9 @@ static int imx_uart_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct imx_port *sport = platform_get_drvdata(pdev);
|
||||
|
||||
return uart_remove_one_port(&imx_uart_uart_driver, &sport->port);
|
||||
uart_remove_one_port(&imx_uart_uart_driver, &sport->port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void imx_uart_restore_context(struct imx_port *sport)
|
||||
|
@ -889,7 +889,9 @@ static int lqasc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct uart_port *port = platform_get_drvdata(pdev);
|
||||
|
||||
return uart_remove_one_port(&lqasc_reg, port);
|
||||
uart_remove_one_port(&lqasc_reg, port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ltq_soc_data soc_data_lantiq = {
|
||||
|
@ -3154,13 +3154,12 @@ EXPORT_SYMBOL(uart_add_one_port);
|
||||
* This unhooks (and hangs up) the specified port structure from the core
|
||||
* driver. No further calls will be made to the low-level code for this port.
|
||||
*/
|
||||
int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
|
||||
void uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
|
||||
{
|
||||
struct uart_state *state = drv->state + uport->line;
|
||||
struct tty_port *port = &state->port;
|
||||
struct uart_port *uart_port;
|
||||
struct tty_struct *tty;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&port_mutex);
|
||||
|
||||
@ -3176,7 +3175,6 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
|
||||
|
||||
if (!uart_port) {
|
||||
mutex_unlock(&port->mutex);
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
uport->flags |= UPF_DEAD;
|
||||
@ -3219,8 +3217,6 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *uport)
|
||||
mutex_unlock(&port->mutex);
|
||||
out:
|
||||
mutex_unlock(&port_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(uart_remove_one_port);
|
||||
|
||||
|
@ -796,7 +796,9 @@ static int asc_serial_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct uart_port *port = platform_get_drvdata(pdev);
|
||||
|
||||
return uart_remove_one_port(&asc_uart_driver, port);
|
||||
uart_remove_one_port(&asc_uart_driver, port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
@ -685,18 +685,15 @@ static int ulite_assign(struct device *dev, int id, phys_addr_t base, int irq,
|
||||
*
|
||||
* @dev: pointer to device structure
|
||||
*/
|
||||
static int ulite_release(struct device *dev)
|
||||
static void ulite_release(struct device *dev)
|
||||
{
|
||||
struct uart_port *port = dev_get_drvdata(dev);
|
||||
int rc = 0;
|
||||
|
||||
if (port) {
|
||||
rc = uart_remove_one_port(&ulite_uart_driver, port);
|
||||
uart_remove_one_port(&ulite_uart_driver, port);
|
||||
dev_set_drvdata(dev, NULL);
|
||||
port->mapbase = 0;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -900,14 +897,13 @@ static int ulite_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct uart_port *port = dev_get_drvdata(&pdev->dev);
|
||||
struct uartlite_data *pdata = port->private_data;
|
||||
int rc;
|
||||
|
||||
clk_disable_unprepare(pdata->clk);
|
||||
rc = ulite_release(&pdev->dev);
|
||||
ulite_release(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
pm_runtime_set_suspended(&pdev->dev);
|
||||
pm_runtime_dont_use_autosuspend(&pdev->dev);
|
||||
return rc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* work with hotplug and coldplug */
|
||||
|
@ -1670,14 +1670,13 @@ static int cdns_uart_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct uart_port *port = platform_get_drvdata(pdev);
|
||||
struct cdns_uart *cdns_uart_data = port->private_data;
|
||||
int rc;
|
||||
|
||||
/* Remove the cdns_uart port from the serial core */
|
||||
#ifdef CONFIG_COMMON_CLK
|
||||
clk_notifier_unregister(cdns_uart_data->uartclk,
|
||||
&cdns_uart_data->clk_rate_change_nb);
|
||||
#endif
|
||||
rc = uart_remove_one_port(cdns_uart_data->cdns_uart_driver, port);
|
||||
uart_remove_one_port(cdns_uart_data->cdns_uart_driver, port);
|
||||
port->mapbase = 0;
|
||||
clk_disable_unprepare(cdns_uart_data->uartclk);
|
||||
clk_disable_unprepare(cdns_uart_data->pclk);
|
||||
@ -1693,7 +1692,7 @@ static int cdns_uart_remove(struct platform_device *pdev)
|
||||
|
||||
if (!--instances)
|
||||
uart_unregister_driver(cdns_uart_data->cdns_uart_driver);
|
||||
return rc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver cdns_uart_platform_driver = {
|
||||
|
@ -853,7 +853,7 @@ void uart_console_write(struct uart_port *port, const char *s,
|
||||
int uart_register_driver(struct uart_driver *uart);
|
||||
void uart_unregister_driver(struct uart_driver *uart);
|
||||
int uart_add_one_port(struct uart_driver *reg, struct uart_port *port);
|
||||
int uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
|
||||
void uart_remove_one_port(struct uart_driver *reg, struct uart_port *port);
|
||||
bool uart_match_port(const struct uart_port *port1,
|
||||
const struct uart_port *port2);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user