diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-10-08 13:08:48 +0900 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-10-10 14:41:47 +0200 |
commit | 88fdae52930912a3e81c3d3e412cc51051116de2 (patch) | |
tree | bcf74383f2a00f89a365194dc1b238f0c867a0d2 /plugins | |
parent | 0a1ab23cfbc98530f6036d5714fa557724e8e1d6 (diff) | |
download | connman-88fdae52930912a3e81c3d3e412cc51051116de2.tar.gz connman-88fdae52930912a3e81c3d3e412cc51051116de2.tar.bz2 connman-88fdae52930912a3e81c3d3e412cc51051116de2.zip |
Fix broken libiWmxSDK callback parameter handling
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.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/iwmxsdk.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/iwmxsdk.c b/plugins/iwmxsdk.c index 52437f50..f8a05014 100644 --- a/plugins/iwmxsdk.c +++ b/plugins/iwmxsdk.c @@ -47,7 +47,14 @@ static struct wmxsdk *g_iwmx_sdk_devs[IWMX_SDK_DEV_MAX]; 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; |