Skip to content

Commit 9fdadd0

Browse files
GUIDINGLIarnopo
authored andcommitted
openamp: add ns_unbind_cb to rpmsg_device
it's useful to notify the port layer and also symmetry with ns_bind_cb callback Signed-off-by: Guiding Li <liguiding1@xiaomi.com>
1 parent 8c93bff commit 9fdadd0

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

docs/rpmsg-design.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ running on two processors.
101101
void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev,
102102
const char *name, uint32_t dest)
103103
```
104+
* RPMsg name service unbind callback. If user defines such callback, when
105+
there is name service destroy arrives, it will call this callback.:
106+
```
107+
void (*rpmsg_ns_unbind_cb)(struct rpmsg_device *rdev,
108+
const char *name, uint32_t dest)
109+
```
104110
* RPMsg endpoint name service unbind callback. If user defines such callback,
105111
when there is name service destroy arrives, it will call this callback to
106112
notify the user application about the remote has destroyed the service.:

lib/include/openamp/rpmsg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ struct rpmsg_device_ops {
109109
* @lock: mutex lock for rpmsg management
110110
* @ns_bind_cb: callback handler for name service announcement without local
111111
* endpoints waiting to bind.
112+
* @ns_unbind_cb: callback handler for name service announcement, called when
113+
* remote ept is destroyed.
112114
* @ops: RPMsg device operations
113115
* @support_ns: create/destroy namespace message
114116
*/
@@ -118,6 +120,7 @@ struct rpmsg_device {
118120
unsigned long bitmap[metal_bitmap_longs(RPMSG_ADDR_BMP_SIZE)];
119121
metal_mutex_t lock;
120122
rpmsg_ns_bind_cb ns_bind_cb;
123+
rpmsg_ns_bind_cb ns_unbind_cb;
121124
struct rpmsg_device_ops ops;
122125
bool support_ns;
123126
};

lib/rpmsg/rpmsg_virtio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data,
585585
metal_mutex_release(&rdev->lock);
586586
if (_ept && _ept->ns_unbind_cb)
587587
_ept->ns_unbind_cb(_ept);
588+
if (rdev->ns_unbind_cb)
589+
rdev->ns_unbind_cb(rdev, name, dest);
588590
} else {
589591
if (!_ept) {
590592
/*

0 commit comments

Comments
 (0)