master/fsm_master.c
changeset 992 50a44cbd30af
parent 987 3c9090138140
child 998 05a24788f3b2
equal deleted inserted replaced
991:2548ca639b1f 992:50a44cbd30af
   226 
   226 
   227 #ifdef EC_EOE
   227 #ifdef EC_EOE
   228             ec_master_eoe_stop(master);
   228             ec_master_eoe_stop(master);
   229             ec_master_clear_eoe_handlers(master);
   229             ec_master_clear_eoe_handlers(master);
   230 #endif
   230 #endif
   231             ec_master_destroy_slaves(master);
   231             ec_master_clear_slaves(master);
   232             master->configs_attached = 0;
   232             master->configs_attached = 0;
   233 
   233 
   234             master->slave_count = datagram->working_counter;
   234             master->slave_count = datagram->working_counter;
   235 
   235 
   236             if (!master->slave_count) {
   236             if (!master->slave_count) {
   244             // init slaves
   244             // init slaves
   245             for (i = 0; i < master->slave_count; i++) {
   245             for (i = 0; i < master->slave_count; i++) {
   246                 if (!(slave = (ec_slave_t *) kmalloc(sizeof(ec_slave_t),
   246                 if (!(slave = (ec_slave_t *) kmalloc(sizeof(ec_slave_t),
   247                                 GFP_ATOMIC))) {
   247                                 GFP_ATOMIC))) {
   248                     EC_ERR("Failed to allocate slave %u!\n", i);
   248                     EC_ERR("Failed to allocate slave %u!\n", i);
   249                     ec_master_destroy_slaves(master);
   249                     ec_master_clear_slaves(master);
   250                     master->scan_busy = 0;
   250                     master->scan_busy = 0;
   251                     wake_up_interruptible(&master->scan_queue);
   251                     wake_up_interruptible(&master->scan_queue);
   252                     fsm->state = ec_fsm_master_state_error;
   252                     fsm->state = ec_fsm_master_state_error;
   253                     return;
   253                     return;
   254                 }
   254                 }
   255 
   255 
   256                 if (ec_slave_init(slave, master, i, i + 1)) {
   256                 ec_slave_init(slave, master, i, i + 1);
   257                     // freeing of "slave" already done
       
   258                     ec_master_destroy_slaves(master);
       
   259                     master->scan_busy = 0;
       
   260                     wake_up_interruptible(&master->scan_queue);
       
   261                     fsm->state = ec_fsm_master_state_error;
       
   262                     return;
       
   263                 }
       
   264 
   257 
   265                 // do not force reconfiguration in operation mode to avoid
   258                 // do not force reconfiguration in operation mode to avoid
   266                 // unnecesssary process data interruptions
   259                 // unnecesssary process data interruptions
   267                 if (master->mode != EC_MASTER_MODE_OPERATION)
   260                 if (master->mode != EC_MASTER_MODE_OPERATION)
   268                     slave->force_config = 1;
   261                     slave->force_config = 1;