diff options
| -rw-r--r-- | drivers/rpmsg/rpmsg_core.c | 160 | ||||
| -rw-r--r-- | drivers/rpmsg/virtio_rpmsg_bus.c | 13 | ||||
| -rw-r--r-- | include/linux/rpmsg.h | 148 |
3 files changed, 166 insertions, 155 deletions
diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c index c511b5d64f89..3bee8e03a387 100644 --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c | |||
| @@ -69,3 +69,163 @@ struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev, | |||
| 69 | return rpdev->ops->create_ept(rpdev, cb, priv, chinfo); | 69 | return rpdev->ops->create_ept(rpdev, cb, priv, chinfo); |
| 70 | } | 70 | } |
| 71 | EXPORT_SYMBOL(rpmsg_create_ept); | 71 | EXPORT_SYMBOL(rpmsg_create_ept); |
| 72 | |||
| 73 | /** | ||
| 74 | * rpmsg_destroy_ept() - destroy an existing rpmsg endpoint | ||
| 75 | * @ept: endpoing to destroy | ||
| 76 | * | ||
| 77 | * Should be used by drivers to destroy an rpmsg endpoint previously | ||
| 78 | * created with rpmsg_create_ept(). | ||
| 79 | */ | ||
| 80 | void rpmsg_destroy_ept(struct rpmsg_endpoint *ept) | ||
| 81 | { | ||
| 82 | ept->ops->destroy_ept(ept); | ||
| 83 | } | ||
| 84 | EXPORT_SYMBOL(rpmsg_destroy_ept); | ||
| 85 | |||
| 86 | /** | ||
| 87 | * rpmsg_send() - send a message across to the remote processor | ||
| 88 | * @ept: the rpmsg endpoint | ||
| 89 | * @data: payload of message | ||
| 90 | * @len: length of payload | ||
| 91 | * | ||
| 92 | * This function sends @data of length @len on the @ept endpoint. | ||
| 93 | * The message will be sent to the remote processor which the @ept | ||
| 94 | * endpoint belongs to, using @ept's address and its associated rpmsg | ||
| 95 | * device destination addresses. | ||
| 96 | * In case there are no TX buffers available, the function will block until | ||
| 97 | * one becomes available, or a timeout of 15 seconds elapses. When the latter | ||
| 98 | * happens, -ERESTARTSYS is returned. | ||
| 99 | * | ||
| 100 | * Can only be called from process context (for now). | ||
| 101 | * | ||
| 102 | * Returns 0 on success and an appropriate error value on failure. | ||
| 103 | */ | ||
| 104 | int rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len) | ||
| 105 | { | ||
| 106 | return ept->ops->send(ept, data, len); | ||
| 107 | } | ||
| 108 | EXPORT_SYMBOL(rpmsg_send); | ||
| 109 | |||
| 110 | /** | ||
| 111 | * rpmsg_sendto() - send a message across to the remote processor, specify dst | ||
| 112 | * @ept: the rpmsg endpoint | ||
| 113 | * @data: payload of message | ||
| 114 | * @len: length of payload | ||
| 115 | * @dst: destination address | ||
| 116 | * | ||
| 117 | * This function sends @data of length @len to the remote @dst address. | ||
| 118 | * The message will be sent to the remote processor which the @ept | ||
| 119 | * endpoint belongs to, using @ept's address as source. | ||
| 120 | * In case there are no TX buffers available, the function will block until | ||
| 121 | * one becomes available, or a timeout of 15 seconds elapses. When the latter | ||
| 122 | * happens, -ERESTARTSYS is returned. | ||
| 123 | * | ||
| 124 | * Can only be called from process context (for now). | ||
| 125 | * | ||
| 126 | * Returns 0 on success and an appropriate error value on failure. | ||
| 127 | */ | ||
| 128 | int rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst) | ||
| 129 | { | ||
| 130 | return ept->ops->sendto(ept, data, len, dst); | ||
| 131 | } | ||
| 132 | EXPORT_SYMBOL(rpmsg_sendto); | ||
| 133 | |||
| 134 | /** | ||
| 135 | * rpmsg_send_offchannel() - send a message using explicit src/dst addresses | ||
| 136 | * @ept: the rpmsg endpoint | ||
| 137 | * @src: source address | ||
| 138 | * @dst: destination address | ||
| 139 | * @data: payload of message | ||
| 140 | * @len: length of payload | ||
| 141 | * | ||
| 142 | * This function sends @data of length @len to the remote @dst address, | ||
| 143 | * and uses @src as the source address. | ||
| 144 | * The message will be sent to the remote processor which the @ept | ||
| 145 | * endpoint belongs to. | ||
| 146 | * In case there are no TX buffers available, the function will block until | ||
| 147 | * one becomes available, or a timeout of 15 seconds elapses. When the latter | ||
| 148 | * happens, -ERESTARTSYS is returned. | ||
| 149 | * | ||
| 150 | * Can only be called from process context (for now). | ||
| 151 | * | ||
| 152 | * Returns 0 on success and an appropriate error value on failure. | ||
| 153 | */ | ||
| 154 | int rpmsg_send_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst, | ||
| 155 | void *data, int len) | ||
| 156 | { | ||
| 157 | return ept->ops->send_offchannel(ept, src, dst, data, len); | ||
| 158 | } | ||
| 159 | EXPORT_SYMBOL(rpmsg_send_offchannel); | ||
| 160 | |||
| 161 | /** | ||
| 162 | * rpmsg_send() - send a message across to the remote processor | ||
| 163 | * @ept: the rpmsg endpoint | ||
| 164 | * @data: payload of message | ||
| 165 | * @len: length of payload | ||
| 166 | * | ||
| 167 | * This function sends @data of length @len on the @ept endpoint. | ||
| 168 | * The message will be sent to the remote processor which the @ept | ||
| 169 | * endpoint belongs to, using @ept's address as source and its associated | ||
| 170 | * rpdev's address as destination. | ||
| 171 | * In case there are no TX buffers available, the function will immediately | ||
| 172 | * return -ENOMEM without waiting until one becomes available. | ||
| 173 | * | ||
| 174 | * Can only be called from process context (for now). | ||
| 175 | * | ||
| 176 | * Returns 0 on success and an appropriate error value on failure. | ||
| 177 | */ | ||
| 178 | int rpmsg_trysend(struct rpmsg_endpoint *ept, void *data, int len) | ||
| 179 | { | ||
| 180 | return ept->ops->trysend(ept, data, len); | ||
| 181 | } | ||
| 182 | EXPORT_SYMBOL(rpmsg_trysend); | ||
| 183 | |||
| 184 | /** | ||
| 185 | * rpmsg_sendto() - send a message across to the remote processor, specify dst | ||
| 186 | * @ept: the rpmsg endpoint | ||
| 187 | * @data: payload of message | ||
| 188 | * @len: length of payload | ||
| 189 | * @dst: destination address | ||
| 190 | * | ||
| 191 | * This function sends @data of length @len to the remote @dst address. | ||
| 192 | * The message will be sent to the remote processor which the @ept | ||
| 193 | * endpoint belongs to, using @ept's address as source. | ||
| 194 | * In case there are no TX buffers available, the function will immediately | ||
| 195 | * return -ENOMEM without waiting until one becomes available. | ||
| 196 | * | ||
| 197 | * Can only be called from process context (for now). | ||
| 198 | * | ||
| 199 | * Returns 0 on success and an appropriate error value on failure. | ||
| 200 | */ | ||
| 201 | int rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst) | ||
| 202 | { | ||
| 203 | return ept->ops->trysendto(ept, data, len, dst); | ||
| 204 | } | ||
| 205 | EXPORT_SYMBOL(rpmsg_trysendto); | ||
| 206 | |||
| 207 | /** | ||
| 208 | * rpmsg_send_offchannel() - send a message using explicit src/dst addresses | ||
| 209 | * @ept: the rpmsg endpoint | ||
| 210 | * @src: source address | ||
| 211 | * @dst: destination address | ||
| 212 | * @data: payload of message | ||
| 213 | * @len: length of payload | ||
| 214 | * | ||
| 215 | * This function sends @data of length @len to the remote @dst address, | ||
| 216 | * and uses @src as the source address. | ||
| 217 | * The message will be sent to the remote processor which the @ept | ||
| 218 | * endpoint belongs to. | ||
| 219 | * In case there are no TX buffers available, the function will immediately | ||
| 220 | * return -ENOMEM without waiting until one becomes available. | ||
| 221 | * | ||
| 222 | * Can only be called from process context (for now). | ||
| 223 | * | ||
| 224 | * Returns 0 on success and an appropriate error value on failure. | ||
| 225 | */ | ||
| 226 | int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst, | ||
| 227 | void *data, int len) | ||
| 228 | { | ||
| 229 | return ept->ops->trysend_offchannel(ept, src, dst, data, len); | ||
| 230 | } | ||
| 231 | EXPORT_SYMBOL(rpmsg_trysend_offchannel); | ||
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index e5f256791fd3..184663276e51 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c | |||
| @@ -299,19 +299,6 @@ __rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept) | |||
| 299 | kref_put(&ept->refcount, __ept_release); | 299 | kref_put(&ept->refcount, __ept_release); |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | /** | ||
| 303 | * rpmsg_destroy_ept() - destroy an existing rpmsg endpoint | ||
| 304 | * @ept: endpoing to destroy | ||
| 305 | * | ||
| 306 | * Should be used by drivers to destroy an rpmsg endpoint previously | ||
| 307 | * created with rpmsg_create_ept(). | ||
| 308 | */ | ||
| 309 | void rpmsg_destroy_ept(struct rpmsg_endpoint *ept) | ||
| 310 | { | ||
| 311 | ept->ops->destroy_ept(ept); | ||
| 312 | } | ||
| 313 | EXPORT_SYMBOL(rpmsg_destroy_ept); | ||
| 314 | |||
| 315 | static void virtio_rpmsg_destroy_ept(struct rpmsg_endpoint *ept) | 302 | static void virtio_rpmsg_destroy_ept(struct rpmsg_endpoint *ept) |
| 316 | { | 303 | { |
| 317 | __rpmsg_destroy_ept(ept->rpdev->vrp, ept); | 304 | __rpmsg_destroy_ept(ept->rpdev->vrp, ept); |
diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h index d54458effd54..99efd598590e 100644 --- a/include/linux/rpmsg.h +++ b/include/linux/rpmsg.h | |||
| @@ -259,150 +259,14 @@ struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *, | |||
| 259 | module_driver(__rpmsg_driver, register_rpmsg_driver, \ | 259 | module_driver(__rpmsg_driver, register_rpmsg_driver, \ |
| 260 | unregister_rpmsg_driver) | 260 | unregister_rpmsg_driver) |
| 261 | 261 | ||
| 262 | /** | 262 | int rpmsg_send(struct rpmsg_endpoint *ept, void *data, int len); |
| 263 | * rpmsg_send() - send a message across to the remote processor | 263 | int rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst); |
| 264 | * @ept: the rpmsg endpoint | ||
| 265 | * @data: payload of message | ||
| 266 | * @len: length of payload | ||
| 267 | * | ||
| 268 | * This function sends @data of length @len on the @ept endpoint. | ||
| 269 | * The message will be sent to the remote processor which the @ept | ||
| 270 | * endpoint belongs to, using @ept's address and its associated rpmsg | ||
| 271 | * device destination addresses. | ||
| 272 | * In case there are no TX buffers available, the function will block until | ||
| 273 | * one becomes available, or a timeout of 15 seconds elapses. When the latter | ||
| 274 | * happens, -ERESTARTSYS is returned. | ||
