hv: treewide: fix 'Macro parameter not in brackets'

Add the brackets for Macro parameter to avoid the unintentional
mistakes.

A simple example that may cause mistakes:
        #define minus(x) -x
When the following call is made,
        z = minus(a-b)
it becomes:
        z = -a-b;
where "-a - b" is equivalent to "(-a) - b" rather than "- (a - b)", as
expected.

v2 -> v3:
 * convert DMAR_WAIT_COMPLETION to inline function
 * remove the macro PIC_PIN_FOREACH and implement the well-formed
   for loop in each case
 * replace __CPP_STRING with STRINGIFY and remove the unused CPP_STRING

v1 -> v2:
 * Remove some changes to function like macro since MISRA-C requires to
   use inline functions if it is possible.
   These MACRO brackets violations will be fixed together when fixing
   other issues related to function like macro.

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
This commit is contained in:
Shiqing Gao
2018-09-05 10:55:29 +08:00
committed by lijinxia
parent 30b77aba5d
commit 4360235edf
10 changed files with 92 additions and 72 deletions

View File

@@ -112,11 +112,11 @@ static inline void list_splice_init(struct list_head *list,
((type *)((char *)(ptr)-(uint64_t)(&((type *)0)->member)))
#define list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
for ((pos) = (head)->next; (pos) != (head); (pos) = (pos)->next)
#define list_for_each_safe(pos, n, head) \
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
for ((pos) = (head)->next, (n) = (pos)->next; (pos) != (head); \
(pos) = (n), (n) = (pos)->next)
#define get_first_item(attached, type, member) \
((type *)((char *)((attached)->next)-(uint64_t)(&((type *)0)->member)))