Re: [PATCH v9 09/27] gunyah: rsc_mgr: Add resource manager RPC core

From: Alex Elder
Date: Mon Feb 06 2023 - 09:15:06 EST


On 2/2/23 5:53 AM, Srinivas Kandagatla wrote:

+struct gh_rm_rpc_hdr {
+    u8 api;
+    u8 type;
+    __le16 seq;
+    __le32 msg_id;
+} __packed;
+
#define GH_RM_RPC_HDR_SZ    sizeof(struct gh_rm_rpc_hdr)

You could use this in most of the places where sizeof is being called.

I'll repeat my point here. I see no value in hiding
the size of the structure behind a defined symbol.

Use sizeof(*pointer) (if possible) or sizeof(struct foo) in
the code; it makes it very clear that it's not something
other than a simple object/structure size.

-Alex