diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-06 23:01:34 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-06 23:01:34 -0500 |
commit | b78612b796b0d6cdfba553d456eff008278830e3 (patch) | |
tree | 595e0503cc152dcc5383f1f2d12e93770ae7c16b /drivers/net | |
parent | 50eb80068001871339d04b749fb9b198428b56d2 (diff) | |
parent | 0b154bb7d0cce80e9c0bcf11d4f9e71b59409d26 (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/depca.c | 24 | ||||
-rw-r--r-- | drivers/net/jazzsonic.c | 28 | ||||
-rw-r--r-- | drivers/net/macsonic.c | 27 |
3 files changed, 17 insertions, 62 deletions
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 4d26e5e7d18b..0d33a93df96b 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
@@ -1470,15 +1470,6 @@ static int __init depca_mca_probe(struct device *device) | |||
1470 | ** ISA bus I/O device probe | 1470 | ** ISA bus I/O device probe |
1471 | */ | 1471 | */ |
1472 | 1472 | ||
1473 | static void depca_platform_release (struct device *device) | ||
1474 | { | ||
1475 | struct platform_device *pldev; | ||
1476 | |||
1477 | /* free device */ | ||
1478 | pldev = to_platform_device (device); | ||
1479 | kfree (pldev); | ||
1480 | } | ||
1481 | |||
1482 | static void __init depca_platform_probe (void) | 1473 | static void __init depca_platform_probe (void) |
1483 | { | 1474 | { |
1484 | int i; | 1475 | int i; |
@@ -1491,19 +1482,16 @@ static void __init depca_platform_probe (void) | |||
1491 | * line, use it (if valid) */ | 1482 | * line, use it (if valid) */ |
1492 | if (io && io != depca_io_ports[i].iobase) | 1483 | if (io && io != depca_io_ports[i].iobase) |
1493 | continue; | 1484 | continue; |
1494 | 1485 | ||
1495 | if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) | 1486 | pldev = platform_device_alloc(depca_string, i); |
1487 | if (!pldev) | ||
1496 | continue; | 1488 | continue; |
1497 | 1489 | ||
1498 | memset (pldev, 0, sizeof (*pldev)); | ||
1499 | pldev->name = depca_string; | ||
1500 | pldev->id = i; | ||
1501 | pldev->dev.platform_data = (void *) depca_io_ports[i].iobase; | 1490 | pldev->dev.platform_data = (void *) depca_io_ports[i].iobase; |
1502 | pldev->dev.release = depca_platform_release; | ||
1503 | depca_io_ports[i].device = pldev; | 1491 | depca_io_ports[i].device = pldev; |
1504 | 1492 | ||
1505 | if (platform_device_register (pldev)) { | 1493 | if (platform_device_add(pldev)) { |
1506 | kfree (pldev); | 1494 | platform_device_put(pldev); |
1507 | depca_io_ports[i].device = NULL; | 1495 | depca_io_ports[i].device = NULL; |
1508 | continue; | 1496 | continue; |
1509 | } | 1497 | } |
@@ -1515,6 +1503,7 @@ static void __init depca_platform_probe (void) | |||
1515 | * allocated structure */ | 1503 | * allocated structure */ |
1516 | 1504 | ||
1517 | depca_io_ports[i].device = NULL; | 1505 | depca_io_ports[i].device = NULL; |
1506 | pldev->dev.platform_data = NULL; | ||
1518 | platform_device_unregister (pldev); | 1507 | platform_device_unregister (pldev); |
1519 | } | 1508 | } |
1520 | } | 1509 | } |
@@ -2112,6 +2101,7 @@ static void __exit depca_module_exit (void) | |||
2112 | 2101 | ||
2113 | for (i = 0; depca_io_ports[i].iobase; i++) { | 2102 | for (i = 0; depca_io_ports[i].iobase; i++) { |
2114 | if (depca_io_ports[i].device) { | 2103 | if (depca_io_ports[i].device) { |
2104 | depca_io_ports[i].device->dev.platform_data = NULL; | ||
2115 | platform_device_unregister (depca_io_ports[i].device); | 2105 | platform_device_unregister (depca_io_ports[i].device); |
2116 | depca_io_ports[i].device = NULL; | 2106 | depca_io_ports[i].device = NULL; |
2117 | } | 2107 | } |
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index a74a5cfaf5bc..2fb3101cb33e 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c | |||
@@ -285,18 +285,8 @@ static struct device_driver jazz_sonic_driver = { | |||
285 | .remove = __devexit_p(jazz_sonic_device_remove), | 285 | .remove = __devexit_p(jazz_sonic_device_remove), |
286 | }; | 286 | }; |
287 | 287 | ||
288 | static void jazz_sonic_platform_release (struct device *device) | ||
289 | { | ||
290 | struct platform_device *pldev; | ||
291 | |||
292 | /* free device */ | ||
293 | pldev = to_platform_device (device); | ||
294 | kfree (pldev); | ||
295 | } | ||
296 | |||
297 | static int __init jazz_sonic_init_module(void) | 288 | static int __init jazz_sonic_init_module(void) |
298 | { | 289 | { |
299 | struct platform_device *pldev; | ||
300 | int err; | 290 | int err; |
301 | 291 | ||
302 | if ((err = driver_register(&jazz_sonic_driver))) { | 292 | if ((err = driver_register(&jazz_sonic_driver))) { |
@@ -304,27 +294,19 @@ static int __init jazz_sonic_init_module(void) | |||
304 | return err; | 294 | return err; |
305 | } | 295 | } |
306 | 296 | ||
307 | jazz_sonic_device = NULL; | 297 | jazz_sonic_device = platform_device_alloc(jazz_sonic_string, 0); |
308 | 298 | if (!jazz_sonnic_device) | |
309 | if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) { | ||
310 | goto out_unregister; | 299 | goto out_unregister; |
311 | } | ||
312 | 300 | ||
313 | memset(pldev, 0, sizeof (*pldev)); | 301 | if (platform_device_add(jazz_sonic_device)) { |
314 | pldev->name = jazz_sonic_string; | 302 | platform_device_put(jazz_sonic_device); |
315 | pldev->id = 0; | ||
316 | pldev->dev.release = jazz_sonic_platform_release; | ||
317 | jazz_sonic_device = pldev; | ||
318 | |||
319 | if (platform_device_register (pldev)) { | ||
320 | kfree(pldev); | ||
321 | jazz_sonic_device = NULL; | 303 | jazz_sonic_device = NULL; |
322 | } | 304 | } |
323 | 305 | ||
324 | return 0; | 306 | return 0; |
325 | 307 | ||
326 | out_unregister: | 308 | out_unregister: |
327 | platform_device_unregister(pldev); | 309 | driver_unregister(&jazz_sonic_driver); |
328 | 310 | ||
329 | return -ENOMEM; | 311 | return -ENOMEM; |
330 | } | 312 | } |
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 | } |