From: Michal Suchanek <
msuc...@suse.de>
The structures that store nid values store them as unsigned, causing
different signedness comparison warnings.
---
src/drmgr/common_numa.c | 5 +++--
src/drmgr/common_numa.h | 6 +++---
src/drmgr/drslot_chrp_mem.c | 18 ++++++++++--------
3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/drmgr/common_numa.c b/src/drmgr/common_numa.c
index 898aab6f8ed6..cf8a1cfe5f6b 100644
--- a/src/drmgr/common_numa.c
+++ b/src/drmgr/common_numa.c
@@ -27,7 +27,7 @@
#include "drmem.h" /* for DYNAMIC_RECONFIG_MEM */
#include "common_numa.h"
-struct ppcnuma_node *ppcnuma_fetch_node(struct ppcnuma_topology *numa, int nid)
+struct ppcnuma_node *ppcnuma_fetch_node(struct ppcnuma_topology *numa, unsigned nid)
{
struct ppcnuma_node *node;
@@ -67,7 +67,8 @@ static int read_numa_topology(struct ppcnuma_topology *numa)
{
struct bitmask *cpus;
struct ppcnuma_node *node;
- int rc, max_node, nid, i;
+ int rc;
+ unsigned max_node, nid, i;
if (numa_available() < 0)
return -ENOENT;
diff --git a/src/drmgr/common_numa.h b/src/drmgr/common_numa.h
index c209a3efdecd..06e28cec3f60 100644
--- a/src/drmgr/common_numa.h
+++ b/src/drmgr/common_numa.h
@@ -46,10 +46,10 @@ struct ppcnuma_topology {
int ppcnuma_get_topology(struct ppcnuma_topology *numa);
struct ppcnuma_node *ppcnuma_fetch_node(struct ppcnuma_topology *numa,
- int node_id);
+ unsigned node_id);
-static inline int ppcnuma_next_node(struct ppcnuma_topology *numa, int nid,
- struct ppcnuma_node **node)
+static inline unsigned ppcnuma_next_node(struct ppcnuma_topology *numa, unsigned nid,
+ struct ppcnuma_node **node)
{
for (nid++; nid <= numa->node_max; nid++)
if (numa->nodes[nid]) {
diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c
index d37ee80a80ee..dec9c4c4e913 100644
--- a/src/drmgr/drslot_chrp_mem.c
+++ b/src/drmgr/drslot_chrp_mem.c
@@ -312,12 +312,14 @@ get_mem_node_lmbs(struct lmb_list_head *lmb_list)
static int link_lmb_to_numa_node(struct dr_node *lmb)
{
- int nid;
+ int ret;
+ unsigned nid;
struct ppcnuma_node *node;
- nid = aa_index_to_node(&numa.aa, lmb->lmb_aa_index);
- if (nid == -1)
+ ret = aa_index_to_node(&numa.aa, lmb->lmb_aa_index);
+ if (ret == -1)
return 0;
+ nid = ret;
node = ppcnuma_fetch_node(&numa, nid);
if (!node)
@@ -1521,7 +1523,7 @@ static int remove_lmb_from_node(struct ppcnuma_node *node, uint32_t count)
static void update_cpuless_node_ratio(void)
{
struct ppcnuma_node *node;
- int nid;
+ unsigned nid;
/*
* Assumptions:
@@ -1549,7 +1551,7 @@ static void update_cpuless_node_ratio(void)
static int remove_cpuless_lmbs(uint32_t count)
{
struct ppcnuma_node *node;
- int nid;
+ unsigned nid;
uint32_t total = count, todo, done = 0, this_loop;
while (count) {
@@ -1593,7 +1595,7 @@ static int remove_cpuless_lmbs(uint32_t count)
static void update_node_ratio(void)
{
- int nid;
+ unsigned nid;
struct ppcnuma_node *node, *n, **p;
uint32_t cpu_ratio, mem_ratio;
@@ -1695,7 +1697,7 @@ static void build_numa_topology(void)
static void clear_numa_lmb_links(void)
{
- int nid;
+ unsigned nid;
struct ppcnuma_node *node;
ppcnuma_foreach_node(&numa, nid, node)
@@ -1706,7 +1708,7 @@ static int numa_based_remove(uint32_t count)
{
struct lmb_list_head *lmb_list;
struct ppcnuma_node *node;
- int nid;
+ unsigned nid;
uint32_t done = 0;
/*
--
2.48.1