FreeBSD/sys/dev/isci/scil/scif_sas_controller.c
/**

 * @brief This routine is to allocate the memory for creating a smp phy object.
 *
 * @param[in] scif_controller handle to frame controller
 *
 * @return SCIF_SAS_SMP_PHY_T * An allocated space for smp phy. If failed to allocate,
 *            return NULL.
 */
@brief This routine is to allocate the memory for creating a smp phy object.
@param[in] scif_controller handle to frame controller

@return SCIF_SAS_SMP_PHY_T * An allocated space for smp phy. If failed to allocate,
return NULL.
@brief This routine is to allocate the memory for creating a smp phy object . @param [ in ] scif_controller handle to frame controller @return SCIF_SAS_SMP_PHY_T * An allocated space for smp phy . If failed to allocate return NULL .
SCIF_SAS_SMP_PHY_T * scif_sas_controller_allocate_smp_phy(
   SCIF_SAS_CONTROLLER_T * fw_controller
)
{
   SCIF_SAS_SMP_PHY_T * smp_phy;
   SCIF_LOG_TRACE((
      sci_base_object_get_logger(fw_controller),
      SCIF_LOG_OBJECT_CONTROLLER,
      "scif_controller_allocate_smp_phy(0x%x) enter\n",
      fw_controller
   ));
   if( !sci_fast_list_is_empty(&fw_controller->smp_phy_memory_list) )
   {
      smp_phy = (SCIF_SAS_SMP_PHY_T *)
         sci_fast_list_remove_head(&fw_controller->smp_phy_memory_list);
      memset((char*)smp_phy,
             0,
             sizeof(SCIF_SAS_SMP_PHY_T)
            );
      return smp_phy;
   }
   else
      return NULL;
}
SCIF_SAS_SMP_PHY_T * scif_sas_controller_allocate_smp_phy ( SCIF_SAS_CONTROLLER_T * fw_controller ) { SCIF_SAS_SMP_PHY_T * smp_phy ; SCIF_LOG_TRACE ( ( sci_base_object_get_logger ( fw_controller ) , SCIF_LOG_OBJECT_CONTROLLER , " \n " , fw_controller ) ) ; if ( ! sci_fast_list_is_empty ( & fw_controller -> smp_phy_memory_list ) ) { smp_phy = ( SCIF_SAS_SMP_PHY_T * ) sci_fast_list_remove_head ( & fw_controller -> smp_phy_memory_list ) ; memset ( ( char * ) smp_phy , 0 , sizeof ( SCIF_SAS_SMP_PHY_T ) ) ; return smp_phy ; } else return NULL ; }
@brief This routine is to allocate the memory for creating a smp phy object.
@brief This routine is to allocate the memory for creating a smp phy object .
//clean the memory.