master/fsm_master.c
changeset 1385 241a7511eee9
parent 1380 c2b0ef67e829
child 1386 95ec1e9bcb53
equal deleted inserted replaced
1384:21b5343910c2 1385:241a7511eee9
  1029         wake_up(&master->phy_queue);
  1029         wake_up(&master->phy_queue);
  1030         ec_fsm_master_restart(fsm);
  1030         ec_fsm_master_restart(fsm);
  1031         return;
  1031         return;
  1032     }
  1032     }
  1033     
  1033     
  1034     if (request->dir == EC_DIR_INPUT) { // read request
  1034     if (datagram->working_counter == 1) {
  1035         if (request->data)
  1035         if (request->dir == EC_DIR_INPUT) { // read request
  1036             kfree(request->data);
  1036             if (request->data)
  1037         request->data = kmalloc(request->length, GFP_KERNEL);
  1037                 kfree(request->data);
  1038         if (!request->data) {
  1038             request->data = kmalloc(request->length, GFP_KERNEL);
  1039             EC_ERR("Failed to allocate %u bytes of memory for phy request.\n",
  1039             if (!request->data) {
  1040                     request->length);
  1040                 EC_ERR("Failed to allocate %u bytes of memory for phy request.\n",
  1041             request->state = EC_INT_REQUEST_FAILURE;
  1041                         request->length);
  1042             wake_up(&master->phy_queue);
  1042                 request->state = EC_INT_REQUEST_FAILURE;
  1043             ec_fsm_master_restart(fsm);
  1043                 wake_up(&master->phy_queue);
  1044             return;
  1044                 ec_fsm_master_restart(fsm);
       
  1045                 return;
       
  1046             }
       
  1047             memcpy(request->data, datagram->data, request->length);
  1045         }
  1048         }
  1046         memcpy(request->data, datagram->data, request->length);
  1049 
  1047     }
  1050         request->state = EC_INT_REQUEST_SUCCESS;
  1048 
  1051     } else {
  1049     request->state = EC_INT_REQUEST_SUCCESS;
  1052         request->state = EC_INT_REQUEST_FAILURE;
       
  1053     }
       
  1054 
  1050     wake_up(&master->phy_queue);
  1055     wake_up(&master->phy_queue);
  1051 
  1056 
  1052     // check for another PHY request
  1057     // check for another PHY request
  1053     if (ec_fsm_master_action_process_phy(fsm))
  1058     if (ec_fsm_master_action_process_phy(fsm))
  1054         return; // processing another request
  1059         return; // processing another request