master/fsm_master.c
changeset 2030 2bd8ad8bf41f
parent 2029 5ef6507fc77a
child 2031 7a025a9e192d
equal deleted inserted replaced
2029:5ef6507fc77a 2030:2bd8ad8bf41f
  1066     if (ec_fsm_sii_exec(&fsm->fsm_sii)) return;
  1066     if (ec_fsm_sii_exec(&fsm->fsm_sii)) return;
  1067 
  1067 
  1068     if (!ec_fsm_sii_success(&fsm->fsm_sii)) {
  1068     if (!ec_fsm_sii_success(&fsm->fsm_sii)) {
  1069         EC_SLAVE_ERR(slave, "Failed to write SII data.\n");
  1069         EC_SLAVE_ERR(slave, "Failed to write SII data.\n");
  1070         request->state = EC_INT_REQUEST_FAILURE;
  1070         request->state = EC_INT_REQUEST_FAILURE;
       
  1071         kref_put(&request->refcount,ec_master_sii_write_request_release);
  1071         wake_up(&master->sii_queue);
  1072         wake_up(&master->sii_queue);
  1072         ec_fsm_master_restart(fsm);
  1073         ec_fsm_master_restart(fsm);
  1073         return;
  1074         return;
  1074     }
  1075     }
  1075 
  1076 
  1094         slave->effective_alias = slave->sii.alias;
  1095         slave->effective_alias = slave->sii.alias;
  1095     }
  1096     }
  1096     // TODO: Evaluate other SII contents!
  1097     // TODO: Evaluate other SII contents!
  1097 
  1098 
  1098     request->state = EC_INT_REQUEST_SUCCESS;
  1099     request->state = EC_INT_REQUEST_SUCCESS;
       
  1100     kref_put(&request->refcount,ec_master_sii_write_request_release);
  1099     wake_up(&master->sii_queue);
  1101     wake_up(&master->sii_queue);
  1100 
  1102 
  1101     // check for another SII write request
  1103     // check for another SII write request
  1102     if (ec_fsm_master_action_process_sii(fsm))
  1104     if (ec_fsm_master_action_process_sii(fsm))
  1103         return; // processing another request
  1105         return; // processing another request
  1226     ec_fsm_master_restart(fsm);
  1228     ec_fsm_master_restart(fsm);
  1227 }
  1229 }
  1228 
  1230 
  1229 /*****************************************************************************/
  1231 /*****************************************************************************/
  1230 
  1232 
       
  1233 /** called by kref_put if the SII write request's refcount becomes zero.
       
  1234  *
       
  1235  */
       
  1236 void ec_master_sii_write_request_release(struct kref *ref)
       
  1237 {
       
  1238     ec_sii_write_request_t *request = container_of(ref, ec_sii_write_request_t, refcount);
       
  1239     EC_SLAVE_DBG(request->slave, 1, "Releasing SII write request %p.\n",request);
       
  1240     kfree(request->words);
       
  1241     kfree(request);
       
  1242 }
       
  1243 
       
  1244 /*****************************************************************************/
       
  1245 
  1231 /** called by kref_put if the SDO request's refcount becomes zero.
  1246 /** called by kref_put if the SDO request's refcount becomes zero.
  1232  *
  1247  *
  1233  */
  1248  */
  1234 void ec_master_sdo_request_release(struct kref *ref)
  1249 void ec_master_sdo_request_release(struct kref *ref)
  1235 {
  1250 {