aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tokenring/smctr.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-08-07 16:47:33 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-13 00:54:54 -0400
commit582b95c2709cd58913ec2a31b0266ba0aa67b03d (patch)
tree69d58ca7891dbee1dd35eee630b0344f991698a5 /drivers/net/tokenring/smctr.c
parent176edd52366d59350717b0bf6865b1d7ece156cc (diff)
drivers/net/tokenring: Use status field rather than state field
In general in this file, it is the status field, not the state field, that contains values like OPEN and CLOSED. Indeed, in the first error case, it is the field status that is initialized. I have thus assumed that all of the error handling code should be the same, and moved it to the end of the function to emphasize its commonality. Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tokenring/smctr.c')
-rw-r--r--drivers/net/tokenring/smctr.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 6515894c83f5..23e012f5bbf4 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -3091,11 +3091,7 @@ static int smctr_lobe_media_test(struct net_device *dev)
3091 /* Setup the lobe media test. */ 3091 /* Setup the lobe media test. */
3092 smctr_lobe_media_test_cmd(dev); 3092 smctr_lobe_media_test_cmd(dev);
3093 if(smctr_wait_cmd(dev)) 3093 if(smctr_wait_cmd(dev))
3094 { 3094 goto err;
3095 smctr_reset_adapter(dev);
3096 tp->status = CLOSED;
3097 return (LOBE_MEDIA_TEST_FAILED);
3098 }
3099 3095
3100 /* Tx lobe media test frames. */ 3096 /* Tx lobe media test frames. */
3101 for(i = 0; i < 1500; ++i) 3097 for(i = 0; i < 1500; ++i)
@@ -3103,20 +3099,12 @@ static int smctr_lobe_media_test(struct net_device *dev)
3103 if(smctr_send_lobe_media_test(dev)) 3099 if(smctr_send_lobe_media_test(dev))
3104 { 3100 {
3105 if(perror) 3101 if(perror)
3106 { 3102 goto err;
3107 smctr_reset_adapter(dev);
3108 tp->state = CLOSED;
3109 return (LOBE_MEDIA_TEST_FAILED);
3110 }
3111 else 3103 else
3112 { 3104 {
3113 perror = 1; 3105 perror = 1;
3114 if(smctr_lobe_media_test_cmd(dev)) 3106 if(smctr_lobe_media_test_cmd(dev))
3115 { 3107 goto err;
3116 smctr_reset_adapter(dev);
3117 tp->state = CLOSED;
3118 return (LOBE_MEDIA_TEST_FAILED);
3119 }
3120 } 3108 }
3121 } 3109 }
3122 } 3110 }
@@ -3124,28 +3112,24 @@ static int smctr_lobe_media_test(struct net_device *dev)
3124 if(smctr_send_dat(dev)) 3112 if(smctr_send_dat(dev))
3125 { 3113 {
3126 if(smctr_send_dat(dev)) 3114 if(smctr_send_dat(dev))
3127 { 3115 goto err;
3128 smctr_reset_adapter(dev);
3129 tp->state = CLOSED;
3130 return (LOBE_MEDIA_TEST_FAILED);
3131 }
3132 } 3116 }
3133 3117
3134 /* Check if any frames received during test. */ 3118 /* Check if any frames received during test. */
3135 if((tp->rx_fcb_curr[MAC_QUEUE]->frame_status) 3119 if((tp->rx_fcb_curr[MAC_QUEUE]->frame_status)
3136 || (tp->rx_fcb_curr[NON_MAC_QUEUE]->frame_status)) 3120 || (tp->rx_fcb_curr[NON_MAC_QUEUE]->frame_status))
3137 { 3121 goto err;
3138 smctr_reset_adapter(dev);
3139 tp->state = CLOSED;
3140 return (LOBE_MEDIA_TEST_FAILED);
3141 }
3142 3122
3143 /* Set receive mask to "Promisc" mode. */ 3123 /* Set receive mask to "Promisc" mode. */
3144 tp->receive_mask = saved_rcv_mask; 3124 tp->receive_mask = saved_rcv_mask;
3145 3125
3146 smctr_chg_rx_mask(dev); 3126 smctr_chg_rx_mask(dev);
3147 3127
3148 return (0); 3128 return 0;
3129err:
3130 smctr_reset_adapter(dev);
3131 tp->status = CLOSED;
3132 return LOBE_MEDIA_TEST_FAILED;
3149} 3133}
3150 3134
3151static int smctr_lobe_media_test_cmd(struct net_device *dev) 3135static int smctr_lobe_media_test_cmd(struct net_device *dev)