Lines Matching defs:adapter

48 		/* If the adapter has gone down, we can assume that we
51 if (!cxl_ops->link_ok(afu->adapter, afu))
66 ctx->afu->adapter->adapter_num, ctx->afu->slice, ctx->pe);
78 struct cxl *adapter;
86 idr_for_each_entry(&cxl_adapter_idr, adapter, card) {
88 spin_lock(&adapter->afu_list_lock);
89 for (slice = 0; slice < adapter->slices; slice++) {
90 afu = adapter->afu[slice];
98 spin_unlock(&adapter->afu_list_lock);
183 /* Find a CXL adapter by it's number and increase it's refcount */
186 struct cxl *adapter;
189 if ((adapter = idr_find(&cxl_adapter_idr, num)))
190 get_device(&adapter->dev);
193 return adapter;
196 static int cxl_alloc_adapter_nr(struct cxl *adapter)
202 i = idr_alloc(&cxl_adapter_idr, adapter, 0, 0, GFP_NOWAIT);
208 adapter->adapter_num = i;
213 void cxl_remove_adapter_nr(struct cxl *adapter)
215 idr_remove(&cxl_adapter_idr, adapter->adapter_num);
220 struct cxl *adapter;
222 if (!(adapter = kzalloc(sizeof(struct cxl), GFP_KERNEL)))
225 spin_lock_init(&adapter->afu_list_lock);
227 if (cxl_alloc_adapter_nr(adapter))
230 if (dev_set_name(&adapter->dev, "card%i", adapter->adapter_num))
234 atomic_set(&adapter->contexts_num, -1);
236 return adapter;
238 cxl_remove_adapter_nr(adapter);
240 kfree(adapter);
244 struct cxl_afu *cxl_alloc_afu(struct cxl *adapter, int slice)
251 afu->adapter = adapter;
252 afu->dev.parent = &adapter->dev;
260 afu->irqs_max = afu->adapter->user_irqs;
278 int cxl_adapter_context_get(struct cxl *adapter)
282 rc = atomic_inc_unless_negative(&adapter->contexts_num);
286 void cxl_adapter_context_put(struct cxl *adapter)
288 atomic_dec_if_positive(&adapter->contexts_num);
291 int cxl_adapter_context_lock(struct cxl *adapter)
295 rc = atomic_cmpxchg(&adapter->contexts_num, 0, -1);
299 void cxl_adapter_context_unlock(struct cxl *adapter)
301 int val = atomic_cmpxchg(&adapter->contexts_num, -1, 0);
310 atomic_set(&adapter->contexts_num, 0);