diff mbox

[v2] tools: change the type of '*nr' in 'libxl_psr_cat_get_info'

Message ID 1504268105-38654-1-git-send-email-yi.y.sun@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yi Sun Sept. 1, 2017, 12:15 p.m. UTC
Due to historical reason, type of parameter '*nr' in 'libxl_psr_cat_get_info'
is 'int'. But this is not right. It should be 'unsigned int'. This patch fixes
this and does related changes.

Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
---
    - This patch depends on patch 'tools: remove unnecessary PSR macros'.
v2:
    - assign 'num' to '*nr' if return value is success.
      (suggested by Roger Pau Monné)
---
 tools/libxl/libxl.h     | 2 +-
 tools/libxl/libxl_psr.c | 7 +++++--
 tools/xl/xl_psr.c       | 9 ++++-----
 3 files changed, 10 insertions(+), 8 deletions(-)

Comments

Roger Pau Monné Sept. 1, 2017, 2:33 p.m. UTC | #1
On Fri, Sep 01, 2017 at 08:15:05PM +0800, Yi Sun wrote:
> Due to historical reason, type of parameter '*nr' in 'libxl_psr_cat_get_info'
> is 'int'. But this is not right. It should be 'unsigned int'. This patch fixes
> this and does related changes.
> 
> Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.
Wei Liu Sept. 1, 2017, 3:50 p.m. UTC | #2
On Fri, Sep 01, 2017 at 08:15:05PM +0800, Yi Sun wrote:
> Due to historical reason, type of parameter '*nr' in 'libxl_psr_cat_get_info'
> is 'int'. But this is not right. It should be 'unsigned int'. This patch fixes
> this and does related changes.
> 
> Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

If you confirm the code changed is not released I can modify the commit
message while committing -- no need to resend.
Yi Sun Sept. 2, 2017, 3:01 p.m. UTC | #3
On 17-09-01 16:50:39, Wei Liu wrote:
> On Fri, Sep 01, 2017 at 08:15:05PM +0800, Yi Sun wrote:
> > Due to historical reason, type of parameter '*nr' in 'libxl_psr_cat_get_info'
> > is 'int'. But this is not right. It should be 'unsigned int'. This patch fixes
> > this and does related changes.
> > 
> > Suggested-by: Roger Pau Monn? <roger.pau@citrix.com>
> > Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>
> 
> If you confirm the code changed is not released I can modify the commit
> message while committing -- no need to resend.

Thank you! Yes, the 'libxl_psr_cat_get_info' is introduced by L2 CAT patch
set which was merged into Xen 4.10 unstable branch recently. So, it has not
been released yet.
Wei Liu Sept. 4, 2017, 9:08 a.m. UTC | #4
On Fri, Sep 01, 2017 at 08:15:05PM +0800, Yi Sun wrote:
> Due to historical reason, type of parameter '*nr' in 'libxl_psr_cat_get_info'
> is 'int'. But this is not right. It should be 'unsigned int'. This patch fixes
> this and does related changes.
> 
> Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
> ---
>     - This patch depends on patch 'tools: remove unnecessary PSR macros'.

I suppose you want to resend this patch because its dependence should be
dropped?
diff mbox

Patch

diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index a0185b9..0c90c41 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -2210,7 +2210,7 @@  int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid,
  * and the length in 'nr'.
  */
 int libxl_psr_cat_get_info(libxl_ctx *ctx, libxl_psr_cat_info **info,
-                           int *nr, unsigned int lvl);
+                           unsigned int *nr, unsigned int lvl);
 int libxl_psr_cat_get_l3_info(libxl_ctx *ctx, libxl_psr_cat_info **info,
                               int *nr);
 void libxl_psr_cat_info_list_free(libxl_psr_cat_info *list, int nr);
diff --git a/tools/libxl/libxl_psr.c b/tools/libxl/libxl_psr.c
index f55ba1e..197505a 100644
--- a/tools/libxl/libxl_psr.c
+++ b/tools/libxl/libxl_psr.c
@@ -362,7 +362,7 @@  int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid,
 }
 
 int libxl_psr_cat_get_info(libxl_ctx *ctx, libxl_psr_cat_info **info,
-                           int *nr, unsigned int lvl)
+                           unsigned int *nr, unsigned int lvl)
 {
     GC_INIT(ctx);
     int rc;
@@ -410,8 +410,11 @@  int libxl_psr_cat_get_l3_info(libxl_ctx *ctx, libxl_psr_cat_info **info,
                               int *nr)
 {
     int rc;
+    unsigned int num;
 
-    rc = libxl_psr_cat_get_info(ctx, info, nr, 3);
+    rc = libxl_psr_cat_get_info(ctx, info, &num, 3);
+    if (!rc)
+        *nr = num;
 
     return rc;
 }
diff --git a/tools/xl/xl_psr.c b/tools/xl/xl_psr.c
index 544f6f0..ef00048 100644
--- a/tools/xl/xl_psr.c
+++ b/tools/xl/xl_psr.c
@@ -294,8 +294,8 @@  int main_psr_cmt_show(int argc, char **argv)
 
 static int psr_l3_cat_hwinfo(void)
 {
-    int rc, nr;
-    unsigned int i;
+    int rc;
+    unsigned int i, nr;
     uint32_t l3_cache_size;
     libxl_psr_cat_info *info;
 
@@ -424,7 +424,7 @@  static int psr_cat_print_socket(uint32_t domid, libxl_psr_cat_info *info,
 
 static int psr_cat_show(uint32_t domid, unsigned int lvl)
 {
-    int i, nr;
+    unsigned int i, nr;
     int rc;
     libxl_psr_cat_info *info;
 
@@ -453,8 +453,7 @@  out:
 static int psr_l2_cat_hwinfo(void)
 {
     int rc;
-    unsigned int i;
-    int nr;
+    unsigned int i, nr;
     libxl_psr_cat_info *info;
 
     rc = libxl_psr_cat_get_info(ctx, &info, &nr, 2);