aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/mpsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/mpsc.c')
-rw-r--r--drivers/serial/mpsc.c65
1 files changed, 31 insertions, 34 deletions
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index ba8838b234da..8f83e4007ecd 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -1551,15 +1551,14 @@ mpsc_shared_unmap_regs(void)
1551} 1551}
1552 1552
1553static int 1553static int
1554mpsc_shared_drv_probe(struct device *dev) 1554mpsc_shared_drv_probe(struct platform_device *dev)
1555{ 1555{
1556 struct platform_device *pd = to_platform_device(dev);
1557 struct mpsc_shared_pdata *pdata; 1556 struct mpsc_shared_pdata *pdata;
1558 int rc = -ENODEV; 1557 int rc = -ENODEV;
1559 1558
1560 if (pd->id == 0) { 1559 if (dev->id == 0) {
1561 if (!(rc = mpsc_shared_map_regs(pd))) { 1560 if (!(rc = mpsc_shared_map_regs(dev))) {
1562 pdata = (struct mpsc_shared_pdata *)dev->platform_data; 1561 pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data;
1563 1562
1564 mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val; 1563 mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val;
1565 mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val; 1564 mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val;
@@ -1577,12 +1576,11 @@ mpsc_shared_drv_probe(struct device *dev)
1577} 1576}
1578 1577
1579static int 1578static int
1580mpsc_shared_drv_remove(struct device *dev) 1579mpsc_shared_drv_remove(struct platform_device *dev)
1581{ 1580{
1582 struct platform_device *pd = to_platform_device(dev);
1583 int rc = -ENODEV; 1581 int rc = -ENODEV;
1584 1582
1585 if (pd->id == 0) { 1583 if (dev->id == 0) {
1586 mpsc_shared_unmap_regs(); 1584 mpsc_shared_unmap_regs();
1587 mpsc_shared_regs.MPSC_MRR_m = 0; 1585 mpsc_shared_regs.MPSC_MRR_m = 0;
1588 mpsc_shared_regs.MPSC_RCRR_m = 0; 1586 mpsc_shared_regs.MPSC_RCRR_m = 0;
@@ -1595,11 +1593,12 @@ mpsc_shared_drv_remove(struct device *dev)
1595 return rc; 1593 return rc;
1596} 1594}
1597 1595
1598static struct device_driver mpsc_shared_driver = { 1596static struct platform_driver mpsc_shared_driver = {
1599 .name = MPSC_SHARED_NAME,
1600 .bus = &platform_bus_type,
1601 .probe = mpsc_shared_drv_probe, 1597 .probe = mpsc_shared_drv_probe,
1602 .remove = mpsc_shared_drv_remove, 1598 .remove = mpsc_shared_drv_remove,
1599 .driver = {
1600 .name = MPSC_SHARED_NAME,
1601 },
1603}; 1602};
1604 1603
1605/* 1604/*
@@ -1732,19 +1731,18 @@ mpsc_drv_get_platform_data(struct mpsc_port_info *pi,
1732} 1731}
1733 1732
1734static int 1733static int
1735mpsc_drv_probe(struct device *dev) 1734mpsc_drv_probe(struct platform_device *dev)
1736{ 1735{
1737 struct platform_device *pd = to_platform_device(dev);
1738 struct mpsc_port_info *pi; 1736 struct mpsc_port_info *pi;
1739 int rc = -ENODEV; 1737 int rc = -ENODEV;
1740 1738
1741 pr_debug("mpsc_drv_probe: Adding MPSC %d\n", pd->id); 1739 pr_debug("mpsc_drv_probe: Adding MPSC %d\n", dev->id);
1742 1740
1743 if (pd->id < MPSC_NUM_CTLRS) { 1741 if (dev->id < MPSC_NUM_CTLRS) {
1744 pi = &mpsc_ports[pd->id]; 1742 pi = &mpsc_ports[dev->id];
1745 1743
1746 if (!(rc = mpsc_drv_map_regs(pi, pd))) { 1744 if (!(rc = mpsc_drv_map_regs(pi, dev))) {
1747 mpsc_drv_get_platform_data(pi, pd, pd->id); 1745 mpsc_drv_get_platform_data(pi, dev, dev->id);
1748 1746
1749 if (!(rc = mpsc_make_ready(pi))) 1747 if (!(rc = mpsc_make_ready(pi)))
1750 if (!(rc = uart_add_one_port(&mpsc_reg, 1748 if (!(rc = uart_add_one_port(&mpsc_reg,
@@ -1764,27 +1762,26 @@ mpsc_drv_probe(struct device *dev)
1764} 1762}
1765 1763
1766static int 1764static int
1767mpsc_drv_remove(struct device *dev) 1765mpsc_drv_remove(struct platform_device *dev)
1768{ 1766{
1769 struct platform_device *pd = to_platform_device(dev); 1767 pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
1770 1768
1771 pr_debug("mpsc_drv_exit: Removing MPSC %d\n", pd->id); 1769 if (dev->id < MPSC_NUM_CTLRS) {
1772 1770 uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
1773 if (pd->id < MPSC_NUM_CTLRS) { 1771 mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port);
1774 uart_remove_one_port(&mpsc_reg, &mpsc_ports[pd->id].port); 1772 mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
1775 mpsc_release_port((struct uart_port *)&mpsc_ports[pd->id].port);
1776 mpsc_drv_unmap_regs(&mpsc_ports[pd->id]);
1777 return 0; 1773 return 0;
1778 } 1774 }
1779 else 1775 else
1780 return -ENODEV; 1776 return -ENODEV;
1781} 1777}
1782 1778
1783static struct device_driver mpsc_driver = { 1779static struct platform_driver mpsc_driver = {
1784 .name = MPSC_CTLR_NAME,
1785 .bus = &platform_bus_type,
1786 .probe = mpsc_drv_probe, 1780 .probe = mpsc_drv_probe,
1787 .remove = mpsc_drv_remove, 1781 .remove = mpsc_drv_remove,
1782 .driver = {
1783 .name = MPSC_CTLR_NAME,
1784 },
1788}; 1785};
1789 1786
1790static int __init 1787static int __init
@@ -1798,9 +1795,9 @@ mpsc_drv_init(void)
1798 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); 1795 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
1799 1796
1800 if (!(rc = uart_register_driver(&mpsc_reg))) { 1797 if (!(rc = uart_register_driver(&mpsc_reg))) {
1801 if (!(rc = driver_register(&mpsc_shared_driver))) { 1798 if (!(rc = platform_driver_register(&mpsc_shared_driver))) {
1802 if ((rc = driver_register(&mpsc_driver))) { 1799 if ((rc = platform_driver_register(&mpsc_driver))) {
1803 driver_unregister(&mpsc_shared_driver); 1800 platform_driver_unregister(&mpsc_shared_driver);
1804 uart_unregister_driver(&mpsc_reg); 1801 uart_unregister_driver(&mpsc_reg);
1805 } 1802 }
1806 } 1803 }
@@ -1815,8 +1812,8 @@ mpsc_drv_init(void)
1815static void __exit 1812static void __exit
1816mpsc_drv_exit(void) 1813mpsc_drv_exit(void)
1817{ 1814{
1818 driver_unregister(&mpsc_driver); 1815 platform_driver_unregister(&mpsc_driver);
1819 driver_unregister(&mpsc_shared_driver); 1816 platform_driver_unregister(&mpsc_shared_driver);
1820 uart_unregister_driver(&mpsc_reg); 1817 uart_unregister_driver(&mpsc_reg);
1821 memset(mpsc_ports, 0, sizeof(mpsc_ports)); 1818 memset(mpsc_ports, 0, sizeof(mpsc_ports));
1822 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs)); 1819 memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));