This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: Duplicated code of retrieving IssSensor_CreateParams in sensor driver in PSDKR

Part Number: TDA4VM

Hi,

In each IssSensorFxns in sensor driver, there are duplicated code of  retrieving IssSensor_CreateParams from void *pSensorHdl.

Let's take AR0820 as an example:

Following code block repeat 7 times in src/ar0820/iss_sensor_ar0820.c

IssSensors_Handle * pSenHandle = (IssSensors_Handle*)pSensorHdl;
IssSensor_CreateParams * pCreatePrms;

assert(NULL != pSenHandle);
pCreatePrms = pSenHandle->createPrms;
assert(NULL != pCreatePrms);

But since pSenHandle->createPrms points to static IssSensor_CreateParams  ar0820CreatePrms which defined in the same .c file, why not just use ar0820CreatePrms directly?

And BTW, AR0820_Probe() / AR0820_Config()... is not a good name for migrating code, since they are declared static.

It's better to rename them to generic names, such as Sensor_Probe() / Senfor_Config(). Then when you writting a new sensor driver based AR0820, you don't need to rename them by sensor model.