mboxd_msg: Split init function to enable testing

Allows passing a dev node path through.

Change-Id: Ice3fd8157366b4687fd7f3aac72619a1f0a67fff
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/mboxd_msg.c b/mboxd_msg.c
index a5bcf62..cdd8b69 100644
--- a/mboxd_msg.c
+++ b/mboxd_msg.c
@@ -792,15 +792,15 @@
 	return handle_mbox_req(context, &req);
 }
 
-int init_mbox_dev(struct mbox_context *context)
+int __init_mbox_dev(struct mbox_context *context, const char *path)
 {
 	int fd;
 
 	/* Open MBOX Device */
-	fd = open(MBOX_HOST_PATH, O_RDWR | O_NONBLOCK);
+	fd = open(path, O_RDWR | O_NONBLOCK);
 	if (fd < 0) {
 		MSG_ERR("Couldn't open %s with flags O_RDWR: %s\n",
-			MBOX_HOST_PATH, strerror(errno));
+			path, strerror(errno));
 		return -errno;
 	}
 
@@ -809,6 +809,11 @@
 	return 0;
 }
 
+int init_mbox_dev(struct mbox_context *context)
+{
+	return __init_mbox_dev(context, MBOX_HOST_PATH);
+}
+
 void free_mbox_dev(struct mbox_context *context)
 {
 	close(context->fds[MBOX_FD].fd);