diff options
Diffstat (limited to 'kernel/rpmsg/ethosu_rpmsg_cancel_inference.c')
-rw-r--r-- | kernel/rpmsg/ethosu_rpmsg_cancel_inference.c | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/kernel/rpmsg/ethosu_rpmsg_cancel_inference.c b/kernel/rpmsg/ethosu_rpmsg_cancel_inference.c index 5d46434..5fa7515 100644 --- a/kernel/rpmsg/ethosu_rpmsg_cancel_inference.c +++ b/kernel/rpmsg/ethosu_rpmsg_cancel_inference.c @@ -41,18 +41,19 @@ * Functions ****************************************************************************/ -static int ethosu_cancel_inference_send( - struct ethosu_cancel_inference *cancellation, - struct ethosu_mailbox *mailbox) +static int ethosu_rpmsg_cancel_inference_send( + struct ethosu_rpmsg_cancel_inference *cancellation, + struct ethosu_rpmsg_mailbox *mailbox) { - return ethosu_mailbox_cancel_inference(mailbox, - &cancellation->msg, - cancellation->inf->msg.id); + return ethosu_rpmsg_mailbox_cancel_inference(mailbox, + &cancellation->msg, + cancellation->inf->msg.id); } -static void ethosu_cancel_inference_fail(struct ethosu_mailbox_msg *msg) +static void ethosu_rpmsg_cancel_inference_fail( + struct ethosu_rpmsg_mailbox_msg *msg) { - struct ethosu_cancel_inference *cancellation = + struct ethosu_rpmsg_cancel_inference *cancellation = container_of(msg, typeof(*cancellation), msg); if (completion_done(&cancellation->done)) @@ -63,12 +64,12 @@ static void ethosu_cancel_inference_fail(struct ethosu_mailbox_msg *msg) complete(&cancellation->done); } -int ethosu_cancel_inference_request(struct device *dev, - struct ethosu_mailbox *mailbox, - struct ethosu_inference *inf, - struct ethosu_uapi_cancel_inference_status *uapi) +int ethosu_rpmsg_cancel_inference_request(struct device *dev, + struct ethosu_rpmsg_mailbox *mailbox, + struct ethosu_rpmsg_inference *inf, + struct ethosu_uapi_cancel_inference_status *uapi) { - struct ethosu_cancel_inference *cancellation; + struct ethosu_rpmsg_cancel_inference *cancellation; int ret; int timeout; @@ -80,13 +81,13 @@ int ethosu_cancel_inference_request(struct device *dev, cancellation = devm_kzalloc(dev, - sizeof(struct ethosu_cancel_inference), + sizeof(struct ethosu_rpmsg_cancel_inference), GFP_KERNEL); if (!cancellation) return -ENOMEM; /* increase ref count on the inference we are refering to */ - ethosu_inference_get(inf); + ethosu_rpmsg_inference_get(inf); /* mark inference ABORTING to avoid resending the inference message */ inf->status = ETHOSU_UAPI_STATUS_ABORTING; @@ -94,10 +95,10 @@ int ethosu_cancel_inference_request(struct device *dev, cancellation->inf = inf; cancellation->uapi = uapi; init_completion(&cancellation->done); - cancellation->msg.fail = ethosu_cancel_inference_fail; + cancellation->msg.fail = ethosu_rpmsg_cancel_inference_fail; - ret = ethosu_mailbox_register(mailbox, - &cancellation->msg); + ret = ethosu_rpmsg_mailbox_register(mailbox, + &cancellation->msg); if (ret < 0) goto kfree; @@ -105,7 +106,7 @@ int ethosu_cancel_inference_request(struct device *dev, "Inference cancellation create. cancel=0x%pK, msg.id=%ddev", cancellation, cancellation->msg.id); - ret = ethosu_cancel_inference_send(cancellation, mailbox); + ret = ethosu_rpmsg_cancel_inference_send(cancellation, mailbox); if (0 != ret) goto deregister; @@ -140,30 +141,30 @@ int ethosu_cancel_inference_request(struct device *dev, inf->status = ETHOSU_UAPI_STATUS_ABORTED; deregister: - ethosu_mailbox_deregister(mailbox, - &cancellation->msg); + ethosu_rpmsg_mailbox_deregister(mailbox, + &cancellation->msg); kfree: dev_dbg(dev, "Cancel inference destroy. cancel=0x%pK", cancellation); /* decrease the reference on the inference we are refering to */ - ethosu_inference_put(cancellation->inf); + ethosu_rpmsg_inference_put(cancellation->inf); devm_kfree(dev, cancellation); return ret; } -void ethosu_cancel_inference_rsp(struct ethosu_mailbox *mailbox, - int msg_id, - struct ethosu_core_msg_cancel_inference_rsp *rsp) +void ethosu_rpmsg_cancel_inference_rsp(struct ethosu_rpmsg_mailbox *mailbox, + int msg_id, + struct ethosu_rpmsg_cancel_inference_rsp *rsp) { struct device *dev = mailbox->dev; - struct ethosu_mailbox_msg *msg; - struct ethosu_cancel_inference *cancellation; + struct ethosu_rpmsg_mailbox_msg *msg; + struct ethosu_rpmsg_cancel_inference *cancellation; - msg = ethosu_mailbox_find(mailbox, msg_id, - ETHOSU_CORE_MSG_CANCEL_INFERENCE_REQ); + msg = ethosu_rpmsg_mailbox_find(mailbox, msg_id, + ETHOSU_RPMSG_CANCEL_INFERENCE_REQ); if (IS_ERR(msg)) { dev_warn(dev, "Id for cancel inference msg not found. Id=0x%x: %ld", @@ -179,10 +180,10 @@ void ethosu_cancel_inference_rsp(struct ethosu_mailbox *mailbox, cancellation->errno = 0; switch (rsp->status) { - case ETHOSU_CORE_STATUS_OK: + case ETHOSU_RPMSG_STATUS_OK: cancellation->uapi->status = ETHOSU_UAPI_STATUS_OK; break; - case ETHOSU_CORE_STATUS_ERROR: + case ETHOSU_RPMSG_STATUS_ERROR: cancellation->uapi->status = ETHOSU_UAPI_STATUS_ERROR; break; } |