Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+42 -46
+5 -6
drivers/tty/serial/apbuart.c
··· 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; ··· 586 587 {}, 587 588 }; 588 589 589 - static struct of_platform_driver grlib_apbuart_of_driver = { 590 + static struct platform_driver grlib_apbuart_of_driver = { 590 591 .probe = apbuart_probe, 591 592 .driver = { 592 593 .owner = THIS_MODULE, ··· 675 676 return ret; 676 677 } 677 678 678 - ret = of_register_platform_driver(&grlib_apbuart_of_driver); 679 + ret = platform_driver_register(&grlib_apbuart_of_driver); 679 680 if (ret) { 680 681 printk(KERN_ERR 681 - "%s: of_register_platform_driver failed (%i)\n", 682 + "%s: platform_driver_register failed (%i)\n", 682 683 __FILE__, ret); 683 684 uart_unregister_driver(&grlib_apbuart_driver); 684 685 return ret; ··· 696 697 &grlib_apbuart_ports[i]); 697 698 698 699 uart_unregister_driver(&grlib_apbuart_driver); 699 - of_unregister_platform_driver(&grlib_apbuart_of_driver); 700 + platform_driver_unregister(&grlib_apbuart_of_driver); 700 701 } 701 702 702 703 module_init(grlib_apbuart_init);
+4 -5
drivers/tty/serial/cpm_uart/cpm_uart_core.c
··· 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]; ··· 1404 1405 {} 1405 1406 }; 1406 1407 1407 - static struct of_platform_driver cpm_uart_driver = { 1408 + static struct platform_driver cpm_uart_driver = { 1408 1409 .driver = { 1409 1410 .name = "cpm_uart", 1410 1411 .owner = THIS_MODULE, ··· 1420 1421 if (ret) 1421 1422 return ret; 1422 1423 1423 - ret = of_register_platform_driver(&cpm_uart_driver); 1424 + ret = platform_driver_register(&cpm_uart_driver); 1424 1425 if (ret) 1425 1426 uart_unregister_driver(&cpm_reg); 1426 1427 ··· 1429 1430 1430 1431 static void __exit cpm_uart_exit(void) 1431 1432 { 1432 - of_unregister_platform_driver(&cpm_uart_driver); 1433 + platform_driver_unregister(&cpm_uart_driver); 1433 1434 uart_unregister_driver(&cpm_reg); 1434 1435 } 1435 1436
+5 -8
drivers/tty/serial/mpc52xx_uart.c
··· 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; 1310 1309 struct uart_port *port = NULL; 1311 1310 struct resource res; 1312 1311 int ret; 1313 - 1314 - dev_dbg(&op->dev, "mpc52xx_uart_probe(op=%p, match=%p)\n", op, match); 1315 1312 1316 1313 /* Check validity & presence */ 1317 1314 for (idx = 0; idx < MPC52xx_PSC_MAXNUM; idx++) ··· 1450 1453 1451 1454 MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match); 1452 1455 1453 - static struct of_platform_driver mpc52xx_uart_of_driver = { 1456 + static struct platform_driver mpc52xx_uart_of_driver = { 1454 1457 .probe = mpc52xx_uart_of_probe, 1455 1458 .remove = mpc52xx_uart_of_remove, 1456 1459 #ifdef CONFIG_PM ··· 1494 1497 return ret; 1495 1498 } 1496 1499 1497 - ret = of_register_platform_driver(&mpc52xx_uart_of_driver); 1500 + ret = platform_driver_register(&mpc52xx_uart_of_driver); 1498 1501 if (ret) { 1499 - printk(KERN_ERR "%s: of_register_platform_driver failed (%i)\n", 1502 + printk(KERN_ERR "%s: platform_driver_register failed (%i)\n", 1500 1503 __FILE__, ret); 1501 1504 uart_unregister_driver(&mpc52xx_uart_driver); 1502 1505 return ret; ··· 1511 1514 if (psc_ops->fifoc_uninit) 1512 1515 psc_ops->fifoc_uninit(); 1513 1516 1514 - of_unregister_platform_driver(&mpc52xx_uart_of_driver); 1517 + platform_driver_unregister(&mpc52xx_uart_of_driver); 1515 1518 uart_unregister_driver(&mpc52xx_uart_driver); 1516 1519 } 1517 1520
+8 -6
drivers/tty/serial/of_serial.c
··· 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; 89 + 90 + if (!ofdev->dev.of_match) 91 + return -EINVAL; 90 92 91 93 if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL)) 92 94 return -EBUSY; ··· 97 95 if (info == NULL) 98 96 return -ENOMEM; 99 97 100 - port_type = (unsigned long)id->data; 98 + port_type = (unsigned long)ofdev->dev.of_match->data; 101 99 ret = of_platform_serial_setup(ofdev, port_type, &port); 102 100 if (ret) 103 101 goto out; ··· 176 174 { /* end of list */ }, 177 175 }; 178 176 179 - static struct of_platform_driver of_platform_serial_driver = { 177 + static struct platform_driver of_platform_serial_driver = { 180 178 .driver = { 181 179 .name = "of_serial", 182 180 .owner = THIS_MODULE, ··· 188 186 189 187 static int __init of_platform_serial_init(void) 190 188 { 191 - return of_register_platform_driver(&of_platform_serial_driver); 189 + return platform_driver_register(&of_platform_serial_driver); 192 190 } 193 191 module_init(of_platform_serial_init); 194 192 195 193 static void __exit of_platform_serial_exit(void) 196 194 { 197 - return of_unregister_platform_driver(&of_platform_serial_driver); 195 + return platform_driver_unregister(&of_platform_serial_driver); 198 196 }; 199 197 module_exit(of_platform_serial_exit); 200 198
+4 -4
drivers/tty/serial/sunhv.c
··· 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 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, ··· 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);
+4 -4
drivers/tty/serial/sunsab.c
··· 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 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, ··· 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 }
+3 -3
drivers/tty/serial/sunsu.c
··· 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 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 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
+5 -5
drivers/tty/serial/sunzilog.c
··· 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 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 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 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 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;
+4 -5
drivers/tty/serial/ucc_uart.c
··· 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 */ ··· 1484 1485 }; 1485 1486 MODULE_DEVICE_TABLE(of, ucc_uart_match); 1486 1487 1487 - static struct of_platform_driver ucc_uart_of_driver = { 1488 + static struct platform_driver ucc_uart_of_driver = { 1488 1489 .driver = { 1489 1490 .name = "ucc_uart", 1490 1491 .owner = THIS_MODULE, ··· 1509 1510 return ret; 1510 1511 } 1511 1512 1512 - ret = of_register_platform_driver(&ucc_uart_of_driver); 1513 + ret = platform_driver_register(&ucc_uart_of_driver); 1513 1514 if (ret) 1514 1515 printk(KERN_ERR 1515 1516 "ucc-uart: could not register platform driver\n"); ··· 1522 1523 printk(KERN_INFO 1523 1524 "Freescale QUICC Engine UART device driver unloading\n"); 1524 1525 1525 - of_unregister_platform_driver(&ucc_uart_of_driver); 1526 + platform_driver_unregister(&ucc_uart_of_driver); 1526 1527 uart_unregister_driver(&ucc_uart_driver); 1527 1528 } 1528 1529