Changeset 63d8f43 in mainline for kernel/generic/src/ipc/ipcrsc.c
- Timestamp:
- 2017-09-04T19:38:28Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fa32c9f
- Parents:
- 30c27e9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/ipcrsc.c
r30c27e9 r63d8f43 135 135 #include <abi/errno.h> 136 136 #include <cap/cap.h> 137 #include <mm/slab.h> 137 138 138 139 /** Find call_t * in call table according to callid. … … 178 179 return NULL; 179 180 180 return &cap->phone;181 return (phone_t *) cap->kobject; 181 182 } 182 183 … … 190 191 assert(cap->type == CAP_TYPE_PHONE); 191 192 192 return (cap->phone.state == IPC_PHONE_HUNGUP) && 193 (atomic_get(&cap->phone.active_calls) == 0); 193 phone_t *phone = (phone_t *) cap->kobject; 194 195 return (phone->state == IPC_PHONE_HUNGUP) && 196 (atomic_get(&phone->active_calls) == 0); 194 197 } 195 198 … … 205 208 int handle = cap_alloc(task); 206 209 if (handle >= 0) { 210 phone_t *phone = malloc(sizeof(phone_t), FRAME_ATOMIC); 211 if (!phone) { 212 cap_free(TASK, handle); 213 return ENOMEM; 214 } 215 216 ipc_phone_init(phone, task); 217 phone->state = IPC_PHONE_CONNECTING; 218 207 219 irq_spinlock_lock(&task->lock, true); 208 220 cap_t *cap = cap_get(task, handle, CAP_TYPE_ALLOCATED); 209 ipc_phone_init(&cap->phone, task);210 221 cap->type = CAP_TYPE_PHONE; 222 cap->kobject = (void *) phone; 211 223 cap->can_reclaim = phone_can_reclaim; 212 cap->phone.state = IPC_PHONE_CONNECTING;213 224 irq_spinlock_unlock(&task->lock, true); 214 225 } … … 226 237 void phone_dealloc(int handle) 227 238 { 228 phone_t *phone = phone_get_current(handle); 239 irq_spinlock_lock(&TASK->lock, true); 240 cap_t *cap = cap_get_current(handle, CAP_TYPE_PHONE); 241 assert(cap); 242 cap->type = CAP_TYPE_ALLOCATED; 243 irq_spinlock_unlock(&TASK->lock, true); 244 245 phone_t *phone = (phone_t *) cap->kobject; 229 246 230 247 assert(phone); 231 248 assert(phone->state == IPC_PHONE_CONNECTING); 232 249 250 free(phone); 233 251 cap_free(TASK, handle); 234 252 }
Note:
See TracChangeset
for help on using the changeset viewer.