Fix unwanted type promotion.
[bertos.git] / drv / eeprom.h
index 5e3f78a280aa090c580ae1ba8667ebca827a4042..21ae105ae6c49a3faa3ba536b30912f769a26f83 100644 (file)
@@ -71,9 +71,10 @@ typedef uint16_t e2addr_t;
  * \note We can't just use offsetof() here because we could use
  *       non-constant expressions to access array elements.
  *
- * \note E2Layout is a structure that must be defined in user files.
+ * \note 'type' is the structure type holding eeprom layout
+ *       and must be defined in user files.
  */
-#define e2addr(x) ((e2addr_t)&(((struct E2Layout *)0)->x))
+#define e2addr(type, field) ((e2addr_t)&(((type *)0)->field))
 
 
 bool eeprom_write(e2addr_t addr, const void *buf, size_t count);