aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/pxa.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-09 17:32:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-09 17:32:44 -0500
commit3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch)
treed8825be54cefb6ad6707478d719c8e30605bee7b /drivers/serial/pxa.c
parent00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff)
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually remove the use of the device_driver function pointer methods for platform device drivers. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/serial/pxa.c')
-rw-r--r--drivers/serial/pxa.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index 16b2f9417af9..ff5e6309d682 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -805,9 +805,9 @@ static struct uart_driver serial_pxa_reg = {
805 .cons = PXA_CONSOLE, 805 .cons = PXA_CONSOLE,
806}; 806};
807 807
808static int serial_pxa_suspend(struct device *_dev, pm_message_t state) 808static int serial_pxa_suspend(struct platform_device *dev, pm_message_t state)
809{ 809{
810 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 810 struct uart_pxa_port *sport = platform_get_drvdata(dev);
811 811
812 if (sport) 812 if (sport)
813 uart_suspend_port(&serial_pxa_reg, &sport->port); 813 uart_suspend_port(&serial_pxa_reg, &sport->port);
@@ -815,9 +815,9 @@ static int serial_pxa_suspend(struct device *_dev, pm_message_t state)
815 return 0; 815 return 0;
816} 816}
817 817
818static int serial_pxa_resume(struct device *_dev) 818static int serial_pxa_resume(struct platform_device *dev)
819{ 819{
820 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 820 struct uart_pxa_port *sport = platform_get_drvdata(dev);
821 821
822 if (sport) 822 if (sport)
823 uart_resume_port(&serial_pxa_reg, &sport->port); 823 uart_resume_port(&serial_pxa_reg, &sport->port);
@@ -825,21 +825,19 @@ static int serial_pxa_resume(struct device *_dev)
825 return 0; 825 return 0;
826} 826}
827 827
828static int serial_pxa_probe(struct device *_dev) 828static int serial_pxa_probe(struct platform_device *dev)
829{ 829{
830 struct platform_device *dev = to_platform_device(_dev); 830 serial_pxa_ports[dev->id].port.dev = &dev->dev;
831
832 serial_pxa_ports[dev->id].port.dev = _dev;
833 uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); 831 uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port);
834 dev_set_drvdata(_dev, &serial_pxa_ports[dev->id]); 832 platform_set_drvdata(dev, &serial_pxa_ports[dev->id]);
835 return 0; 833 return 0;
836} 834}
837 835
838static int serial_pxa_remove(struct device *_dev) 836static int serial_pxa_remove(struct platform_device *dev)
839{ 837{
840 struct uart_pxa_port *sport = dev_get_drvdata(_dev); 838 struct uart_pxa_port *sport = platform_get_drvdata(dev);
841 839
842 dev_set_drvdata(_dev, NULL); 840 platform_set_drvdata(dev, NULL);
843 841
844 if (sport) 842 if (sport)
845 uart_remove_one_port(&serial_pxa_reg, &sport->port); 843 uart_remove_one_port(&serial_pxa_reg, &sport->port);
@@ -847,14 +845,15 @@ static int serial_pxa_remove(struct device *_dev)
847 return 0; 845 return 0;
848} 846}
849 847
850static struct device_driver serial_pxa_driver = { 848static struct platform_driver serial_pxa_driver = {
851 .name = "pxa2xx-uart",
852 .bus = &platform_bus_type,
853 .probe = serial_pxa_probe, 849 .probe = serial_pxa_probe,
854 .remove = serial_pxa_remove, 850 .remove = serial_pxa_remove,
855 851
856 .suspend = serial_pxa_suspend, 852 .suspend = serial_pxa_suspend,
857 .resume = serial_pxa_resume, 853 .resume = serial_pxa_resume,
854 .driver = {
855 .name = "pxa2xx-uart",
856 },
858}; 857};
859 858
860int __init serial_pxa_init(void) 859int __init serial_pxa_init(void)
@@ -865,7 +864,7 @@ int __init serial_pxa_init(void)
865 if (ret != 0) 864 if (ret != 0)
866 return ret; 865 return ret;
867 866
868 ret = driver_register(&serial_pxa_driver); 867 ret = platform_driver_register(&serial_pxa_driver);
869 if (ret != 0) 868 if (ret != 0)
870 uart_unregister_driver(&serial_pxa_reg); 869 uart_unregister_driver(&serial_pxa_reg);
871 870
@@ -874,7 +873,7 @@ int __init serial_pxa_init(void)
874 873
875void __exit serial_pxa_exit(void) 874void __exit serial_pxa_exit(void)
876{ 875{
877 driver_unregister(&serial_pxa_driver); 876 platform_driver_unregister(&serial_pxa_driver);
878 uart_unregister_driver(&serial_pxa_reg); 877 uart_unregister_driver(&serial_pxa_reg);
879} 878}
880 879