diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2012-05-15 12:09:50 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-05-16 08:42:50 -0400 |
commit | afb6ac598f5c4433ab2aff5932ea2f69f74e75e7 (patch) | |
tree | b796661b844134b458916f7d8565c133c5cfcdd0 | |
parent | f47e22563fcf224411c5460dde6a56a22a602548 (diff) |
s390/qeth: reshuffle initialization
Reshuffle the init function of the qeth driver to ensure
that the driver is usable at the time it is registered.
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index a628f56ae576..739e8566a876 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -5540,43 +5540,41 @@ static int __init qeth_core_init(void) | |||
5540 | rc = qeth_register_dbf_views(); | 5540 | rc = qeth_register_dbf_views(); |
5541 | if (rc) | 5541 | if (rc) |
5542 | goto out_err; | 5542 | goto out_err; |
5543 | rc = ccw_driver_register(&qeth_ccw_driver); | ||
5544 | if (rc) | ||
5545 | goto ccw_err; | ||
5546 | qeth_core_ccwgroup_driver.driver.groups = qeth_drv_attr_groups; | ||
5547 | rc = ccwgroup_driver_register(&qeth_core_ccwgroup_driver); | ||
5548 | if (rc) | ||
5549 | goto ccwgroup_err; | ||
5550 | qeth_core_root_dev = root_device_register("qeth"); | 5543 | qeth_core_root_dev = root_device_register("qeth"); |
5551 | rc = IS_ERR(qeth_core_root_dev) ? PTR_ERR(qeth_core_root_dev) : 0; | 5544 | rc = IS_ERR(qeth_core_root_dev) ? PTR_ERR(qeth_core_root_dev) : 0; |
5552 | if (rc) | 5545 | if (rc) |
5553 | goto register_err; | 5546 | goto register_err; |
5554 | |||
5555 | qeth_core_header_cache = kmem_cache_create("qeth_hdr", | 5547 | qeth_core_header_cache = kmem_cache_create("qeth_hdr", |
5556 | sizeof(struct qeth_hdr) + ETH_HLEN, 64, 0, NULL); | 5548 | sizeof(struct qeth_hdr) + ETH_HLEN, 64, 0, NULL); |
5557 | if (!qeth_core_header_cache) { | 5549 | if (!qeth_core_header_cache) { |
5558 | rc = -ENOMEM; | 5550 | rc = -ENOMEM; |
5559 | goto slab_err; | 5551 | goto slab_err; |
5560 | } | 5552 | } |
5561 | |||
5562 | qeth_qdio_outbuf_cache = kmem_cache_create("qeth_buf", | 5553 | qeth_qdio_outbuf_cache = kmem_cache_create("qeth_buf", |
5563 | sizeof(struct qeth_qdio_out_buffer), 0, 0, NULL); | 5554 | sizeof(struct qeth_qdio_out_buffer), 0, 0, NULL); |
5564 | if (!qeth_qdio_outbuf_cache) { | 5555 | if (!qeth_qdio_outbuf_cache) { |
5565 | rc = -ENOMEM; | 5556 | rc = -ENOMEM; |
5566 | goto cqslab_err; | 5557 | goto cqslab_err; |
5567 | } | 5558 | } |
5559 | rc = ccw_driver_register(&qeth_ccw_driver); | ||
5560 | if (rc) | ||
5561 | goto ccw_err; | ||
5562 | qeth_core_ccwgroup_driver.driver.groups = qeth_drv_attr_groups; | ||
5563 | rc = ccwgroup_driver_register(&qeth_core_ccwgroup_driver); | ||
5564 | if (rc) | ||
5565 | goto ccwgroup_err; | ||
5568 | 5566 | ||
5569 | return 0; | 5567 | return 0; |
5568 | |||
5569 | ccwgroup_err: | ||
5570 | ccw_driver_unregister(&qeth_ccw_driver); | ||
5571 | ccw_err: | ||
5572 | kmem_cache_destroy(qeth_qdio_outbuf_cache); | ||
5570 | cqslab_err: | 5573 | cqslab_err: |
5571 | kmem_cache_destroy(qeth_core_header_cache); | 5574 | kmem_cache_destroy(qeth_core_header_cache); |
5572 | slab_err: | 5575 | slab_err: |
5573 | root_device_unregister(qeth_core_root_dev); | 5576 | root_device_unregister(qeth_core_root_dev); |
5574 | register_err: | 5577 | register_err: |
5575 | ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver); | ||
5576 | ccwgroup_err: | ||
5577 | ccw_driver_unregister(&qeth_ccw_driver); | ||
5578 | ccw_err: | ||
5579 | QETH_DBF_MESSAGE(2, "Initialization failed with code %d\n", rc); | ||
5580 | qeth_unregister_dbf_views(); | 5578 | qeth_unregister_dbf_views(); |
5581 | out_err: | 5579 | out_err: |
5582 | pr_err("Initializing the qeth device driver failed\n"); | 5580 | pr_err("Initializing the qeth device driver failed\n"); |
@@ -5585,11 +5583,11 @@ out_err: | |||
5585 | 5583 | ||
5586 | static void __exit qeth_core_exit(void) | 5584 | static void __exit qeth_core_exit(void) |
5587 | { | 5585 | { |
5588 | root_device_unregister(qeth_core_root_dev); | ||
5589 | ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver); | 5586 | ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver); |
5590 | ccw_driver_unregister(&qeth_ccw_driver); | 5587 | ccw_driver_unregister(&qeth_ccw_driver); |
5591 | kmem_cache_destroy(qeth_qdio_outbuf_cache); | 5588 | kmem_cache_destroy(qeth_qdio_outbuf_cache); |
5592 | kmem_cache_destroy(qeth_core_header_cache); | 5589 | kmem_cache_destroy(qeth_core_header_cache); |
5590 | root_device_unregister(qeth_core_root_dev); | ||
5593 | qeth_unregister_dbf_views(); | 5591 | qeth_unregister_dbf_views(); |
5594 | pr_info("core functions removed\n"); | 5592 | pr_info("core functions removed\n"); |
5595 | } | 5593 | } |