libiWmxSDK broke AGAIN the callback model, by passing a 'device_id'
pointer that is not the original the callback was registered
with.
This makes it impossible to obtain the 'wmxsdk' that contains said
'device_id'.
Thus, implemented device_id_to_wmxsdk() by iterating over the list of
known wmxsdks looking for an index match.
static struct wmxsdk *deviceid_to_wmxsdk(WIMAX_API_DEVICE_ID *device_id)
{
- return container_of(device_id, struct wmxsdk, device_id);
+ unsigned cnt;
+ for (cnt = 0; cnt < IWMX_SDK_DEV_MAX; cnt++) {
+ struct wmxsdk *wmxsdk = g_iwmx_sdk_devs[cnt];
+ if (wmxsdk &&
+ wmxsdk->device_id.deviceIndex == device_id->deviceIndex)
+ return wmxsdk;
+ }
+ return NULL;
}
static WIMAX_API_DEVICE_ID g_api;