Refactor to eliminate taking the address of a packed member.

Bug: http://b/31532493

NanoHub::doRun() was previously taking the address of msg.hdr.app_name,
which isn't allowed, as it could possibly be misaligned. In fact,
looking at the data structure layout of the packed, nested structs,
app_name (a struct containing only a single uint64_t) will always be
packed immediately after a uint32_t. No matter what alignment we want to
apply to the main struct, we will never end up with an aligned uint64_t.
To address this, we merely switch to copying the uint64_t directly,
rather than passing it as a pointer.

Test: Built successfully with latest compilers.

Change-Id: Iecf67cb10a0f5e2b8ceb6363e0c4a9b927d1bfa9
diff --git a/contexthubhal/nanohubhal.cpp b/contexthubhal/nanohubhal.cpp
index 48ad40f..387ac37 100644
--- a/contexthubhal/nanohubhal.cpp
+++ b/contexthubhal/nanohubhal.cpp
@@ -146,9 +146,9 @@
     }
 }
 
-int NanoHub::doSendToDevice(const hub_app_name_t *name, const void *data, uint32_t len, uint32_t messageType)
+int NanoHub::doSendToDevice(const hub_app_name_t name, const void *data, uint32_t len, uint32_t messageType)
 {
-    if (len > MAX_RX_PACKET || name == nullptr) {
+    if (len > MAX_RX_PACKET) {
         return -EINVAL;
     }
 
@@ -156,7 +156,7 @@
     nano_message_chre msg = {
         .hdr = {
             .eventId = APP_FROM_HOST_CHRE_EVENT_ID,
-            .appId = name->id,
+            .appId = name.id,
             .len = static_cast<uint8_t>(len),
             .appEventId = messageType,
         },
@@ -399,7 +399,7 @@
             if (messageTracingEnabled()) {
                 dumpBuffer("APP -> DEV", msg->app_name, msg->message_type, msg->message, msg->message_len);
             }
-            ret = doSendToDevice(&msg->app_name, msg->message, msg->message_len, msg->message_type);
+            ret = doSendToDevice(msg->app_name, msg->message, msg->message_len, msg->message_type);
         }
     }
 
diff --git a/contexthubhal/nanohubhal.h b/contexthubhal/nanohubhal.h
index 20e8f72..b2acc9b 100644
--- a/contexthubhal/nanohubhal.h
+++ b/contexthubhal/nanohubhal.h
@@ -116,7 +116,7 @@
 
     int doSubscribeMessages(uint32_t hub_id, context_hub_callback *cbk, void *cookie);
     int doSendToNanohub(uint32_t hub_id, const hub_message_t *msg);
-    int doSendToDevice(const hub_app_name_t *name, const void *data, uint32_t len, uint32_t messageType);
+    int doSendToDevice(const hub_app_name_t name, const void *data, uint32_t len, uint32_t messageType);
     void doSendToApp(HubMessage &&msg);
 
     static constexpr unsigned int FL_MESSAGE_TRACING = 1;
@@ -149,7 +149,7 @@
     }
     // passes message to kernel driver directly
     static int sendToDevice(const hub_app_name_t *name, const void *data, uint32_t len) {
-        return hubInstance()->doSendToDevice(name, data, len, 0);
+        return hubInstance()->doSendToDevice(*name, data, len, 0);
     }
     // passes message to APP via callback
     static void sendToApp(HubMessage &&msg) {