# HG changeset patch # User Florian Pose # Date 1147437645 0 # Node ID f973808540a679af701e0f2513492aa91e87440e # Parent fd04cfde1c4b541561a6b8bb67bd6cab51737ae3 No master locking, if no EoE devices are "up". diff -r fd04cfde1c4b -r f973808540a6 master/ethernet.c --- a/master/ethernet.c Fri May 12 12:38:22 2006 +0000 +++ b/master/ethernet.c Fri May 12 12:40:45 2006 +0000 @@ -263,6 +263,18 @@ /*****************************************************************************/ /** + Returns the state of the device. + \return 1 if the device is "up", 0 if it is "down" +*/ + +unsigned int ec_eoe_active(const ec_eoe_t *eoe /**< EoE object */) +{ + return eoe->opened; +} + +/*****************************************************************************/ + +/** Prints EoE object information. */ diff -r fd04cfde1c4b -r f973808540a6 master/ethernet.h --- a/master/ethernet.h Fri May 12 12:38:22 2006 +0000 +++ b/master/ethernet.h Fri May 12 12:40:45 2006 +0000 @@ -66,7 +66,7 @@ void (*state)(ec_eoe_t *); /**< state function for the state machine */ struct net_device *dev; /**< net_device for virtual ethernet device */ struct net_device_stats stats; /**< device statistics */ - uint8_t opened; /**< net_device is opened */ + unsigned int opened; /**< net_device is opened */ struct sk_buff *rx_skb; /**< current rx socket buffer */ off_t rx_skb_offset; /**< current write pointer in the socket buffer */ size_t rx_skb_size; /**< size of the allocated socket buffer memory */ @@ -86,6 +86,7 @@ int ec_eoe_init(ec_eoe_t *, ec_slave_t *); void ec_eoe_clear(ec_eoe_t *); void ec_eoe_run(ec_eoe_t *); +unsigned int ec_eoe_active(const ec_eoe_t *); void ec_eoe_print(const ec_eoe_t *); /*****************************************************************************/ diff -r fd04cfde1c4b -r f973808540a6 master/master.c --- a/master/master.c Fri May 12 12:38:22 2006 +0000 +++ b/master/master.c Fri May 12 12:40:45 2006 +0000 @@ -874,9 +874,14 @@ { ec_master_t *master = (ec_master_t *) data; ec_eoe_t *eoe; + unsigned int active = 0; + + list_for_each_entry(eoe, &master->eoe_slaves, list) { + if (ec_eoe_active(eoe)) active++; + } // request_cb must return 0, if the lock has been aquired! - if (!master->request_cb(master->cb_data)) + if (active && !master->request_cb(master->cb_data)) { ecrt_master_async_receive(master); list_for_each_entry(eoe, &master->eoe_slaves, list) {