diff options
Diffstat (limited to 'drivers')
-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 e9c999d7eb39..9ef4592aca03 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c | |||
@@ -599,18 +599,8 @@ static struct device_driver mac_sonic_driver = { | |||
599 | .remove = __devexit_p(mac_sonic_device_remove), | 599 | .remove = __devexit_p(mac_sonic_device_remove), |
600 | }; | 600 | }; |
601 | 601 | ||
602 | static void mac_sonic_platform_release(struct device *device) | ||
603 | { | ||
604 | struct platform_device *pldev; | ||
605 | |||
606 | /* free device */ | ||
607 | pldev = to_platform_device (device); | ||
608 | kfree (pldev); | ||
609 | } | ||
610 | |||
611 | static int __init mac_sonic_init_module(void) | 602 | static int __init mac_sonic_init_module(void) |
612 | { | 603 | { |
613 | struct platform_device *pldev; | ||
614 | int err; | 604 | int err; |
615 | 605 | ||
616 | if ((err = driver_register(&mac_sonic_driver))) { | 606 | if ((err = driver_register(&mac_sonic_driver))) { |
@@ -618,27 +608,20 @@ static int __init mac_sonic_init_module(void) | |||
618 | return err; | 608 | return err; |
619 | } | 609 | } |
620 | 610 | ||
621 | mac_sonic_device = NULL; | 611 | mac_sonic_device = platform_device_alloc(mac_sonic_string, 0); |
622 | 612 | if (!mac_sonic_device) { | |
623 | if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) { | ||
624 | goto out_unregister; | 613 | goto out_unregister; |
625 | } | 614 | } |
626 | 615 | ||
627 | memset(pldev, 0, sizeof (*pldev)); | 616 | if (platform_device_add(mac_sonic_device)) { |
628 | pldev->name = mac_sonic_string; | 617 | platform_device_put(mac_sonic_device); |
629 | pldev->id = 0; | ||
630 | pldev->dev.release = mac_sonic_platform_release; | ||
631 | mac_sonic_device = pldev; | ||
632 | |||
633 | if (platform_device_register (pldev)) { | ||
634 | kfree(pldev); | ||
635 | mac_sonic_device = NULL; | 618 | mac_sonic_device = NULL; |
636 | } | 619 | } |
637 | 620 | ||
638 | return 0; | 621 | return 0; |
639 | 622 | ||
640 | out_unregister: | 623 | out_unregister: |
641 | platform_device_unregister(pldev); | 624 | driver_unregister(&mac_sonic_driver); |
642 | 625 | ||
643 | return -ENOMEM; | 626 | return -ENOMEM; |
644 | } | 627 | } |