| .. | .. |
|---|
| 46 | 46 | * equals to the src address of their rpmsg channel), the driver's handler |
|---|
| 47 | 47 | * is invoked to process it. |
|---|
| 48 | 48 | * |
|---|
| 49 | | - * That said, more complicated drivers might do need to allocate |
|---|
| 49 | + * That said, more complicated drivers might need to allocate |
|---|
| 50 | 50 | * additional rpmsg addresses, and bind them to different rx callbacks. |
|---|
| 51 | 51 | * To accomplish that, those drivers need to call this function. |
|---|
| 52 | 52 | * |
|---|
| .. | .. |
|---|
| 81 | 81 | */ |
|---|
| 82 | 82 | void rpmsg_destroy_ept(struct rpmsg_endpoint *ept) |
|---|
| 83 | 83 | { |
|---|
| 84 | | - if (ept) |
|---|
| 84 | + if (ept && ept->ops) |
|---|
| 85 | 85 | ept->ops->destroy_ept(ept); |
|---|
| 86 | 86 | } |
|---|
| 87 | 87 | EXPORT_SYMBOL(rpmsg_destroy_ept); |
|---|
| .. | .. |
|---|
| 177 | 177 | EXPORT_SYMBOL(rpmsg_send_offchannel); |
|---|
| 178 | 178 | |
|---|
| 179 | 179 | /** |
|---|
| 180 | | - * rpmsg_send() - send a message across to the remote processor |
|---|
| 180 | + * rpmsg_trysend() - send a message across to the remote processor |
|---|
| 181 | 181 | * @ept: the rpmsg endpoint |
|---|
| 182 | 182 | * @data: payload of message |
|---|
| 183 | 183 | * @len: length of payload |
|---|
| .. | .. |
|---|
| 205 | 205 | EXPORT_SYMBOL(rpmsg_trysend); |
|---|
| 206 | 206 | |
|---|
| 207 | 207 | /** |
|---|
| 208 | | - * rpmsg_sendto() - send a message across to the remote processor, specify dst |
|---|
| 208 | + * rpmsg_trysendto() - send a message across to the remote processor, specify dst |
|---|
| 209 | 209 | * @ept: the rpmsg endpoint |
|---|
| 210 | 210 | * @data: payload of message |
|---|
| 211 | 211 | * @len: length of payload |
|---|
| .. | .. |
|---|
| 253 | 253 | EXPORT_SYMBOL(rpmsg_poll); |
|---|
| 254 | 254 | |
|---|
| 255 | 255 | /** |
|---|
| 256 | | - * rpmsg_send_offchannel() - send a message using explicit src/dst addresses |
|---|
| 256 | + * rpmsg_trysend_offchannel() - send a message using explicit src/dst addresses |
|---|
| 257 | 257 | * @ept: the rpmsg endpoint |
|---|
| 258 | 258 | * @src: source address |
|---|
| 259 | 259 | * @dst: destination address |
|---|
| .. | .. |
|---|
| 283 | 283 | } |
|---|
| 284 | 284 | EXPORT_SYMBOL(rpmsg_trysend_offchannel); |
|---|
| 285 | 285 | |
|---|
| 286 | +/** |
|---|
| 287 | + * rpmsg_get_signals() - get the signals for this endpoint |
|---|
| 288 | + * @ept: the rpmsg endpoint |
|---|
| 289 | + * |
|---|
| 290 | + * Returns signal bits on success and an appropriate error value on failure. |
|---|
| 291 | + */ |
|---|
| 292 | +int rpmsg_get_signals(struct rpmsg_endpoint *ept) |
|---|
| 293 | +{ |
|---|
| 294 | + if (WARN_ON(!ept)) |
|---|
| 295 | + return -EINVAL; |
|---|
| 296 | + if (!ept->ops->get_signals) |
|---|
| 297 | + return -ENXIO; |
|---|
| 298 | + |
|---|
| 299 | + return ept->ops->get_signals(ept); |
|---|
| 300 | +} |
|---|
| 301 | +EXPORT_SYMBOL(rpmsg_get_signals); |
|---|
| 302 | + |
|---|
| 303 | +/** |
|---|
| 304 | + * rpmsg_set_signals() - set the remote signals for this endpoint |
|---|
| 305 | + * @ept: the rpmsg endpoint |
|---|
| 306 | + * @set: set mask for signals |
|---|
| 307 | + * @clear: clear mask for signals |
|---|
| 308 | + * |
|---|
| 309 | + * Returns 0 on success and an appropriate error value on failure. |
|---|
| 310 | + */ |
|---|
| 311 | +int rpmsg_set_signals(struct rpmsg_endpoint *ept, u32 set, u32 clear) |
|---|
| 312 | +{ |
|---|
| 313 | + if (WARN_ON(!ept)) |
|---|
| 314 | + return -EINVAL; |
|---|
| 315 | + if (!ept->ops->set_signals) |
|---|
| 316 | + return -ENXIO; |
|---|
| 317 | + |
|---|
| 318 | + return ept->ops->set_signals(ept, set, clear); |
|---|
| 319 | +} |
|---|
| 320 | +EXPORT_SYMBOL(rpmsg_set_signals); |
|---|
| 321 | + |
|---|
| 286 | 322 | /* |
|---|
| 287 | | - * match an rpmsg channel with a channel info struct. |
|---|
| 323 | + * match a rpmsg channel with a channel info struct. |
|---|
| 288 | 324 | * this is used to make sure we're not creating rpmsg devices for channels |
|---|
| 289 | 325 | * that already exist. |
|---|
| 290 | 326 | */ |
|---|
| .. | .. |
|---|
| 468 | 504 | |
|---|
| 469 | 505 | rpdev->ept = ept; |
|---|
| 470 | 506 | rpdev->src = ept->addr; |
|---|
| 507 | + |
|---|
| 508 | + if (rpdrv->signals) |
|---|
| 509 | + ept->sig_cb = rpdrv->signals; |
|---|
| 510 | + |
|---|
| 471 | 511 | } |
|---|
| 472 | 512 | |
|---|
| 473 | 513 | err = rpdrv->probe(rpdev); |
|---|
| .. | .. |
|---|
| 505 | 545 | if (rpdev->ops->announce_destroy) |
|---|
| 506 | 546 | err = rpdev->ops->announce_destroy(rpdev); |
|---|
| 507 | 547 | |
|---|
| 508 | | - rpdrv->remove(rpdev); |
|---|
| 548 | + if (rpdrv->remove) |
|---|
| 549 | + rpdrv->remove(rpdev); |
|---|
| 509 | 550 | |
|---|
| 510 | 551 | dev_pm_domain_detach(dev, true); |
|---|
| 511 | 552 | |
|---|