mm: fix page_list_* helpers to evaluate all their arguments
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 9 Mar 2016 15:52:31 +0000 (16:52 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 9 Mar 2016 15:52:31 +0000 (16:52 +0100)
commit6890e07e483673ec5f946b7c4654275707924d6d
tree41698c8e16b3bfbdf2ca8836dd02e43c13a36eb6
parent8979888d2d67ea6976438d392420dbc84f3868e4
mm: fix page_list_* helpers to evaluate all their arguments

If an architecture does not provide a custom page_list_entry, default
page_list_* helpers are provided, wrapping list_head as an underlying type for
page_list_head.

The two declarations of the page_list_* helpers differ between defines and
static inline functions, where the defines discard some of their parameters.

This causes a compilation failure if CONFIG_BIGMEM and debug=n in p2m-pod.c:

  p2m-pod.c: In function \91p2m_pod_cache_add\92:
  p2m-pod.c:72:20: error: unused variable \91d\92 [-Werror=unused-variable]
       struct domain *d = p2m->domain;
                      ^
  cc1: all warnings being treated as errors

because the use of d outside of the !NDEBUG section doesn't get evaluated as a
parameter by page_list_del().

Fix this by turning all #defines into static inline functions, so all
parameters are evaluated even if they are not used.

While editing this area, correct the return type of page_list_empty from int
to bool_t.

No functional change.

Reported-by: Doug Goldstein <cardoe@cardoe.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/include/xen/mm.h