aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rpmsg/virtio_rpmsg_bus.c26
-rw-r--r--include/linux/rpmsg.h15
2 files changed, 24 insertions, 17 deletions
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 345036b485d7..7c7c6a8b21d9 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -73,18 +73,6 @@ struct virtproc_info {
73 struct rpmsg_endpoint *ns_ept; 73 struct rpmsg_endpoint *ns_ept;
74}; 74};
75 75
76/**
77 * struct rpmsg_channel_info - internal channel info representation
78 * @name: name of service
79 * @src: local address
80 * @dst: destination address
81 */
82struct rpmsg_channel_info {
83 char name[RPMSG_NAME_SIZE];
84 u32 src;
85 u32 dst;
86};
87
88#define to_rpmsg_channel(d) container_of(d, struct rpmsg_channel, dev) 76#define to_rpmsg_channel(d) container_of(d, struct rpmsg_channel, dev)
89#define to_rpmsg_driver(d) container_of(d, struct rpmsg_driver, drv) 77#define to_rpmsg_driver(d) container_of(d, struct rpmsg_driver, drv)
90 78
@@ -259,7 +247,7 @@ free_ept:
259 * @rpdev: rpmsg channel device 247 * @rpdev: rpmsg channel device
260 * @cb: rx callback handler 248 * @cb: rx callback handler
261 * @priv: private data for the driver's use 249 * @priv: private data for the driver's use
262 * @addr: local rpmsg address to bind with @cb 250 * @chinfo: channel_info with the local rpmsg address to bind with @cb
263 * 251 *
264 * Every rpmsg address in the system is bound to an rx callback (so when 252 * Every rpmsg address in the system is bound to an rx callback (so when
265 * inbound messages arrive, they are dispatched by the rpmsg bus using the 253 * inbound messages arrive, they are dispatched by the rpmsg bus using the
@@ -295,9 +283,10 @@ free_ept:
295 * Returns a pointer to the endpoint on success, or NULL on error. 283 * Returns a pointer to the endpoint on success, or NULL on error.
296 */ 284 */
297struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *rpdev, 285struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *rpdev,
298 rpmsg_rx_cb_t cb, void *priv, u32 addr) 286 rpmsg_rx_cb_t cb, void *priv,
287 struct rpmsg_channel_info chinfo)
299{ 288{
300 return __rpmsg_create_ept(rpdev->vrp, rpdev, cb, priv, addr); 289 return __rpmsg_create_ept(rpdev->vrp, rpdev, cb, priv, chinfo.src);
301} 290}
302EXPORT_SYMBOL(rpmsg_create_ept); 291EXPORT_SYMBOL(rpmsg_create_ept);
303 292
@@ -353,10 +342,15 @@ static int rpmsg_dev_probe(struct device *dev)
353 struct rpmsg_channel *rpdev = to_rpmsg_channel(dev); 342 struct rpmsg_channel *rpdev = to_rpmsg_channel(dev);
354 struct rpmsg_driver *rpdrv = to_rpmsg_driver(rpdev->dev.driver); 343 struct rpmsg_driver *rpdrv = to_rpmsg_driver(rpdev->dev.driver);
355 struct virtproc_info *vrp = rpdev->vrp; 344 struct virtproc_info *vrp = rpdev->vrp;
345 struct rpmsg_channel_info chinfo = {};
356 struct rpmsg_endpoint *ept; 346 struct rpmsg_endpoint *ept;
357 int err; 347 int err;
358 348
359 ept = rpmsg_create_ept(rpdev, rpdrv->callback, NULL, rpdev->src); 349 strncpy(chinfo.name, rpdev->id.name, RPMSG_NAME_SIZE);
350 chinfo.src = rpdev->src;
351 chinfo.dst = RPMSG_ADDR_ANY;
352
353 ept = rpmsg_create_ept(rpdev, rpdrv->callback, NULL, chinfo);
360 if (!ept) { 354 if (!ept) {
361 dev_err(dev, "failed to create endpoint\n"); 355 dev_err(dev, "failed to create endpoint\n");
362 err = -ENOMEM; 356 err = -ENOMEM;
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h
index a901a331a190..f278407fcf48 100644
--- a/include/linux/rpmsg.h
+++ b/include/linux/rpmsg.h
@@ -98,6 +98,18 @@ enum rpmsg_ns_flags {
98struct virtproc_info; 98struct virtproc_info;
99 99
100/** 100/**
101 * struct rpmsg_channel_info - channel info representation
102 * @name: name of service
103 * @src: local address
104 * @dst: destination address
105 */
106struct rpmsg_channel_info {
107 char name[RPMSG_NAME_SIZE];
108 u32 src;
109 u32 dst;
110};
111
112/**
101 * rpmsg_channel - devices that belong to the rpmsg bus are called channels 113 * rpmsg_channel - devices that belong to the rpmsg bus are called channels
102 * @vrp: the remote processor this channel belongs to 114 * @vrp: the remote processor this channel belongs to
103 * @dev: the device struct 115 * @dev: the device struct
@@ -171,7 +183,8 @@ int __register_rpmsg_driver(struct rpmsg_driver *drv, struct module *owner);
171void unregister_rpmsg_driver(struct rpmsg_driver *drv); 183void unregister_rpmsg_driver(struct rpmsg_driver *drv);
172void rpmsg_destroy_ept(struct rpmsg_endpoint *); 184void rpmsg_destroy_ept(struct rpmsg_endpoint *);
173struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *, 185struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_channel *,
174 rpmsg_rx_cb_t cb, void *priv, u32 addr); 186 rpmsg_rx_cb_t cb, void *priv,
187 struct rpmsg_channel_info chinfo);
175int 188int
176rpmsg_send_offchannel_raw(struct rpmsg_channel *, u32, u32, void *, int, bool); 189rpmsg_send_offchannel_raw(struct rpmsg_channel *, u32, u32, void *, int, bool);
177 190