diff options
author | Hal Rosenstock <halr@voltaire.com> | 2005-07-27 14:45:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-27 19:26:10 -0400 |
commit | f68bcc2df8115b4ea45bfa4f8de22ec7232562b5 (patch) | |
tree | 6ea6cb7843f8e5ff7aa19de97b20918b91203b5e /drivers/infiniband | |
parent | 6a0c435ef9e2473934442282054d0f58235d1de2 (diff) |
[PATCH] IB: Minor cleanup during MAD startup and shutdown
Minor cleanup during startup and shutdown
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/mad.c | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 7af8f7f87849..9719fa6c14f7 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -2487,14 +2487,6 @@ static int ib_mad_port_open(struct ib_device *device, | |||
2487 | unsigned long flags; | 2487 | unsigned long flags; |
2488 | char name[sizeof "ib_mad123"]; | 2488 | char name[sizeof "ib_mad123"]; |
2489 | 2489 | ||
2490 | /* First, check if port already open at MAD layer */ | ||
2491 | port_priv = ib_get_mad_port(device, port_num); | ||
2492 | if (port_priv) { | ||
2493 | printk(KERN_DEBUG PFX "%s port %d already open\n", | ||
2494 | device->name, port_num); | ||
2495 | return 0; | ||
2496 | } | ||
2497 | |||
2498 | /* Create new device info */ | 2490 | /* Create new device info */ |
2499 | port_priv = kmalloc(sizeof *port_priv, GFP_KERNEL); | 2491 | port_priv = kmalloc(sizeof *port_priv, GFP_KERNEL); |
2500 | if (!port_priv) { | 2492 | if (!port_priv) { |
@@ -2619,7 +2611,7 @@ static int ib_mad_port_close(struct ib_device *device, int port_num) | |||
2619 | 2611 | ||
2620 | static void ib_mad_init_device(struct ib_device *device) | 2612 | static void ib_mad_init_device(struct ib_device *device) |
2621 | { | 2613 | { |
2622 | int ret, num_ports, cur_port, i, ret2; | 2614 | int num_ports, cur_port, i; |
2623 | 2615 | ||
2624 | if (device->node_type == IB_NODE_SWITCH) { | 2616 | if (device->node_type == IB_NODE_SWITCH) { |
2625 | num_ports = 1; | 2617 | num_ports = 1; |
@@ -2629,47 +2621,37 @@ static void ib_mad_init_device(struct ib_device *device) | |||
2629 | cur_port = 1; | 2621 | cur_port = 1; |
2630 | } | 2622 | } |
2631 | for (i = 0; i < num_ports; i++, cur_port++) { | 2623 | for (i = 0; i < num_ports; i++, cur_port++) { |
2632 | ret = ib_mad_port_open(device, cur_port); | 2624 | if (ib_mad_port_open(device, cur_port)) { |
2633 | if (ret) { | ||
2634 | printk(KERN_ERR PFX "Couldn't open %s port %d\n", | 2625 | printk(KERN_ERR PFX "Couldn't open %s port %d\n", |
2635 | device->name, cur_port); | 2626 | device->name, cur_port); |
2636 | goto error_device_open; | 2627 | goto error_device_open; |
2637 | } | 2628 | } |
2638 | ret = ib_agent_port_open(device, cur_port); | 2629 | if (ib_agent_port_open(device, cur_port)) { |
2639 | if (ret) { | ||
2640 | printk(KERN_ERR PFX "Couldn't open %s port %d " | 2630 | printk(KERN_ERR PFX "Couldn't open %s port %d " |
2641 | "for agents\n", | 2631 | "for agents\n", |
2642 | device->name, cur_port); | 2632 | device->name, cur_port); |
2643 | goto error_device_open; | 2633 | goto error_device_open; |
2644 | } | 2634 | } |
2645 | } | 2635 | } |
2646 | 2636 | return; | |
2647 | goto error_device_query; | ||
2648 | 2637 | ||
2649 | error_device_open: | 2638 | error_device_open: |
2650 | while (i > 0) { | 2639 | while (i > 0) { |
2651 | cur_port--; | 2640 | cur_port--; |
2652 | ret2 = ib_agent_port_close(device, cur_port); | 2641 | if (ib_agent_port_close(device, cur_port)) |
2653 | if (ret2) { | ||
2654 | printk(KERN_ERR PFX "Couldn't close %s port %d " | 2642 | printk(KERN_ERR PFX "Couldn't close %s port %d " |
2655 | "for agents\n", | 2643 | "for agents\n", |
2656 | device->name, cur_port); | 2644 | device->name, cur_port); |
2657 | } | 2645 | if (ib_mad_port_close(device, cur_port)) |
2658 | ret2 = ib_mad_port_close(device, cur_port); | ||
2659 | if (ret2) { | ||
2660 | printk(KERN_ERR PFX "Couldn't close %s port %d\n", | 2646 | printk(KERN_ERR PFX "Couldn't close %s port %d\n", |
2661 | device->name, cur_port); | 2647 | device->name, cur_port); |
2662 | } | ||
2663 | i--; | 2648 | i--; |
2664 | } | 2649 | } |
2665 | |||
2666 | error_device_query: | ||
2667 | return; | ||
2668 | } | 2650 | } |
2669 | 2651 | ||
2670 | static void ib_mad_remove_device(struct ib_device *device) | 2652 | static void ib_mad_remove_device(struct ib_device *device) |
2671 | { | 2653 | { |
2672 | int ret = 0, i, num_ports, cur_port, ret2; | 2654 | int i, num_ports, cur_port; |
2673 | 2655 | ||
2674 | if (device->node_type == IB_NODE_SWITCH) { | 2656 | if (device->node_type == IB_NODE_SWITCH) { |
2675 | num_ports = 1; | 2657 | num_ports = 1; |
@@ -2679,21 +2661,13 @@ static void ib_mad_remove_device(struct ib_device *device) | |||
2679 | cur_port = 1; | 2661 | cur_port = 1; |
2680 | } | 2662 | } |
2681 | for (i = 0; i < num_ports; i++, cur_port++) { | 2663 | for (i = 0; i < num_ports; i++, cur_port++) { |
2682 | ret2 = ib_agent_port_close(device, cur_port); | 2664 | if (ib_agent_port_close(device, cur_port)) |
2683 | if (ret2) { | ||
2684 | printk(KERN_ERR PFX "Couldn't close %s port %d " | 2665 | printk(KERN_ERR PFX "Couldn't close %s port %d " |
2685 | "for agents\n", | 2666 | "for agents\n", |
2686 | device->name, cur_port); | 2667 | device->name, cur_port); |
2687 | if (!ret) | 2668 | if (ib_mad_port_close(device, cur_port)) |
2688 | ret = ret2; | ||
2689 | } | ||
2690 | ret2 = ib_mad_port_close(device, cur_port); | ||
2691 | if (ret2) { | ||
2692 | printk(KERN_ERR PFX "Couldn't close %s port %d\n", | 2669 | printk(KERN_ERR PFX "Couldn't close %s port %d\n", |
2693 | device->name, cur_port); | 2670 | device->name, cur_port); |
2694 | if (!ret) | ||
2695 | ret = ret2; | ||
2696 | } | ||
2697 | } | 2671 | } |
2698 | } | 2672 | } |
2699 | 2673 | ||