File cxl-event-trace-use-the-wrapped-util_json_new_u64.patch of Package ndctl
From a440fd8ceb772af58ebeb770e56f9d20db96dde2 Mon Sep 17 00:00:00 2001
From: Vishal Verma <vishal.l.verma@intel.com>
Date: Thu, 23 Feb 2023 22:45:39 -0700
Subject: [PATCH 2/2] cxl/event-trace: use the wrapped util_json_new_u64()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream: Submitted https://patchwork.kernel.org/project/linux-nvdimm/patch/20230223-meson-build-fixes-v1-2-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>
Reviewed-by: Ira Weiny <ira.weiny@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