platform driver: fix incorrect use of 'platform_bus_type' with 'struct device_driver'

This patch fixes the bug reported in
	http://bugzilla.kernel.org/show_bug.cgi?id=11681.

"Lots of device drivers register a 'struct device_driver' with
the '.bus' member set to '&platform_bus_type'. This is wrong,
since the platform_bus functions expect the 'struct device_driver'
to be wrapped up in a 'struct platform_driver' which provides
some additional callbacks (like suspend_late, resume_early).
The effect may be that platform_suspend_late() uses bogus data
outside the device_driver struct as a pointer pointer to the
device driver's suspend_late() function or other hard to
reproduce failures."(Lothar Wassmann)

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c
index 4e7a5fa..664835b 100644
--- a/drivers/net/mipsnet.c
+++ b/drivers/net/mipsnet.c
@@ -237,7 +237,7 @@
 {
 }
 
-static int __init mipsnet_probe(struct device *dev)
+static int __init mipsnet_probe(struct platform_device *dev)
 {
 	struct net_device *netdev;
 	int err;
@@ -248,7 +248,7 @@
 		goto out;
 	}
 
-	dev_set_drvdata(dev, netdev);
+	platform_set_drvdata(dev, netdev);
 
 	netdev->open			= mipsnet_open;
 	netdev->stop			= mipsnet_close;
@@ -293,23 +293,25 @@
 	return err;
 }
 
-static int __devexit mipsnet_device_remove(struct device *device)
+static int __devexit mipsnet_device_remove(struct platform_device *device)
 {
-	struct net_device *dev = dev_get_drvdata(device);
+	struct net_device *dev = platform_get_drvdata(device);
 
 	unregister_netdev(dev);
 	release_region(dev->base_addr, sizeof(struct mipsnet_regs));
 	free_netdev(dev);
-	dev_set_drvdata(device, NULL);
+	platform_set_drvdata(device, NULL);
 
 	return 0;
 }
 
-static struct device_driver mipsnet_driver = {
-	.name	= mipsnet_string,
-	.bus	= &platform_bus_type,
-	.probe	= mipsnet_probe,
-	.remove	= __devexit_p(mipsnet_device_remove),
+static struct platform_driver mipsnet_driver = {
+	.driver = {
+		.name		= mipsnet_string,
+		.owner		= THIS_MODULE,
+	},
+	.probe		= mipsnet_probe,
+	.remove		= __devexit_p(mipsnet_device_remove),
 };
 
 static int __init mipsnet_init_module(void)
@@ -319,7 +321,7 @@
 	printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. "
 	       "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION);
 
-	err = driver_register(&mipsnet_driver);
+	err = platform_driver_register(&mipsnet_driver);
 	if (err)
 		printk(KERN_ERR "Driver registration failed\n");
 
@@ -328,7 +330,7 @@
 
 static void __exit mipsnet_exit_module(void)
 {
-	driver_unregister(&mipsnet_driver);
+	platform_driver_unregister(&mipsnet_driver);
 }
 
 module_init(mipsnet_init_module);