Described restrictions for common HAL object methods.

Inheritance of HAL object is performed by composing a child structure of a
single parent structure located at offset 0 followed by new data members
and function pointers in the child structure.

For example,

struct child {
  struct parent common;
  int a_data_member;
  void (*a_method)(struct child *c, int v);
};

HAL code assumes this layout when accessing child structures given a pointer
to a parent structure such that users write code like the following...

void child_method(struct *parent, int v) {
  struct child * c = (struct child*)parent;
  // do stuff with c
}

Code above will break if a member is added before "common" in "struct child".

This change adds comments that describe the restriction on the location of
parent HAL objects within a derived HAL object.  HAL objects that already
have comments that describe the required location of parent objects are not
modified.

Change-Id: Ibe4300275286ef275b2097534c84f1029d761d87
diff --git a/include/hardware/nfc.h b/include/hardware/nfc.h
index 09523b3..3edfeb6 100644
--- a/include/hardware/nfc.h
+++ b/include/hardware/nfc.h
@@ -210,6 +210,12 @@
 #define NFC_PN544_CONTROLLER "pn544"
 
 typedef struct nfc_module_t {
+    /**
+     * Common methods of the NFC NXP PN544 module.  This *must* be the first member of
+     * nfc_module_t as users of this structure will cast a hw_module_t to
+     * nfc_module_t pointer in contexts where it's known the hw_module_t references an
+     * nfc_module_t.
+     */
     struct hw_module_t common;
 } nfc_module_t;
 
@@ -227,6 +233,12 @@
 } nfc_pn544_linktype;
 
 typedef struct {
+    /**
+     * Common methods of the NFC NXP PN544 device.  This *must* be the first member of
+     * nfc_pn544_device_t as users of this structure will cast a hw_device_t to
+     * nfc_pn544_device_t pointer in contexts where it's known the hw_device_t references an
+     * nfc_pn544_device_t.
+     */
     struct hw_device_t common;
 
     /* The number of EEPROM registers to write */