Skip to content

Commit 43b829b

Browse files
Jingoo Hangregkh
authored andcommitted
serial: remove unnecessary platform_set_drvdata()
The driver core clears the driver data to NULL after device_release or on probe failure, since commit 0998d06 (device-core: Ensure drvdata = NULL when no driver is bound). Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <[email protected]> Acked-by: Barry Song <[email protected]> Acked-by: Tony Prisk <[email protected]> Acked-by: Shawn Guo <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 74b3b4c commit 43b829b

File tree

14 files changed

+3
-31
lines changed

14 files changed

+3
-31
lines changed

drivers/tty/serial/ar933x_uart.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,6 @@ static int ar933x_uart_remove(struct platform_device *pdev)
703703
struct ar933x_uart_port *up;
704704

705705
up = platform_get_drvdata(pdev);
706-
platform_set_drvdata(pdev, NULL);
707706

708707
if (up) {
709708
uart_remove_one_port(&ar933x_uart_driver, &up->port);

drivers/tty/serial/atmel_serial.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,6 @@ static int atmel_serial_remove(struct platform_device *pdev)
18601860
int ret = 0;
18611861

18621862
device_init_wakeup(&pdev->dev, 0);
1863-
platform_set_drvdata(pdev, NULL);
18641863

18651864
ret = uart_remove_one_port(&atmel_uart, port);
18661865

drivers/tty/serial/bcm63xx_uart.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,6 @@ static int bcm_uart_remove(struct platform_device *pdev)
852852

853853
port = platform_get_drvdata(pdev);
854854
uart_remove_one_port(&bcm_uart_driver, port);
855-
platform_set_drvdata(pdev, NULL);
856855
/* mark port as free */
857856
ports[pdev->id].membase = 0;
858857
return 0;

drivers/tty/serial/clps711x.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,7 @@ static int uart_clps711x_probe(struct platform_device *pdev)
438438
s->uart_clk = devm_clk_get(&pdev->dev, "uart");
439439
if (IS_ERR(s->uart_clk)) {
440440
dev_err(&pdev->dev, "Can't get UART clocks\n");
441-
ret = PTR_ERR(s->uart_clk);
442-
goto err_out;
441+
return PTR_ERR(s->uart_clk);
443442
}
444443

445444
s->uart.owner = THIS_MODULE;
@@ -461,7 +460,7 @@ static int uart_clps711x_probe(struct platform_device *pdev)
461460
if (ret) {
462461
dev_err(&pdev->dev, "Registering UART driver failed\n");
463462
devm_clk_put(&pdev->dev, s->uart_clk);
464-
goto err_out;
463+
return ret;
465464
}
466465

467466
for (i = 0; i < UART_CLPS711X_NR; i++) {
@@ -478,11 +477,6 @@ static int uart_clps711x_probe(struct platform_device *pdev)
478477
}
479478

480479
return 0;
481-
482-
err_out:
483-
platform_set_drvdata(pdev, NULL);
484-
485-
return ret;
486480
}
487481

488482
static int uart_clps711x_remove(struct platform_device *pdev)
@@ -495,7 +489,6 @@ static int uart_clps711x_remove(struct platform_device *pdev)
495489

496490
devm_clk_put(&pdev->dev, s->uart_clk);
497491
uart_unregister_driver(&s->uart);
498-
platform_set_drvdata(pdev, NULL);
499492

500493
return 0;
501494
}

drivers/tty/serial/efm32-uart.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,6 @@ static int efm32_uart_remove(struct platform_device *pdev)
778778
{
779779
struct efm32_uart_port *efm_port = platform_get_drvdata(pdev);
780780

781-
platform_set_drvdata(pdev, NULL);
782-
783781
uart_remove_one_port(&efm32_uart_reg, &efm_port->port);
784782

785783
if (pdev->id >= 0 && pdev->id < ARRAY_SIZE(efm32_uart_ports))

drivers/tty/serial/imx.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,8 +1596,6 @@ static int serial_imx_remove(struct platform_device *pdev)
15961596

15971597
pdata = pdev->dev.platform_data;
15981598

1599-
platform_set_drvdata(pdev, NULL);
1600-
16011599
uart_remove_one_port(&imx_reg, &sport->port);
16021600

16031601
if (pdata && pdata->exit)

drivers/tty/serial/netx-serial.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,6 @@ static int serial_netx_remove(struct platform_device *pdev)
693693
{
694694
struct netx_port *sport = platform_get_drvdata(pdev);
695695

696-
platform_set_drvdata(pdev, NULL);
697-
698696
if (sport)
699697
uart_remove_one_port(&netx_reg, &sport->port);
700698

drivers/tty/serial/pmac_zilog.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,6 @@ static int __exit pmz_detach(struct platform_device *pdev)
17981798

17991799
uart_remove_one_port(&pmz_uart_reg, &uap->port);
18001800

1801-
platform_set_drvdata(pdev, NULL);
18021801
uap->port.dev = NULL;
18031802

18041803
return 0;

drivers/tty/serial/pnx8xxx_uart.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,8 +801,6 @@ static int pnx8xxx_serial_remove(struct platform_device *pdev)
801801
{
802802
struct pnx8xxx_port *sport = platform_get_drvdata(pdev);
803803

804-
platform_set_drvdata(pdev, NULL);
805-
806804
if (sport)
807805
uart_remove_one_port(&pnx8xxx_reg, &sport->port);
808806

drivers/tty/serial/pxa.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,6 @@ static int serial_pxa_remove(struct platform_device *dev)
945945
{
946946
struct uart_pxa_port *sport = platform_get_drvdata(dev);
947947

948-
platform_set_drvdata(dev, NULL);
949-
950948
uart_remove_one_port(&serial_pxa_reg, &sport->port);
951949

952950
clk_unprepare(sport->clk);

drivers/tty/serial/sa1100.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,6 @@ static int sa1100_serial_remove(struct platform_device *pdev)
864864
{
865865
struct sa1100_port *sport = platform_get_drvdata(pdev);
866866

867-
platform_set_drvdata(pdev, NULL);
868-
869867
if (sport)
870868
uart_remove_one_port(&sa1100_reg, &sport->port);
871869

drivers/tty/serial/sccnxp.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,6 @@ static int sccnxp_probe(struct platform_device *pdev)
997997
}
998998

999999
err_out:
1000-
platform_set_drvdata(pdev, NULL);
1001-
10021000
return ret;
10031001
}
10041002

@@ -1016,7 +1014,6 @@ static int sccnxp_remove(struct platform_device *pdev)
10161014
uart_remove_one_port(&s->uart, &s->port[i]);
10171015

10181016
uart_unregister_driver(&s->uart);
1019-
platform_set_drvdata(pdev, NULL);
10201017

10211018
if (!IS_ERR(s->regulator))
10221019
return regulator_disable(s->regulator);

drivers/tty/serial/sirfsoc_uart.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,6 @@ int sirfsoc_uart_probe(struct platform_device *pdev)
717717
clk_disable_unprepare(sirfport->clk);
718718
clk_put(sirfport->clk);
719719
clk_err:
720-
platform_set_drvdata(pdev, NULL);
721720
if (sirfport->hw_flow_ctrl)
722721
pinctrl_put(sirfport->p);
723722
err:
@@ -728,7 +727,7 @@ static int sirfsoc_uart_remove(struct platform_device *pdev)
728727
{
729728
struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev);
730729
struct uart_port *port = &sirfport->port;
731-
platform_set_drvdata(pdev, NULL);
730+
732731
if (sirfport->hw_flow_ctrl)
733732
pinctrl_put(sirfport->p);
734733
clk_disable_unprepare(sirfport->clk);

drivers/tty/serial/vt8500_serial.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,6 @@ static int vt8500_serial_remove(struct platform_device *pdev)
630630
{
631631
struct vt8500_port *vt8500_port = platform_get_drvdata(pdev);
632632

633-
platform_set_drvdata(pdev, NULL);
634633
clk_disable_unprepare(vt8500_port->clk);
635634
uart_remove_one_port(&vt8500_uart_driver, &vt8500_port->uart);
636635

0 commit comments

Comments
 (0)