aboutsummaryrefslogtreecommitdiff
path: root/kernel/ethosu_network_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/ethosu_network_info.c')
-rw-r--r--kernel/ethosu_network_info.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/kernel/ethosu_network_info.c b/kernel/ethosu_network_info.c
index 2b1f841..24be677 100644
--- a/kernel/ethosu_network_info.c
+++ b/kernel/ethosu_network_info.c
@@ -47,6 +47,24 @@ static void ethosu_network_info_destroy(struct kref *kref)
devm_kfree(info->edev->dev, info);
}
+static int ethosu_network_info_send(struct ethosu_network_info *info)
+{
+ int ret;
+
+ /* Send network info request to firmware */
+ ret = ethosu_mailbox_network_info_request(&info->edev->mailbox,
+ info,
+ info->net->buf,
+ info->net->index);
+ if (ret)
+ return ret;
+
+ /* Increase reference count for the pending network info response */
+ ethosu_network_info_get(info);
+
+ return 0;
+}
+
struct ethosu_network_info *ethosu_network_info_create(
struct ethosu_device *edev,
struct ethosu_network *net,
@@ -71,17 +89,10 @@ struct ethosu_network_info *ethosu_network_info_create(
/* Get reference to network */
ethosu_network_get(net);
- /* Send network info request to firmware */
- ret = ethosu_mailbox_network_info_request(&info->edev->mailbox,
- info,
- info->net->buf,
- info->net->index);
+ ret = ethosu_network_info_send(info);
if (ret)
goto put_info;
- /* Increase reference count for the pending network info response */
- ethosu_network_info_get(info);
-
dev_info(edev->dev, "Network info create. handle=%p\n", info);
return info;