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

Function rpmsg_register_callback

drivers/rpmsg/rpmsg.c:235–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235int rpmsg_register_callback(FAR void *priv,
236 rpmsg_dev_cb_t device_created,
237 rpmsg_dev_cb_t device_destroy,
238 rpmsg_match_cb_t ns_match,
239 rpmsg_bind_cb_t ns_bind)
240{
241 FAR struct metal_list *node;
242 FAR struct metal_list *bnode;
243 FAR struct rpmsg_cb_s *cb;
244
245 cb = kmm_zalloc(sizeof(struct rpmsg_cb_s));
246 if (cb == NULL)
247 {
248 return -ENOMEM;
249 }
250
251 cb->priv = priv;
252 cb->device_created = device_created;
253 cb->device_destroy = device_destroy;
254 cb->ns_match = ns_match;
255 cb->ns_bind = ns_bind;
256
257 down_write(&g_rpmsg_lock);
258 metal_list_add_tail(&g_rpmsg_cb, &cb->node);
259 downgrade_write(&g_rpmsg_lock);
260 metal_list_for_each(&g_rpmsg, node)
261 {
262 FAR struct rpmsg_s *rpmsg =
263 metal_container_of(node, struct rpmsg_s, node);
264 FAR struct rpmsg_device *rdev = rpmsg_get_rdev_by_rpmsg(rpmsg);
265
266 if (!rpmsg->init)
267 {
268 continue;
269 }
270
271 if (device_created)
272 {
273 device_created(rdev, priv);
274 }
275
276 if (ns_bind == NULL)
277 {
278 continue;
279 }
280
281 DEBUGASSERT(ns_match != NULL);
282
283again:
284 nxrmutex_lock(&rpmsg->lock);
285 metal_list_for_each(&rpmsg->bind, bnode)
286 {
287 FAR struct rpmsg_bind_s *bind =
288 metal_container_of(bnode, struct rpmsg_bind_s, node);
289
290 if (ns_match(rdev, priv, bind->name, bind->dest))
291 {
292 metal_list_del(bnode);

Callers 15

mpfs_ihc_initFunction · 0.85
uart_rpmsg_initFunction · 0.85
uart_rpmsg_raw_initFunction · 0.85
reset_rpmsg_get_clientFunction · 0.85
reset_rpmsg_server_initFunction · 0.85
clk_rpmsg_get_privFunction · 0.85
rpmsgmtd_server_initFunction · 0.85
rpmsgmtd_registerFunction · 0.85
rpmsgdev_registerFunction · 0.85

Calls 8

kmm_zallocFunction · 0.85
down_writeFunction · 0.85
downgrade_writeFunction · 0.85
rpmsg_get_rdev_by_rpmsgFunction · 0.85
nxrmutex_lockFunction · 0.85
nxrmutex_unlockFunction · 0.85
kmm_freeFunction · 0.85
up_readFunction · 0.85

Tested by

no test coverage detected