Commit 793218dfea146946a076f4fe51e574db61034a3e

Authored by Grant Likely
1 parent d35fb64176

dt/serial: Eliminate users of of_platform_{,un}register_driver

Get rid of users of of_platform_driver in drivers/serial.  The
of_platform_{,un}register_driver functions are going away, so the
users need to be converted to using the platform_bus_type directly.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>

Showing 9 changed files with 42 additions and 46 deletions Side-by-side Diff

drivers/tty/serial/apbuart.c
... ... @@ -553,8 +553,7 @@
553 553 /* OF Platform Driver */
554 554 /* ======================================================================== */
555 555  
556   -static int __devinit apbuart_probe(struct platform_device *op,
557   - const struct of_device_id *match)
  556 +static int __devinit apbuart_probe(struct platform_device *op)
558 557 {
559 558 int i = -1;
560 559 struct uart_port *port = NULL;
... ... @@ -587,7 +586,7 @@
587 586 {},
588 587 };
589 588  
590   -static struct of_platform_driver grlib_apbuart_of_driver = {
  589 +static struct platform_driver grlib_apbuart_of_driver = {
591 590 .probe = apbuart_probe,
592 591 .driver = {
593 592 .owner = THIS_MODULE,
594 593  
... ... @@ -676,10 +675,10 @@
676 675 return ret;
677 676 }
678 677  
679   - ret = of_register_platform_driver(&grlib_apbuart_of_driver);
  678 + ret = platform_driver_register(&grlib_apbuart_of_driver);
680 679 if (ret) {
681 680 printk(KERN_ERR
682   - "%s: of_register_platform_driver failed (%i)\n",
  681 + "%s: platform_driver_register failed (%i)\n",
683 682 __FILE__, ret);
684 683 uart_unregister_driver(&grlib_apbuart_driver);
685 684 return ret;
... ... @@ -697,7 +696,7 @@
697 696 &grlib_apbuart_ports[i]);
698 697  
699 698 uart_unregister_driver(&grlib_apbuart_driver);
700   - of_unregister_platform_driver(&grlib_apbuart_of_driver);
  699 + platform_driver_unregister(&grlib_apbuart_of_driver);
701 700 }
702 701  
703 702 module_init(grlib_apbuart_init);
drivers/tty/serial/cpm_uart/cpm_uart_core.c
... ... @@ -1359,8 +1359,7 @@
1359 1359  
1360 1360 static int probe_index;
1361 1361  
1362   -static int __devinit cpm_uart_probe(struct platform_device *ofdev,
1363   - const struct of_device_id *match)
  1362 +static int __devinit cpm_uart_probe(struct platform_device *ofdev)
1364 1363 {
1365 1364 int index = probe_index++;
1366 1365 struct uart_cpm_port *pinfo = &cpm_uart_ports[index];
... ... @@ -1405,7 +1404,7 @@
1405 1404 {}
1406 1405 };
1407 1406  
1408   -static struct of_platform_driver cpm_uart_driver = {
  1407 +static struct platform_driver cpm_uart_driver = {
1409 1408 .driver = {
1410 1409 .name = "cpm_uart",
1411 1410 .owner = THIS_MODULE,
... ... @@ -1421,7 +1420,7 @@
1421 1420 if (ret)
1422 1421 return ret;
1423 1422  
1424   - ret = of_register_platform_driver(&cpm_uart_driver);
  1423 + ret = platform_driver_register(&cpm_uart_driver);
1425 1424 if (ret)
1426 1425 uart_unregister_driver(&cpm_reg);
1427 1426  
... ... @@ -1430,7 +1429,7 @@
1430 1429  
1431 1430 static void __exit cpm_uart_exit(void)
1432 1431 {
1433   - of_unregister_platform_driver(&cpm_uart_driver);
  1432 + platform_driver_unregister(&cpm_uart_driver);
1434 1433 uart_unregister_driver(&cpm_reg);
1435 1434 }
1436 1435  
drivers/tty/serial/mpc52xx_uart.c
... ... @@ -1302,8 +1302,7 @@
1302 1302 {},
1303 1303 };
1304 1304  
1305   -static int __devinit
1306   -mpc52xx_uart_of_probe(struct platform_device *op, const struct of_device_id *match)
  1305 +static int __devinit mpc52xx_uart_of_probe(struct platform_device *op)
1307 1306 {
1308 1307 int idx = -1;
1309 1308 unsigned int uartclk;
... ... @@ -1311,8 +1310,6 @@
1311 1310 struct resource res;
1312 1311 int ret;
1313 1312  
1314   - dev_dbg(&op->dev, "mpc52xx_uart_probe(op=%p, match=%p)\n", op, match);
1315   -
1316 1313 /* Check validity & presence */
1317 1314 for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++)
1318 1315 if (mpc52xx_uart_nodes[idx] == op->dev.of_node)
... ... @@ -1453,7 +1450,7 @@
1453 1450  
1454 1451 MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match);
1455 1452  
1456   -static struct of_platform_driver mpc52xx_uart_of_driver = {
  1453 +static struct platform_driver mpc52xx_uart_of_driver = {
1457 1454 .probe = mpc52xx_uart_of_probe,
1458 1455 .remove = mpc52xx_uart_of_remove,
1459 1456 #ifdef CONFIG_PM
1460 1457  
... ... @@ -1497,9 +1494,9 @@
1497 1494 return ret;
1498 1495 }
1499 1496  
1500   - ret = of_register_platform_driver(&mpc52xx_uart_of_driver);
  1497 + ret = platform_driver_register(&mpc52xx_uart_of_driver);
1501 1498 if (ret) {
1502   - printk(KERN_ERR "%s: of_register_platform_driver failed (%i)\n",
  1499 + printk(KERN_ERR "%s: platform_driver_register failed (%i)\n",
1503 1500 __FILE__, ret);
1504 1501 uart_unregister_driver(&mpc52xx_uart_driver);
1505 1502 return ret;
... ... @@ -1514,7 +1511,7 @@
1514 1511 if (psc_ops->fifoc_uninit)
1515 1512 psc_ops->fifoc_uninit();
1516 1513  
1517   - of_unregister_platform_driver(&mpc52xx_uart_of_driver);
  1514 + platform_driver_unregister(&mpc52xx_uart_of_driver);
1518 1515 uart_unregister_driver(&mpc52xx_uart_driver);
1519 1516 }
1520 1517  
drivers/tty/serial/of_serial.c
... ... @@ -80,14 +80,16 @@
80 80 /*
81 81 * Try to register a serial port
82 82 */
83   -static int __devinit of_platform_serial_probe(struct platform_device *ofdev,
84   - const struct of_device_id *id)
  83 +static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
85 84 {
86 85 struct of_serial_info *info;
87 86 struct uart_port port;
88 87 int port_type;
89 88 int ret;
90 89  
  90 + if (!ofdev->dev.of_match)
  91 + return -EINVAL;
  92 +
91 93 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
92 94 return -EBUSY;
93 95  
... ... @@ -95,7 +97,7 @@
95 97 if (info == NULL)
96 98 return -ENOMEM;
97 99  
98   - port_type = (unsigned long)id->data;
  100 + port_type = (unsigned long)ofdev->dev.of_match->data;
99 101 ret = of_platform_serial_setup(ofdev, port_type, &port);
100 102 if (ret)
101 103 goto out;
... ... @@ -174,7 +176,7 @@
174 176 { /* end of list */ },
175 177 };
176 178  
177   -static struct of_platform_driver of_platform_serial_driver = {
  179 +static struct platform_driver of_platform_serial_driver = {
178 180 .driver = {
179 181 .name = "of_serial",
180 182 .owner = THIS_MODULE,
181 183  
... ... @@ -186,13 +188,13 @@
186 188  
187 189 static int __init of_platform_serial_init(void)
188 190 {
189   - return of_register_platform_driver(&of_platform_serial_driver);
  191 + return platform_driver_register(&of_platform_serial_driver);
190 192 }
191 193 module_init(of_platform_serial_init);
192 194  
193 195 static void __exit of_platform_serial_exit(void)
194 196 {
195   - return of_unregister_platform_driver(&of_platform_serial_driver);
  197 + return platform_driver_unregister(&of_platform_serial_driver);
196 198 };
197 199 module_exit(of_platform_serial_exit);
198 200  
drivers/tty/serial/sunhv.c
... ... @@ -519,7 +519,7 @@
519 519 .data = &sunhv_reg,
520 520 };
521 521  
522   -static int __devinit hv_probe(struct platform_device *op, const struct of_device_id *match)
  522 +static int __devinit hv_probe(struct platform_device *op)
523 523 {
524 524 struct uart_port *port;
525 525 unsigned long minor;
... ... @@ -629,7 +629,7 @@
629 629 };
630 630 MODULE_DEVICE_TABLE(of, hv_match);
631 631  
632   -static struct of_platform_driver hv_driver = {
  632 +static struct platform_driver hv_driver = {
633 633 .driver = {
634 634 .name = "hv",
635 635 .owner = THIS_MODULE,
636 636  
... ... @@ -644,12 +644,12 @@
644 644 if (tlb_type != hypervisor)
645 645 return -ENODEV;
646 646  
647   - return of_register_platform_driver(&hv_driver);
  647 + return platform_driver_register(&hv_driver);
648 648 }
649 649  
650 650 static void __exit sunhv_exit(void)
651 651 {
652   - of_unregister_platform_driver(&hv_driver);
  652 + platform_driver_unregister(&hv_driver);
653 653 }
654 654  
655 655 module_init(sunhv_init);
drivers/tty/serial/sunsab.c
... ... @@ -1006,7 +1006,7 @@
1006 1006 return 0;
1007 1007 }
1008 1008  
1009   -static int __devinit sab_probe(struct platform_device *op, const struct of_device_id *match)
  1009 +static int __devinit sab_probe(struct platform_device *op)
1010 1010 {
1011 1011 static int inst;
1012 1012 struct uart_sunsab_port *up;
... ... @@ -1092,7 +1092,7 @@
1092 1092 };
1093 1093 MODULE_DEVICE_TABLE(of, sab_match);
1094 1094  
1095   -static struct of_platform_driver sab_driver = {
  1095 +static struct platform_driver sab_driver = {
1096 1096 .driver = {
1097 1097 .name = "sab",
1098 1098 .owner = THIS_MODULE,
1099 1099  
... ... @@ -1130,12 +1130,12 @@
1130 1130 }
1131 1131 }
1132 1132  
1133   - return of_register_platform_driver(&sab_driver);
  1133 + return platform_driver_register(&sab_driver);
1134 1134 }
1135 1135  
1136 1136 static void __exit sunsab_exit(void)
1137 1137 {
1138   - of_unregister_platform_driver(&sab_driver);
  1138 + platform_driver_unregister(&sab_driver);
1139 1139 if (sunsab_reg.nr) {
1140 1140 sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr);
1141 1141 }
drivers/tty/serial/sunsu.c
... ... @@ -1406,7 +1406,7 @@
1406 1406 return SU_PORT_PORT;
1407 1407 }
1408 1408  
1409   -static int __devinit su_probe(struct platform_device *op, const struct of_device_id *match)
  1409 +static int __devinit su_probe(struct platform_device *op)
1410 1410 {
1411 1411 static int inst;
1412 1412 struct device_node *dp = op->dev.of_node;
... ... @@ -1543,7 +1543,7 @@
1543 1543 };
1544 1544 MODULE_DEVICE_TABLE(of, su_match);
1545 1545  
1546   -static struct of_platform_driver su_driver = {
  1546 +static struct platform_driver su_driver = {
1547 1547 .driver = {
1548 1548 .name = "su",
1549 1549 .owner = THIS_MODULE,
... ... @@ -1586,7 +1586,7 @@
1586 1586 return err;
1587 1587 }
1588 1588  
1589   - err = of_register_platform_driver(&su_driver);
  1589 + err = platform_driver_register(&su_driver);
1590 1590 if (err && num_uart)
1591 1591 sunserial_unregister_minors(&sunsu_reg, num_uart);
1592 1592  
drivers/tty/serial/sunzilog.c
... ... @@ -1399,7 +1399,7 @@
1399 1399  
1400 1400 static int zilog_irq = -1;
1401 1401  
1402   -static int __devinit zs_probe(struct platform_device *op, const struct of_device_id *match)
  1402 +static int __devinit zs_probe(struct platform_device *op)
1403 1403 {
1404 1404 static int kbm_inst, uart_inst;
1405 1405 int inst;
... ... @@ -1540,7 +1540,7 @@
1540 1540 };
1541 1541 MODULE_DEVICE_TABLE(of, zs_match);
1542 1542  
1543   -static struct of_platform_driver zs_driver = {
  1543 +static struct platform_driver zs_driver = {
1544 1544 .driver = {
1545 1545 .name = "zs",
1546 1546 .owner = THIS_MODULE,
... ... @@ -1576,7 +1576,7 @@
1576 1576 goto out_free_tables;
1577 1577 }
1578 1578  
1579   - err = of_register_platform_driver(&zs_driver);
  1579 + err = platform_driver_register(&zs_driver);
1580 1580 if (err)
1581 1581 goto out_unregister_uart;
1582 1582  
... ... @@ -1604,7 +1604,7 @@
1604 1604 return err;
1605 1605  
1606 1606 out_unregister_driver:
1607   - of_unregister_platform_driver(&zs_driver);
  1607 + platform_driver_unregister(&zs_driver);
1608 1608  
1609 1609 out_unregister_uart:
1610 1610 if (num_sunzilog) {
... ... @@ -1619,7 +1619,7 @@
1619 1619  
1620 1620 static void __exit sunzilog_exit(void)
1621 1621 {
1622   - of_unregister_platform_driver(&zs_driver);
  1622 + platform_driver_unregister(&zs_driver);
1623 1623  
1624 1624 if (zilog_irq != -1) {
1625 1625 struct uart_sunzilog_port *up = sunzilog_irq_chain;
drivers/tty/serial/ucc_uart.c
... ... @@ -1194,8 +1194,7 @@
1194 1194 release_firmware(fw);
1195 1195 }
1196 1196  
1197   -static int ucc_uart_probe(struct platform_device *ofdev,
1198   - const struct of_device_id *match)
  1197 +static int ucc_uart_probe(struct platform_device *ofdev)
1199 1198 {
1200 1199 struct device_node *np = ofdev->dev.of_node;
1201 1200 const unsigned int *iprop; /* Integer OF properties */
... ... @@ -1485,7 +1484,7 @@
1485 1484 };
1486 1485 MODULE_DEVICE_TABLE(of, ucc_uart_match);
1487 1486  
1488   -static struct of_platform_driver ucc_uart_of_driver = {
  1487 +static struct platform_driver ucc_uart_of_driver = {
1489 1488 .driver = {
1490 1489 .name = "ucc_uart",
1491 1490 .owner = THIS_MODULE,
... ... @@ -1510,7 +1509,7 @@
1510 1509 return ret;
1511 1510 }
1512 1511  
1513   - ret = of_register_platform_driver(&ucc_uart_of_driver);
  1512 + ret = platform_driver_register(&ucc_uart_of_driver);
1514 1513 if (ret)
1515 1514 printk(KERN_ERR
1516 1515 "ucc-uart: could not register platform driver\n");
... ... @@ -1523,7 +1522,7 @@
1523 1522 printk(KERN_INFO
1524 1523 "Freescale QUICC Engine UART device driver unloading\n");
1525 1524  
1526   - of_unregister_platform_driver(&ucc_uart_of_driver);
  1525 + platform_driver_unregister(&ucc_uart_of_driver);
1527 1526 uart_unregister_driver(&ucc_uart_driver);
1528 1527 }
1529 1528