No master locking, if no EoE devices are "up".

This commit is contained in:
Florian Pose
2006-05-12 12:40:45 +00:00
parent 42247d01f9
commit 0afb6324b8
3 changed files with 20 additions and 2 deletions

View File

@@ -262,6 +262,18 @@ void ec_eoe_run(ec_eoe_t *eoe /**< EoE object */)
/*****************************************************************************/
/**
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.
*/

View File

@@ -66,7 +66,7 @@ struct ec_eoe
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 @@ struct ec_eoe
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 *);
/*****************************************************************************/

View File

@@ -874,9 +874,14 @@ void ec_master_run_eoe(void *data /**< master pointer */)
{
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) {