[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>
This commit is contained in:
Russell King
2005-11-09 22:32:44 +00:00
committed by Russell King
parent 00d3dcdd96
commit 3ae5eaec1d
93 changed files with 1413 additions and 1416 deletions

View File

@@ -194,7 +194,7 @@ out:
* Probe for a SONIC ethernet controller on a Mips Jazz board.
* Actually probing is superfluous but we're paranoid.
*/
static int __init jazz_sonic_probe(struct device *device)
static int __init jazz_sonic_probe(struct platform_device *pdev)
{
struct net_device *dev;
struct sonic_local *lp;
@@ -212,8 +212,8 @@ static int __init jazz_sonic_probe(struct device *device)
return -ENOMEM;
lp = netdev_priv(dev);
lp->device = device;
SET_NETDEV_DEV(dev, device);
lp->device = &pdev->dev;
SET_NETDEV_DEV(dev, &pdev->dev);
SET_MODULE_OWNER(dev);
netdev_boot_setup_check(dev);
@@ -264,9 +264,9 @@ MODULE_PARM_DESC(sonic_debug, "jazzsonic debug level (1-4)");
#include "sonic.c"
static int __devexit jazz_sonic_device_remove (struct device *device)
static int __devexit jazz_sonic_device_remove (struct platform_device *pdev)
{
struct net_device *dev = device->driver_data;
struct net_device *dev = platform_get_drvdata(pdev);
struct sonic_local* lp = netdev_priv(dev);
unregister_netdev (dev);
@@ -278,18 +278,19 @@ static int __devexit jazz_sonic_device_remove (struct device *device)
return 0;
}
static struct device_driver jazz_sonic_driver = {
.name = jazz_sonic_string,
.bus = &platform_bus_type,
static struct platform_driver jazz_sonic_driver = {
.probe = jazz_sonic_probe,
.remove = __devexit_p(jazz_sonic_device_remove),
.driver = {
.name = jazz_sonic_string,
},
};
static int __init jazz_sonic_init_module(void)
{
int err;
if ((err = driver_register(&jazz_sonic_driver))) {
if ((err = platform_driver_register(&jazz_sonic_driver))) {
printk(KERN_ERR "Driver registration failed\n");
return err;
}
@@ -313,7 +314,7 @@ out_unregister:
static void __exit jazz_sonic_cleanup_module(void)
{
driver_unregister(&jazz_sonic_driver);
platform_driver_unregister(&jazz_sonic_driver);
if (jazz_sonic_device) {
platform_device_unregister(jazz_sonic_device);