diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/serial/mpc52xx_uart.c | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (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/mpc52xx_uart.c')
-rw-r--r-- | drivers/serial/mpc52xx_uart.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 0dd08a09e7e6..5d3cb8486447 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -717,10 +717,9 @@ static struct uart_driver mpc52xx_uart_driver = { | |||
717 | /* ======================================================================== */ | 717 | /* ======================================================================== */ |
718 | 718 | ||
719 | static int __devinit | 719 | static int __devinit |
720 | mpc52xx_uart_probe(struct device *dev) | 720 | mpc52xx_uart_probe(struct platform_device *dev) |
721 | { | 721 | { |
722 | struct platform_device *pdev = to_platform_device(dev); | 722 | struct resource *res = dev->resource; |
723 | struct resource *res = pdev->resource; | ||
724 | 723 | ||
725 | struct uart_port *port = NULL; | 724 | struct uart_port *port = NULL; |
726 | int i, idx, ret; | 725 | int i, idx, ret; |
@@ -761,17 +760,17 @@ mpc52xx_uart_probe(struct device *dev) | |||
761 | /* Add the port to the uart sub-system */ | 760 | /* Add the port to the uart sub-system */ |
762 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); | 761 | ret = uart_add_one_port(&mpc52xx_uart_driver, port); |
763 | if (!ret) | 762 | if (!ret) |
764 | dev_set_drvdata(dev, (void*)port); | 763 | platform_set_drvdata(dev, (void*)port); |
765 | 764 | ||
766 | return ret; | 765 | return ret; |
767 | } | 766 | } |
768 | 767 | ||
769 | static int | 768 | static int |
770 | mpc52xx_uart_remove(struct device *dev) | 769 | mpc52xx_uart_remove(struct platform_device *dev) |
771 | { | 770 | { |
772 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); | 771 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); |
773 | 772 | ||
774 | dev_set_drvdata(dev, NULL); | 773 | platform_set_drvdata(dev, NULL); |
775 | 774 | ||
776 | if (port) | 775 | if (port) |
777 | uart_remove_one_port(&mpc52xx_uart_driver, port); | 776 | uart_remove_one_port(&mpc52xx_uart_driver, port); |
@@ -781,9 +780,9 @@ mpc52xx_uart_remove(struct device *dev) | |||
781 | 780 | ||
782 | #ifdef CONFIG_PM | 781 | #ifdef CONFIG_PM |
783 | static int | 782 | static int |
784 | mpc52xx_uart_suspend(struct device *dev, pm_message_t state) | 783 | mpc52xx_uart_suspend(struct platform_device *dev, pm_message_t state) |
785 | { | 784 | { |
786 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); | 785 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); |
787 | 786 | ||
788 | if (sport) | 787 | if (sport) |
789 | uart_suspend_port(&mpc52xx_uart_driver, port); | 788 | uart_suspend_port(&mpc52xx_uart_driver, port); |
@@ -792,9 +791,9 @@ mpc52xx_uart_suspend(struct device *dev, pm_message_t state) | |||
792 | } | 791 | } |
793 | 792 | ||
794 | static int | 793 | static int |
795 | mpc52xx_uart_resume(struct device *dev) | 794 | mpc52xx_uart_resume(struct platform_device *dev) |
796 | { | 795 | { |
797 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev); | 796 | struct uart_port *port = (struct uart_port *) platform_get_drvdata(dev); |
798 | 797 | ||
799 | if (port) | 798 | if (port) |
800 | uart_resume_port(&mpc52xx_uart_driver, port); | 799 | uart_resume_port(&mpc52xx_uart_driver, port); |
@@ -803,15 +802,16 @@ mpc52xx_uart_resume(struct device *dev) | |||
803 | } | 802 | } |
804 | #endif | 803 | #endif |
805 | 804 | ||
806 | static struct device_driver mpc52xx_uart_platform_driver = { | 805 | static struct platform_driver mpc52xx_uart_platform_driver = { |
807 | .name = "mpc52xx-psc", | ||
808 | .bus = &platform_bus_type, | ||
809 | .probe = mpc52xx_uart_probe, | 806 | .probe = mpc52xx_uart_probe, |
810 | .remove = mpc52xx_uart_remove, | 807 | .remove = mpc52xx_uart_remove, |
811 | #ifdef CONFIG_PM | 808 | #ifdef CONFIG_PM |
812 | .suspend = mpc52xx_uart_suspend, | 809 | .suspend = mpc52xx_uart_suspend, |
813 | .resume = mpc52xx_uart_resume, | 810 | .resume = mpc52xx_uart_resume, |
814 | #endif | 811 | #endif |
812 | .driver = { | ||
813 | .name = "mpc52xx-psc", | ||
814 | }, | ||
815 | }; | 815 | }; |
816 | 816 | ||
817 | 817 | ||
@@ -828,7 +828,7 @@ mpc52xx_uart_init(void) | |||
828 | 828 | ||
829 | ret = uart_register_driver(&mpc52xx_uart_driver); | 829 | ret = uart_register_driver(&mpc52xx_uart_driver); |
830 | if (ret == 0) { | 830 | if (ret == 0) { |
831 | ret = driver_register(&mpc52xx_uart_platform_driver); | 831 | ret = platform_driver_register(&mpc52xx_uart_platform_driver); |
832 | if (ret) | 832 | if (ret) |
833 | uart_unregister_driver(&mpc52xx_uart_driver); | 833 | uart_unregister_driver(&mpc52xx_uart_driver); |
834 | } | 834 | } |
@@ -839,7 +839,7 @@ mpc52xx_uart_init(void) | |||
839 | static void __exit | 839 | static void __exit |
840 | mpc52xx_uart_exit(void) | 840 | mpc52xx_uart_exit(void) |
841 | { | 841 | { |
842 | driver_unregister(&mpc52xx_uart_platform_driver); | 842 | platform_driver_unregister(&mpc52xx_uart_platform_driver); |
843 | uart_unregister_driver(&mpc52xx_uart_driver); | 843 | uart_unregister_driver(&mpc52xx_uart_driver); |
844 | } | 844 | } |
845 | 845 | ||