int _remote_spin_lock_init(remote_spin_lock_id_t id, _remote_spinlock_t *lock) { #if defined(CONFIG_ARCH_MSM7X30) BUG_ON(id == NULL); if (id[0] == 'D' && id[1] == ':') { /* DAL chunk name starts after "D:" */ return remote_spinlock_dal_init(&id[2], lock); } else if (id[0] == 'S' && id[1] == ':') { /* Single-digit SMEM lock ID follows "S:" */ BUG_ON(id[3] != '\0'); return remote_spinlock_smem_init((((uint8_t)id[2])-'0'), lock); } else return -EINVAL; #else _remote_spinlock_t spinlock_start; if (id >= SMEM_SPINLOCK_COUNT) return -EINVAL; spinlock_start = smem_alloc(SMEM_SPINLOCK_ARRAY, SMEM_SPINLOCK_ARRAY_SIZE); if (spinlock_start == NULL) return -ENXIO; *lock = spinlock_start + id; return 0; #endif }
int _remote_spin_lock_init(remote_spinlock_id_t id, _remote_spinlock_t *lock) { BUG_ON(id == NULL); if (id[0] == 'D' && id[1] == ':') { return remote_spinlock_dal_init(&id[2], lock); } else if (id[0] == 'S' && id[1] == ':') { BUG_ON(id[3] != '\0'); return remote_spinlock_smem_init((((uint8_t)id[2])-'0'), lock); } else return -EINVAL; }