tty: serial: simplify getting .drvdata
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 19 Apr 2018 14:06:23 +0000 (16:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Apr 2018 15:29:43 +0000 (17:29 +0200)
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/imx.c
drivers/tty/serial/qcom_geni_serial.c
drivers/tty/serial/st-asc.c
drivers/tty/serial/xilinx_uartps.c

index 91f3a1a..f370c1c 100644 (file)
@@ -2408,8 +2408,7 @@ static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)
 
 static int imx_uart_suspend_noirq(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct imx_port *sport = platform_get_drvdata(pdev);
+       struct imx_port *sport = dev_get_drvdata(dev);
 
        imx_uart_save_context(sport);
 
@@ -2420,8 +2419,7 @@ static int imx_uart_suspend_noirq(struct device *dev)
 
 static int imx_uart_resume_noirq(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct imx_port *sport = platform_get_drvdata(pdev);
+       struct imx_port *sport = dev_get_drvdata(dev);
        int ret;
 
        ret = clk_enable(sport->clk_ipg);
@@ -2435,8 +2433,7 @@ static int imx_uart_resume_noirq(struct device *dev)
 
 static int imx_uart_suspend(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct imx_port *sport = platform_get_drvdata(pdev);
+       struct imx_port *sport = dev_get_drvdata(dev);
        int ret;
 
        uart_suspend_port(&imx_uart_uart_driver, &sport->port);
@@ -2454,8 +2451,7 @@ static int imx_uart_suspend(struct device *dev)
 
 static int imx_uart_resume(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct imx_port *sport = platform_get_drvdata(pdev);
+       struct imx_port *sport = dev_get_drvdata(dev);
 
        /* disable wakeup from i.MX UART */
        imx_uart_enable_wakeup(sport, false);
@@ -2470,8 +2466,7 @@ static int imx_uart_resume(struct device *dev)
 
 static int imx_uart_freeze(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct imx_port *sport = platform_get_drvdata(pdev);
+       struct imx_port *sport = dev_get_drvdata(dev);
 
        uart_suspend_port(&imx_uart_uart_driver, &sport->port);
 
@@ -2480,8 +2475,7 @@ static int imx_uart_freeze(struct device *dev)
 
 static int imx_uart_thaw(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct imx_port *sport = platform_get_drvdata(pdev);
+       struct imx_port *sport = dev_get_drvdata(dev);
 
        uart_resume_port(&imx_uart_uart_driver, &sport->port);
 
index 65ff669..66558d4 100644 (file)
@@ -1085,8 +1085,7 @@ static int qcom_geni_serial_remove(struct platform_device *pdev)
 
 static int __maybe_unused qcom_geni_serial_sys_suspend_noirq(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct qcom_geni_serial_port *port = platform_get_drvdata(pdev);
+       struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
        struct uart_port *uport = &port->uport;
 
        uart_suspend_port(uport->private_data, uport);
@@ -1095,8 +1094,7 @@ static int __maybe_unused qcom_geni_serial_sys_suspend_noirq(struct device *dev)
 
 static int __maybe_unused qcom_geni_serial_sys_resume_noirq(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct qcom_geni_serial_port *port = platform_get_drvdata(pdev);
+       struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
        struct uart_port *uport = &port->uport;
 
        if (console_suspend_enabled && uport->suspended) {
index 5f9f01f..7971997 100644 (file)
@@ -842,16 +842,14 @@ static int asc_serial_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int asc_serial_suspend(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct uart_port *port = platform_get_drvdata(pdev);
+       struct uart_port *port = dev_get_drvdata(dev);
 
        return uart_suspend_port(&asc_uart_driver, port);
 }
 
 static int asc_serial_resume(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct uart_port *port = platform_get_drvdata(pdev);
+       struct uart_port *port = dev_get_drvdata(dev);
 
        return uart_resume_port(&asc_uart_driver, port);
 }
index abcb4d0..3ec4efb 100644 (file)
@@ -1430,8 +1430,7 @@ static int cdns_uart_resume(struct device *device)
 #endif /* ! CONFIG_PM_SLEEP */
 static int __maybe_unused cdns_runtime_suspend(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct uart_port *port = platform_get_drvdata(pdev);
+       struct uart_port *port = dev_get_drvdata(dev);
        struct cdns_uart *cdns_uart = port->private_data;
 
        clk_disable(cdns_uart->uartclk);
@@ -1441,8 +1440,7 @@ static int __maybe_unused cdns_runtime_suspend(struct device *dev)
 
 static int __maybe_unused cdns_runtime_resume(struct device *dev)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct uart_port *port = platform_get_drvdata(pdev);
+       struct uart_port *port = dev_get_drvdata(dev);
        struct cdns_uart *cdns_uart = port->private_data;
 
        clk_enable(cdns_uart->pclk);