diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2014-10-04 23:19:23 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2014-10-04 23:22:20 +0200 |
commit | 73cde24d9690e2b9d4fb588fa8cc54fa50ef0b3e (patch) | |
tree | 64cbbe20ecc5493a924b6b26abc79f4bab53118c /ipc.c | |
parent | eaecd30476c718c432f6cc3be065b16a311e49a3 (diff) | |
download | hardware_ril_samsung-ril-73cde24d9690e2b9d4fb588fa8cc54fa50ef0b3e.zip hardware_ril_samsung-ril-73cde24d9690e2b9d4fb588fa8cc54fa50ef0b3e.tar.gz hardware_ril_samsung-ril-73cde24d9690e2b9d4fb588fa8cc54fa50ef0b3e.tar.bz2 |
client: RIL state update delegation, no client destroy, IPC client boot in openreplicant-4.2-0004replicant-4.2-0003
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'ipc.c')
-rw-r--r-- | ipc.c | 46 |
1 files changed, 29 insertions, 17 deletions
@@ -153,7 +153,6 @@ int ipc_fmt_create(struct ril_client *client) if (client == NULL) return -1; - RIL_CLIENT_LOCK(client); client->available = 0; @@ -186,12 +185,6 @@ int ipc_fmt_create(struct ril_client *client) goto error; } - rc = ipc_client_boot(ipc_client); - if (rc < 0) { - RIL_LOGE("Booting %s client failed", client->name); - goto error; - } - data->ipc_client = ipc_client; client->data = (void *) data; @@ -273,6 +266,12 @@ int ipc_fmt_open(struct ril_client *client) RIL_CLIENT_LOCK(client); if (client->failures != 1) { + rc = ipc_client_boot(data->ipc_client); + if (rc < 0) { + RIL_LOGE("Booting %s client failed", client->name); + goto error; + } + rc = ipc_client_power_on(data->ipc_client); if (rc < 0) { RIL_LOGE("Powering on %s client failed", client->name); @@ -286,6 +285,9 @@ int ipc_fmt_open(struct ril_client *client) goto error; } + if (client->failures == 1) + ril_radio_state_update(RADIO_STATE_OFF); + eventfd_flush(data->event_fd); client->available = 1; @@ -413,7 +415,7 @@ int ipc_fmt_loop(struct ril_client *client) while (1) { if (!client->available) { RIL_LOGE("%s client is not available", client->name); - return -1; + goto error; } fds_array[0] = data->event_fd; @@ -422,19 +424,20 @@ int ipc_fmt_loop(struct ril_client *client) rc = ipc_client_poll(data->ipc_client, &fds, NULL); if (rc < 0) { RIL_LOGE("Polling %s client failed", client->name); - return -1; + goto error; } if (fds.fds[0] == data->event_fd && fds.count > 0) { rc = eventfd_recv(data->event_fd, &event); if (rc < 0) - return -1; + goto error; switch (event) { case IPC_CLIENT_CLOSE: - return 0; + rc = 0; + goto complete; case IPC_CLIENT_IO_ERROR: - return -1; + goto error; } } @@ -455,7 +458,7 @@ int ipc_fmt_loop(struct ril_client *client) RIL_CLIENT_UNLOCK(client); RIL_UNLOCK(); - return -1; + goto error; } release_wake_lock(RIL_VERSION_STRING); @@ -469,7 +472,7 @@ int ipc_fmt_loop(struct ril_client *client) if (message.data != NULL && message.size > 0) free(message.data); - return -1; + goto error; } if (client->failures) @@ -479,7 +482,18 @@ int ipc_fmt_loop(struct ril_client *client) free(message.data); } - return 0; + rc = 0; + goto complete; + +error: + rc = -1; + + RIL_LOCK(); + ril_radio_state_update(RADIO_STATE_UNAVAILABLE); + RIL_UNLOCK(); + +complete: + return rc; } int ipc_fmt_request_register(struct ril_client *client, int request, @@ -1095,7 +1109,6 @@ struct ril_client_callbacks ipc_rfs_callbacks = { struct ril_client ipc_fmt_client = { .id = RIL_CLIENT_IPC_FMT, .name = "IPC FMT", - .critical = 1, .handlers = &ipc_fmt_handlers, .callbacks = &ipc_fmt_callbacks, }; @@ -1103,7 +1116,6 @@ struct ril_client ipc_fmt_client = { struct ril_client ipc_rfs_client = { .id = RIL_CLIENT_IPC_RFS, .name = "IPC RFS", - .critical = 0, .handlers = &ipc_rfs_handlers, .callbacks = &ipc_rfs_callbacks, }; |