All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jehoon Park <jehoon.park@samsung.com>
To: linux-cxl@vger.kernel.org
Cc: nvdimm@lists.linux.dev,
	Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Kyungsan Kim <ks0204.kim@samsung.com>,
	Junhyeok Im <junhyeok.im@samsung.com>,
	Jehoon Park <jehoon.park@samsung.com>
Subject: [ndctl PATCH v2 3/3] cxl: Fix the checking value when listing device's health info
Date: Mon,  7 Aug 2023 15:35:49 +0900	[thread overview]
Message-ID: <20230807063549.5942-4-jehoon.park@samsung.com> (raw)
In-Reply-To: <20230807063549.5942-1-jehoon.park@samsung.com>

Fix the value for checking device's life used and temperature fields are
implemented.

Signed-off-by: Jehoon Park <jehoon.park@samsung.com>
---
 cxl/json.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/cxl/json.c b/cxl/json.c
index 7678d02..102bfaf 100644
--- a/cxl/json.c
+++ b/cxl/json.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 // Copyright (C) 2015-2021 Intel Corporation. All rights reserved.
+#include <errno.h>
 #include <limits.h>
 #include <util/json.h>
 #include <uuid/uuid.h>
@@ -238,15 +239,15 @@ static struct json_object *util_cxl_memdev_health_to_json(
 		json_object_object_add(jhealth, "ext_corrected_persistent", jobj);
 
 	/* other fields */
-	field = cxl_cmd_health_info_get_life_used(cmd);
-	if (field != 0xff) {
-		jobj = json_object_new_int(field);
+	rc = cxl_cmd_health_info_get_life_used(cmd);
+	if (rc != -EOPNOTSUPP) {
+		jobj = json_object_new_int(rc);
 		if (jobj)
 			json_object_object_add(jhealth, "life_used_percent", jobj);
 	}
 
 	field = cxl_cmd_health_info_get_temperature(cmd);
-	if (field != 0xffff) {
+	if (field != INT_MAX) {
 		jobj = json_object_new_int(field);
 		if (jobj)
 			json_object_object_add(jhealth, "temperature", jobj);
-- 
2.17.1


      parent reply	other threads:[~2023-08-07  6:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230807063513epcas2p261ba4dfbfff34e99077596128eb6fc48@epcas2p2.samsung.com>
2023-08-07  6:35 ` [ndctl PATCH v2 0/3] Fix accessors for temperature field when it is negative Jehoon Park
     [not found]   ` <CGME20230807063523epcas2p45f74891b764d920b2a9bd22ddf6b6998@epcas2p4.samsung.com>
2023-08-07  6:35     ` [ndctl PATCH v2 1/3] libcxl: Update a revision by CXL 3.0 specification Jehoon Park
2023-08-07 13:02       ` Jonathan Cameron
2023-08-08  7:38         ` Jehoon Park
2023-08-25  1:45       ` Davidlohr Bueso
     [not found]   ` <CGME20230807063538epcas2p4965d5d117b8ef87ac4217bec53beff95@epcas2p4.samsung.com>
2023-08-07  6:35     ` [ndctl PATCH v2 2/3] libcxl: Fix accessors for temperature field to support negative value Jehoon Park
2023-08-07 13:14       ` Jonathan Cameron
2023-08-08  7:41         ` Jehoon Park
     [not found]   ` <CGME20230807063547epcas2p4ccb33e410e77a94e088f283b8c2925db@epcas2p4.samsung.com>
2023-08-07  6:35     ` Jehoon Park [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230807063549.5942-4-jehoon.park@samsung.com \
    --to=jehoon.park@samsung.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=junhyeok.im@samsung.com \
    --cc=ks0204.kim@samsung.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.