[PATCH v2 0/4] printf: Add struct range print specifier
From: Ira Weiny
Date: Fri Oct 25 2024 - 20:47:07 EST
Support for the Compute Express Link (CXL) Dynamic Capacity Devices
(DCD) have grown a number of uses to print struct range.[1] Support for
a printf specifier '%pra' was being worked within a large series and has
garnered a number of comments and discussion.
To better accelerate both features introduce a separate series to settle
the struct range print enhancement divorced from the CXL DCD feature.
Struct range is used to store a number range similar to struct resource.
Printing struct range becomes cumbersome having to specify 2 specifiers
and the members of the struct. Furthermore, print output benefits from
using a standardized format.
Add to the pointer specifier support for struct range. Share code with
struct resource for more standardization. Add tests for struct resource
to help prevent regressions.
%pra was settled on as the most reasonable format in previous
discussions.[2]
Link: https://lore.kernel.org/all/20241007-dcd-type2-upstream-v4-2-c261ee6eeded@xxxxxxxxx/ [1]
Link: https://lore.kernel.org/all/66cea3bf3332f_f937b29424@iweiny-mobl.notmuch/ [2]
Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
---
Changes in v2:
- Andy: s/resource_and_range/resource_or_range/
- djbw/Petr: Address comments on documentation
- Link to v1: https://patch.msgid.link/20241018-cxl-pra-v1-0-7f49ba58208b@xxxxxxxxx
---
Ira Weiny (4):
test printf: Add very basic struct resource tests
Documentation/printf: struct resource add start == end special case
printf: Add print format (%pra) for struct range
cxl/cdat: Use %pra for dpa range outputs
Documentation/core-api/printk-formats.rst | 20 +++++++++-
drivers/cxl/core/cdat.c | 8 ++--
include/linux/range.h | 6 +++
lib/test_printf.c | 61 +++++++++++++++++++++++++++++++
lib/vsprintf.c | 57 ++++++++++++++++++++++++++---
5 files changed, 141 insertions(+), 11 deletions(-)
---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20240930-cxl-pra-53956ac5fc1e
Best regards,
--
Ira Weiny <ira.weiny@xxxxxxxxx>