Linux CXL
 help / color / mirror / Atom feed
From: Vishal Verma <vishal.l.verma@intel.com>
To: linux-cxl@vger.kernel.org
Cc: "Michal Suchánek" <msuchanek@suse.de>,
	"Dave Jiang" <dave.jiang@intel.com>,
	"Dan Williams" <dan.j.williams@intel.com>,
	"Dan Williams" <dan.j.williams@intel.com>,
	"Vishal Verma" <vishal.l.verma@intel.com>,
	nvdimm@lists.linux.dev
Subject: [PATCH ndctl 2/2] cxl/event-trace: use the wrapped util_json_new_u64()
Date: Thu, 23 Feb 2023 22:45:39 -0700	[thread overview]
Message-ID: <20230223-meson-build-fixes-v1-2-5fae3b606395@intel.com> (raw)
In-Reply-To: <20230223-meson-build-fixes-v1-0-5fae3b606395@intel.com>

The json-c API json_object_new_uint64() is relatively new, and some distros
may not have it available. There is already a wrapped version in
util/json.h which falls back to the int64 API, based on meson's
determination of the availability of the uint64 version at compile time.
Replace the direct uint64 calls with this wrapped version.

Link: https://github.com/pmem/ndctl/issues/233
Fixes: 8dedc6cf5e85 ("cxl: add a helper to parse trace events into a json object")
Reported-by: Michal Suchánek <msuchanek@suse.de>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 cxl/event_trace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cxl/event_trace.c b/cxl/event_trace.c
index 926f446..db8cc85 100644
--- a/cxl/event_trace.c
+++ b/cxl/event_trace.c
@@ -25,7 +25,7 @@ static struct json_object *num_to_json(void *num, int elem_size, unsigned long f
 		if (sign)
 			return json_object_new_int64(*(int64_t *)num);
 		else
-			return json_object_new_uint64(*(uint64_t *)num);
+			return util_json_new_u64(*(uint64_t *)num);
 	}
 
 	/* All others fit in a signed 64 bit */
@@ -98,7 +98,7 @@ static int cxl_event_to_json(struct tep_event *event, struct tep_record *record,
 	}
 	json_object_object_add(jevent, "event", jobj);
 
-	jobj = json_object_new_uint64(record->ts);
+	jobj = util_json_new_u64(record->ts);
 	if (!jobj) {
 		rc = -ENOMEM;
 		goto err_jevent;

-- 
2.39.1


  parent reply	other threads:[~2023-02-24  5:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24  5:45 [PATCH ndctl 0/2] fix a couple of meson issues with v76 Vishal Verma
2023-02-24  5:45 ` [PATCH ndctl 1/2] cxl/monitor: fix include paths for tracefs and traceevent Vishal Verma
2023-02-24  7:54   ` Ira Weiny
2023-02-24 15:29   ` Dave Jiang
2023-02-24  5:45 ` Vishal Verma [this message]
2023-02-24  7:55   ` [PATCH ndctl 2/2] cxl/event-trace: use the wrapped util_json_new_u64() Ira Weiny
2023-02-24 15:29   ` Dave Jiang
2023-02-24  9:06 ` [PATCH ndctl 0/2] fix a couple of meson issues with v76 Michal Suchánek

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=20230223-meson-build-fixes-v1-2-5fae3b606395@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=msuchanek@suse.de \
    --cc=nvdimm@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox