2c91dc1bcd
This includes support for the CXL commands, and adds the following packages: cxl-cli, cxl-devel, cxl-libs. Resolves: rhbz#2132167
60 lines
1.9 KiB
Diff
60 lines
1.9 KiB
Diff
From f649df38298043f68e73bc730ccb824de045f42d Mon Sep 17 00:00:00 2001
|
|
From: Dan Williams <dan.j.williams@intel.com>
|
|
Date: Thu, 14 Jul 2022 10:02:04 -0700
|
|
Subject: [PATCH 177/217] cxl/list: Hide 0s in disabled decoder listings
|
|
|
|
Trim some redundant information from decoder listings when they are
|
|
disabled.
|
|
|
|
Link: https://lore.kernel.org/r/165781812427.1555691.5252994293073680408.stgit@dwillia2-xfh.jf.intel.com
|
|
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
|
|
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
|
|
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
|
---
|
|
cxl/json.c | 12 ++++++------
|
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/cxl/json.c b/cxl/json.c
|
|
index fdc6f73..a213fda 100644
|
|
--- a/cxl/json.c
|
|
+++ b/cxl/json.c
|
|
@@ -442,7 +442,7 @@ struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
|
|
const char *devname = cxl_decoder_get_devname(decoder);
|
|
struct cxl_port *port = cxl_decoder_get_port(decoder);
|
|
struct json_object *jdecoder, *jobj;
|
|
- u64 val;
|
|
+ u64 val, size;
|
|
|
|
jdecoder = json_object_new_object();
|
|
if (!jdecoder)
|
|
@@ -452,21 +452,21 @@ struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
|
|
if (jobj)
|
|
json_object_object_add(jdecoder, "decoder", jobj);
|
|
|
|
+ size = cxl_decoder_get_size(decoder);
|
|
val = cxl_decoder_get_resource(decoder);
|
|
- if (val < ULLONG_MAX) {
|
|
+ if (size && val < ULLONG_MAX) {
|
|
jobj = util_json_object_hex(val, flags);
|
|
if (jobj)
|
|
json_object_object_add(jdecoder, "resource", jobj);
|
|
}
|
|
|
|
- val = cxl_decoder_get_size(decoder);
|
|
- if (val < ULLONG_MAX) {
|
|
- jobj = util_json_object_size(val, flags);
|
|
+ if (size && size < ULLONG_MAX) {
|
|
+ jobj = util_json_object_size(size, flags);
|
|
if (jobj)
|
|
json_object_object_add(jdecoder, "size", jobj);
|
|
}
|
|
|
|
- if (val == 0) {
|
|
+ if (size == 0) {
|
|
jobj = json_object_new_string("disabled");
|
|
if (jobj)
|
|
json_object_object_add(jdecoder, "state", jobj);
|
|
--
|
|
2.27.0
|
|
|