MCPcopy Create free account
hub / github.com/apache/nuttx / rpmsg_ns_bind

Function rpmsg_ns_bind

drivers/rpmsg/rpmsg.c:355–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355void rpmsg_ns_bind(FAR struct rpmsg_device *rdev,
356 FAR const char *name, uint32_t dest)
357{
358 FAR struct rpmsg_s *rpmsg = rpmsg_get_by_rdev(rdev);
359 FAR struct rpmsg_bind_s *bind;
360 FAR struct metal_list *node;
361
362 down_read(&g_rpmsg_lock);
363 metal_list_for_each(&g_rpmsg_cb, node)
364 {
365 FAR struct rpmsg_cb_s *cb =
366 metal_container_of(node, struct rpmsg_cb_s, node);
367
368 if (cb->ns_match && cb->ns_match(rdev, cb->priv, name, dest))
369 {
370 rpmsg_bind_cb_t ns_bind = cb->ns_bind;
371 FAR void *cb_priv = cb->priv;
372
373 up_read(&g_rpmsg_lock);
374
375 ns_bind(rdev, cb_priv, name, dest);
376 return;
377 }
378 }
379
380 bind = kmm_malloc(sizeof(struct rpmsg_bind_s));
381 if (bind == NULL)
382 {
383 return;
384 }
385
386 bind->dest = dest;
387 strlcpy(bind->name, name, RPMSG_NAME_SIZE);
388
389 nxrmutex_lock(&rpmsg->lock);
390 metal_list_add_tail(&rpmsg->bind, &bind->node);
391 nxrmutex_unlock(&rpmsg->lock);
392
393 up_read(&g_rpmsg_lock);
394}
395
396void rpmsg_ns_unbind(FAR struct rpmsg_device *rdev,
397 FAR const char *name, uint32_t dest)

Callers

nothing calls this directly

Calls 7

rpmsg_get_by_rdevFunction · 0.85
down_readFunction · 0.85
up_readFunction · 0.85
kmm_mallocFunction · 0.85
nxrmutex_lockFunction · 0.85
nxrmutex_unlockFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected