[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>
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 71f2c67..3cb9b3f 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1387,9 +1387,8 @@
  * Input :	struct device *
  * Output :	-ENOMEM if failed , 0 if success
  */
-static int mv643xx_eth_probe(struct device *ddev)
+static int mv643xx_eth_probe(struct platform_device *pdev)
 {
-	struct platform_device *pdev = to_platform_device(ddev);
 	struct mv643xx_eth_platform_data *pd;
 	int port_num = pdev->id;
 	struct mv643xx_private *mp;
@@ -1402,7 +1401,7 @@
 	if (!dev)
 		return -ENOMEM;
 
-	dev_set_drvdata(ddev, dev);
+	platform_set_drvdata(pdev, dev);
 
 	mp = netdev_priv(dev);
 
@@ -1546,21 +1545,20 @@
 	return err;
 }
 
-static int mv643xx_eth_remove(struct device *ddev)
+static int mv643xx_eth_remove(struct platform_device *pdev)
 {
-	struct net_device *dev = dev_get_drvdata(ddev);
+	struct net_device *dev = platform_get_drvdata(pdev);
 
 	unregister_netdev(dev);
 	flush_scheduled_work();
 
 	free_netdev(dev);
-	dev_set_drvdata(ddev, NULL);
+	platform_set_drvdata(pdev, NULL);
 	return 0;
 }
 
-static int mv643xx_eth_shared_probe(struct device *ddev)
+static int mv643xx_eth_shared_probe(struct platform_device *pdev)
 {
-	struct platform_device *pdev = to_platform_device(ddev);
 	struct resource *res;
 
 	printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n");
@@ -1578,7 +1576,7 @@
 
 }
 
-static int mv643xx_eth_shared_remove(struct device *ddev)
+static int mv643xx_eth_shared_remove(struct platform_device *pdev)
 {
 	iounmap(mv643xx_eth_shared_base);
 	mv643xx_eth_shared_base = NULL;
@@ -1586,18 +1584,20 @@
 	return 0;
 }
 
-static struct device_driver mv643xx_eth_driver = {
-	.name = MV643XX_ETH_NAME,
-	.bus = &platform_bus_type,
+static struct platform_driver mv643xx_eth_driver = {
 	.probe = mv643xx_eth_probe,
 	.remove = mv643xx_eth_remove,
+	.driver = {
+		.name = MV643XX_ETH_NAME,
+	},
 };
 
-static struct device_driver mv643xx_eth_shared_driver = {
-	.name = MV643XX_ETH_SHARED_NAME,
-	.bus = &platform_bus_type,
+static struct platform_driver mv643xx_eth_shared_driver = {
 	.probe = mv643xx_eth_shared_probe,
 	.remove = mv643xx_eth_shared_remove,
+	.driver = {
+		.name = MV643XX_ETH_SHARED_NAME,
+	},
 };
 
 /*
@@ -1613,11 +1613,11 @@
 {
 	int rc;
 
-	rc = driver_register(&mv643xx_eth_shared_driver);
+	rc = platform_driver_register(&mv643xx_eth_shared_driver);
 	if (!rc) {
-		rc = driver_register(&mv643xx_eth_driver);
+		rc = platform_driver_register(&mv643xx_eth_driver);
 		if (rc)
-			driver_unregister(&mv643xx_eth_shared_driver);
+			platform_driver_unregister(&mv643xx_eth_shared_driver);
 	}
 	return rc;
 }
@@ -1633,8 +1633,8 @@
  */
 static void __exit mv643xx_cleanup_module(void)
 {
-	driver_unregister(&mv643xx_eth_driver);
-	driver_unregister(&mv643xx_eth_shared_driver);
+	platform_driver_unregister(&mv643xx_eth_driver);
+	platform_driver_unregister(&mv643xx_eth_shared_driver);
 }
 
 module_init(mv643xx_init_module);