Having submitted a module based on coreboot to LKML for acceptance,
it was requested that fewer macros and more inlines be used (because
of their superior type-checking when performing pointer casts, etc).
This is the first of several changes to make the relevant parts of
coreboot comply to linux code standards.
Change-Id: Iffe7061fa62fa639e0cb6ccb9125eb3403d06b1a
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Reviewed-on: http://review.coreboot.org/495
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
}
wprintw(win, "%16.16llx - %16.16llx",
- UNPACK_CB64(cb_info.range[i].start),
- UNPACK_CB64(cb_info.range[i].start) +
- UNPACK_CB64(cb_info.range[i].size) - 1);
+ cb_unpack64(cb_info.range[i].start),
+ cb_unpack64(cb_info.range[i].start) +
+ cb_unpack64(cb_info.range[i].size) - 1);
}
return 0;
#endif
info->memrange[info->n_memranges].base =
- UNPACK_CB64(range->start);
+ cb_unpack64(range->start);
info->memrange[info->n_memranges].size =
- UNPACK_CB64(range->size);
+ cb_unpack64(range->size);
info->memrange[info->n_memranges].type = range->type;
u32 type;
};
+/* Helpful inlines */
+
+static inline u64 cb_unpack64(struct cbuint64 val)
+{
+ return (((u64) val.hi) << 32) | val.lo;
+}
+
/* Helpful macros */
#define MEM_RANGE_COUNT(_rec) \
#define MB_PART_STRING(_mb) \
(((unsigned char *) ((_mb)->strings)) + (_mb)->part_number_idx)
-#define UNPACK_CB64(_in) \
- ( (((u64) _in.hi) << 32) | _in.lo )
-
#endif