Removed checking for NULL slave pointer in EoE handler; added comments.
authorFlorian Pose <fp@igh-essen.com>
Thu, 09 Aug 2007 14:38:18 +0000
changeset 689 880b556a6efc
parent 688 eeeaf9106d75
child 690 5e231f6a3d2e
Removed checking for NULL slave pointer in EoE handler; added comments.
master/ethernet.c
--- a/master/ethernet.c	Thu Aug 09 14:28:54 2007 +0000
+++ b/master/ethernet.c	Thu Aug 09 14:38:18 2007 +0000
@@ -117,6 +117,8 @@
     eoe->tx_rate = 0;
     eoe->rate_jiffies = 0;
 
+    /* device name eoe<MASTER>s<SLAVE>, because system tools don't like
+     * hyphens etc. in interface names. */
     sprintf(name, "eoe%us%u", slave->master->index, slave->ring_position);
 
     if (!(eoe->dev = alloc_netdev(sizeof(ec_eoe_t *), name, ether_setup))) {
@@ -393,7 +395,7 @@
         return;
     }
 
-    if (mbox_prot != 0x02) { // EoE
+    if (mbox_prot != 0x02) { // EoE FIXME mailbox handler necessary
         eoe->stats.rx_errors++;
         eoe->state = ec_eoe_state_tx_start;
         return;
@@ -638,11 +640,7 @@
     netif_start_queue(dev);
     eoe->tx_queue_active = 1;
     EC_INFO("%s opened.\n", dev->name);
-    if (!eoe->slave)
-        EC_WARN("Device %s is not coupled to any EoE slave!\n", dev->name);
-    else {
-        ec_slave_request_state(eoe->slave, EC_SLAVE_STATE_OP);
-    }
+    ec_slave_request_state(eoe->slave, EC_SLAVE_STATE_OP);
     return 0;
 }
 
@@ -660,8 +658,7 @@
     eoe->opened = 0;
     ec_eoe_flush(eoe);
     EC_INFO("%s stopped.\n", dev->name);
-    if (eoe->slave)
-        ec_slave_request_state(eoe->slave, EC_SLAVE_STATE_PREOP);
+    ec_slave_request_state(eoe->slave, EC_SLAVE_STATE_PREOP);
     return 0;
 }