aboutsummaryrefslogtreecommitdiffstats
path: root/4a-hal
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2019-03-05 15:47:38 +0100
committerJonathan Aillet <jonathan.aillet@iot.bzh>2019-05-22 16:31:59 +0200
commit196e723e79a1f5eae41cf4a8b1450df0679a4af8 (patch)
tree6f2a37c49e1a4211d6b34a1e1efa586276b68cb1 /4a-hal
parentbea6bdb2e661b1de821a65e338f57f9e7d2f5c0a (diff)
Clarify use of linked list
Clarify use of linked list by renaming some variables and functions. BUG-AGL: SPEC-2329 Change-Id: I21ada0b2914c99dfeecfcb6b55c8976dee1a0cd7 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to '4a-hal')
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c2
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c4
-rw-r--r--4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c15
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager-cb.c9
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager.c8
-rw-r--r--4a-hal/4a-hal-manager/4a-hal-manager.h4
6 files changed, 21 insertions, 21 deletions
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
index 4a1ca8f..a6f6895 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-api-loader.c
@@ -175,7 +175,7 @@ int HalCtlsCreateApi(afb_api_t apiHandle, char *path, struct HalMgrData *HalMgrG
}
// Allocation of current hal controller data
- currentCtlHalData = HalUtlAddHalApiToHalList(&HalMgrGlobalData->first);
+ currentCtlHalData = HalUtlAddHalApiToHalList(&HalMgrGlobalData->halDataList);
if(! currentCtlHalData)
return -4;
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
index 98d8d53..c38b057 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-cb.c
@@ -402,7 +402,7 @@ int HalCtlsHalMapConfig(afb_api_t apiHandle, CtlSectionT *section, json_object *
* HAL controllers verbs functions *
******************************************************************************/
-json_object *HalCtlsGetJsonArrayForMixerDataTable(afb_api_t apiHandle, struct CtlHalMixerData **firstMixerData, enum MixerDataType dataType)
+json_object *HalCtlsGetJsonArrayForMixerDataTable(afb_api_t apiHandle, struct CtlHalMixerData **mixerDataList, enum MixerDataType dataType)
{
json_object *mixerDataArrayJ, *currentMixerDataJ;
@@ -419,7 +419,7 @@ json_object *HalCtlsGetJsonArrayForMixerDataTable(afb_api_t apiHandle, struct Ct
return NULL;
}
- currentMixerData = *firstMixerData;
+ currentMixerData = *mixerDataList;
while(currentMixerData) {
switch(dataType) {
diff --git a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
index a9908de..1839261 100644
--- a/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
+++ b/4a-hal/4a-hal-controllers/4a-hal-controllers-mixer-link.c
@@ -38,7 +38,7 @@
* HAL controllers handle mixer calls functions *
******************************************************************************/
-int HalCtlsHandleMixerData(afb_api_t apiHandle, struct CtlHalMixerData **firstMixerData, json_object *currentDataJ, enum MixerDataType dataType)
+int HalCtlsHandleMixerData(afb_api_t apiHandle, struct CtlHalMixerData **mixerDataList, json_object *currentDataJ, enum MixerDataType dataType)
{
int idx, mixerDataNb, verbStart, size;
int err = (int) MIXER_NO_ERROR;
@@ -106,14 +106,14 @@ int HalCtlsHandleMixerData(afb_api_t apiHandle, struct CtlHalMixerData **firstMi
case MIXER_DATA_PLAYBACKS:
case MIXER_DATA_CAPTURES:
- currentMixerData = HalUtlAddMixerDataToMixerDataList(firstMixerData);
+ currentMixerData = HalUtlAddMixerDataToMixerDataList(mixerDataList);
currentMixerData->verb = strdup((dataType == MIXER_DATA_PLAYBACKS) ? HAL_PLAYBACK_ID : HAL_CAPTURE_ID);
currentMixerData->verbToCall = strdup(currentDataVerbName);
if((! currentMixerData->verb) ||
(! currentMixerData->verbToCall)) {
- HalUtlRemoveSelectedMixerData(firstMixerData, currentMixerData);
+ HalUtlRemoveSelectedMixerData(mixerDataList, currentMixerData);
err += (int) MIXER_ERROR_STREAM_ALLOCATION_FAILED;
}
break;
@@ -129,7 +129,7 @@ int HalCtlsHandleMixerData(afb_api_t apiHandle, struct CtlHalMixerData **firstMi
HAL_PLAYBACK_ID,
"Playback action transferred to mixer",
HalUtlActionOnPlayback,
- (void *) *firstMixerData,
+ (void *) *mixerDataList,
NULL,
0,
0)) {
@@ -143,7 +143,7 @@ int HalCtlsHandleMixerData(afb_api_t apiHandle, struct CtlHalMixerData **firstMi
HAL_CAPTURE_ID,
"Capture action transferred to mixer",
HalUtlActionOnCapture,
- (void *) *firstMixerData,
+ (void *) *mixerDataList,
NULL,
0,
0)) {
@@ -207,7 +207,6 @@ int HalCtlsAttachToMixer(afb_api_t apiHandle)
CtlConfigT *ctrlConfig;
struct SpecificHalData *currentCtlHalData, *concurentHalData = NULL;
- struct SpecificHalData **firstHalData;
json_object *responseJ = NULL;
@@ -239,8 +238,8 @@ int HalCtlsAttachToMixer(afb_api_t apiHandle)
break;
}
- firstHalData = HalMngGetFirstHalData();
- if((concurentHalData = HalUtlSearchReadyHalDataByCardId(firstHalData, currentCtlHalData->sndCardId))) {
+ concurentHalData = HalUtlSearchReadyHalDataByCardId(HalMngGetHalDataList(), currentCtlHalData->sndCardId);
+ if(concurentHalData) {
AFB_API_ERROR(apiHandle,
"Trying to attach mixer for hal '%s' but the alsa device %i is already in use with mixer by hal '%s'",
currentCtlHalData->apiName,
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
index f919afe..77ae52f 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager-cb.c
@@ -77,7 +77,7 @@ void HalMgrLoaded(afb_req_t request)
return;
}
- currentHalData = HalMgrGlobalData->first;
+ currentHalData = HalMgrGlobalData->halDataList;
if(! currentHalData) {
afb_req_success(request, NULL, "No Hal Api loaded");
@@ -174,7 +174,7 @@ void HalMgrLoad(afb_req_t request)
return;
}
- addedHal = HalUtlAddHalApiToHalList(&HalMgrGlobalData->first);
+ addedHal = HalUtlAddHalApiToHalList(&HalMgrGlobalData->halDataList);
addedHal->internal = 0;
// TBD JAI : initialize external to unavailable once event from external hal will be handled
@@ -232,7 +232,8 @@ void HalMgrUnload(afb_req_t request)
return;
}
- if(! (HalToRemove = HalUtlSearchHalDataByApiName(&HalMgrGlobalData->first, apiName))) {
+ HalToRemove = HalUtlSearchHalDataByApiName(&HalMgrGlobalData->halDataList, apiName);
+ if(! HalToRemove) {
afb_req_fail(request, "requested_api", "Can't find api to remove");
return;
}
@@ -242,7 +243,7 @@ void HalMgrUnload(afb_req_t request)
return;
}
- if(HalUtlRemoveSelectedHalFromList(&HalMgrGlobalData->first, HalToRemove)) {
+ if(HalUtlRemoveSelectedHalFromList(&HalMgrGlobalData->halDataList, HalToRemove)) {
afb_req_fail(request, "unregister_error", "Didn't succeed to remove specified api");
return;
}
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.c b/4a-hal/4a-hal-manager/4a-hal-manager.c
index 75177e7..017199f 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager.c
+++ b/4a-hal/4a-hal-manager/4a-hal-manager.c
@@ -54,13 +54,13 @@ afb_verb_t HalManagerApiStaticVerbs[] =
};
/*******************************************************************************
- * HAL Manager get first 'SpecificHalData' structure *
+ * HAL Manager get 'SpecificHalData' linked list *
from HAL list function *
******************************************************************************/
-struct SpecificHalData **HalMngGetFirstHalData(void)
+struct SpecificHalData **HalMngGetHalDataList(void)
{
- return &localHalMgrGlobalData.first;
+ return &localHalMgrGlobalData.halDataList;
}
/*******************************************************************************
@@ -85,7 +85,7 @@ static int HalMgrInitApi(afb_api_t apiHandle)
if(HalUtlInitializeHalMgrData(apiHandle, HalMgrGlobalData, HAL_MANAGER_API_NAME, HAL_MANAGER_API_INFO))
return -3;
- currentCtlHalData = HalMgrGlobalData->first;
+ currentCtlHalData = HalMgrGlobalData->halDataList;
while(currentCtlHalData) {
if(! currentCtlHalData->apiName)
diff --git a/4a-hal/4a-hal-manager/4a-hal-manager.h b/4a-hal/4a-hal-manager/4a-hal-manager.h
index 9749edc..b9eabba 100644
--- a/4a-hal/4a-hal-manager/4a-hal-manager.h
+++ b/4a-hal/4a-hal-manager/4a-hal-manager.h
@@ -23,7 +23,7 @@
#define HAL_MANAGER_API_NAME "4a-hal-manager"
#define HAL_MANAGER_API_INFO "Manager for 4A HAL APIs"
-// HAL Manager get first 'SpecificHalData' structure from HAL list function
-struct SpecificHalData **HalMngGetFirstHalData(void);
+// HAL Manager get 'SpecificHalData' linked list
+struct SpecificHalData **HalMngGetHalDataList(void);
#endif /* _HALMGR_BINDING_INCLUDE_ */ \ No newline at end of file