diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-09 01:37:34 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-09 01:37:34 -0500 |
commit | 8006fdd6dc387abaa4b683bda4868c879fd76070 (patch) | |
tree | 314b08f4923dd9ab24930e6b2ac75889c244b154 /drivers/net/macsonic.c | |
parent | 18ce920a6eba05c0d55cdc95fbbadf7e4c4b457b (diff) | |
parent | 7c3983357fdaef3ae71a0d7081a4b6dcfd869d39 (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers/net/macsonic.c')
-rw-r--r-- | drivers/net/macsonic.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c index e9c999d7eb3..9ef4592aca0 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c @@ -599,18 +599,8 @@ static struct device_driver mac_sonic_driver = { .remove = __devexit_p(mac_sonic_device_remove), }; -static void mac_sonic_platform_release(struct device *device) -{ - struct platform_device *pldev; - - /* free device */ - pldev = to_platform_device (device); - kfree (pldev); -} - static int __init mac_sonic_init_module(void) { - struct platform_device *pldev; int err; if ((err = driver_register(&mac_sonic_driver))) { @@ -618,27 +608,20 @@ static int __init mac_sonic_init_module(void) return err; } - mac_sonic_device = NULL; - - if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) { + mac_sonic_device = platform_device_alloc(mac_sonic_string, 0); + if (!mac_sonic_device) { goto out_unregister; } - memset(pldev, 0, sizeof (*pldev)); - pldev->name = mac_sonic_string; - pldev->id = 0; - pldev->dev.release = mac_sonic_platform_release; - mac_sonic_device = pldev; - - if (platform_device_register (pldev)) { - kfree(pldev); + if (platform_device_add(mac_sonic_device)) { + platform_device_put(mac_sonic_device); mac_sonic_device = NULL; } return 0; out_unregister: - platform_device_unregister(pldev); + driver_unregister(&mac_sonic_driver); return -ENOMEM; } |