2023-10-10 08:23:57

by Jeongtae Park

[permalink] [raw]
Subject: [PATCH v3 0/6] cxl: Fix checkpatch issues

Changes since v2: [1]
- Modify cxl_region_invalidate_memregion() considering the context (Jonathan)
- Drop a duplicated fix (Davidlohr)
- Add reviewed-by, acked-by tags

[1]: https://lore.kernel.org/lkml/[email protected]/

---
Cover letter same as v2

This series fixes various checkpatch errors and warnings.
I've been looking at the CXL driver recently and noticed that there are
trivial mistake codes, so I checked all files with the script and fixed
some warnings/errors.

Jeongtae Park (6):
cxl/trace: Fix improper SPDX comment style for header file
cxl/region: Fix a checkpatch warning
cxl/mem: Fix a checkpatch error
cxl: Fix a checkpatch error
cxl: Fix block comment style
cxl/memdev: Fix a whitespace error

drivers/cxl/core/memdev.c | 10 +++++-----
drivers/cxl/core/region.c | 20 +++++++-------------
drivers/cxl/core/trace.h | 2 +-
drivers/cxl/cxl.h | 4 ++--
drivers/cxl/cxlmem.h | 2 +-
5 files changed, 16 insertions(+), 22 deletions(-)


base-commit: fe77cc2e5a6a7c85f5c6ef8a39d7694ffc7f41c9
--
2.34.1


2023-10-10 08:23:59

by Jeongtae Park

[permalink] [raw]
Subject: [PATCH v3 4/6] cxl: Fix a checkpatch error

ERROR: Macros with complex values should be enclosed in parentheses

Reviewed-by: Dave Jiang <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Davidlohr Bueso <[email protected]>
Signed-off-by: Jeongtae Park <[email protected]>
---
drivers/cxl/cxl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 76d92561af29..545381355efb 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -142,7 +142,7 @@ static inline int ways_to_eiw(unsigned int ways, u8 *eiw)
#define CXL_RAS_HEADER_LOG_OFFSET 0x18
#define CXL_RAS_CAPABILITY_LENGTH 0x58
#define CXL_HEADERLOG_SIZE SZ_512
-#define CXL_HEADERLOG_SIZE_U32 SZ_512 / sizeof(u32)
+#define CXL_HEADERLOG_SIZE_U32 (SZ_512 / sizeof(u32))

/* CXL 2.0 8.2.8.1 Device Capabilities Array Register */
#define CXLDEV_CAP_ARRAY_OFFSET 0x0
--
2.34.1

2023-10-10 08:24:11

by Jeongtae Park

[permalink] [raw]
Subject: [PATCH v3 1/6] cxl/trace: Fix improper SPDX comment style for header file

The SPDX license identifier for C header have to be added
in form of a C-like comment.

Reviewed-by: Dave Jiang <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Signed-off-by: Jeongtae Park <[email protected]>
---
drivers/cxl/core/trace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
index a0b5819bc70b..7aee7fb008a5 100644
--- a/drivers/cxl/core/trace.h
+++ b/drivers/cxl/core/trace.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2022 Intel Corporation. All rights reserved. */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM cxl
--
2.34.1

2023-10-10 08:24:20

by Jeongtae Park

[permalink] [raw]
Subject: [PATCH v3 2/6] cxl/region: Fix a checkpatch warning

WARNING: else is not generally useful after a break or return

Since cpu_cache_invalidate_memregion() already checks for
support of invalidaton operation, it can be removed.
This change would make more efficient or small codes
when 'CONFIG_CXL_REGION_INVALIDATION_TEST' is not set.

Signed-off-by: Jeongtae Park <[email protected]>
---
drivers/cxl/core/region.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index e115ba382e04..0eb7a12badb9 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -127,21 +127,15 @@ static struct cxl_region_ref *cxl_rr_load(struct cxl_port *port,

static int cxl_region_invalidate_memregion(struct cxl_region *cxlr)
{
- if (!cpu_cache_has_invalidate_memregion()) {
- if (IS_ENABLED(CONFIG_CXL_REGION_INVALIDATION_TEST)) {
- dev_warn_once(
- &cxlr->dev,
- "Bypassing cpu_cache_invalidate_memregion() for testing!\n");
- return 0;
- } else {
- dev_err(&cxlr->dev,
- "Failed to synchronize CPU cache state\n");
- return -ENXIO;
- }
+ if (IS_ENABLED(CONFIG_CXL_REGION_INVALIDATION_TEST)
+ && cpu_cache_has_invalidate_memregion()) {
+ dev_warn_once(
+ &cxlr->dev,
+ "Bypassing cpu_cache_invalidate_memregion() for testing!\n");
+ return 0;
}

- cpu_cache_invalidate_memregion(IORES_DESC_CXL);
- return 0;
+ return cpu_cache_invalidate_memregion(IORES_DESC_CXL);
}

static int cxl_region_decode_reset(struct cxl_region *cxlr, int count)
--
2.34.1

2023-10-10 08:24:25

by Jeongtae Park

[permalink] [raw]
Subject: [PATCH v3 3/6] cxl/mem: Fix a checkpatch error

ERROR: spaces required around that '=' (ctx:WxV)

Reviewed-by: Dave Jiang <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Signed-off-by: Jeongtae Park <[email protected]>
---
drivers/cxl/cxlmem.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
index 79e99c873ca2..1ac3eb2be84f 100644
--- a/drivers/cxl/cxlmem.h
+++ b/drivers/cxl/cxlmem.h
@@ -183,7 +183,7 @@ struct cxl_mbox_cmd_rc {
};

static const
-struct cxl_mbox_cmd_rc cxl_mbox_cmd_rctable[] ={ CMD_CMD_RC_TABLE };
+struct cxl_mbox_cmd_rc cxl_mbox_cmd_rctable[] = { CMD_CMD_RC_TABLE };
#undef C

static inline const char *cxl_mbox_cmd_rc2str(struct cxl_mbox_cmd *mbox_cmd)
--
2.34.1

2023-10-10 08:24:40

by Jeongtae Park

[permalink] [raw]
Subject: [PATCH v3 6/6] cxl/memdev: Fix a whitespace error

ERROR: code indent should use tabs where possible

Reviewed-by: Dave Jiang <[email protected]>
Acked-by: Jonathan Cameron <[email protected]>
Signed-off-by: Jeongtae Park <[email protected]>
---
drivers/cxl/core/memdev.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
index f99e7ec3cc40..7e8fca4707c0 100644
--- a/drivers/cxl/core/memdev.c
+++ b/drivers/cxl/core/memdev.c
@@ -935,11 +935,11 @@ static void cxl_fw_cancel(struct fw_upload *fwl)
}

static const struct fw_upload_ops cxl_memdev_fw_ops = {
- .prepare = cxl_fw_prepare,
- .write = cxl_fw_write,
- .poll_complete = cxl_fw_poll_complete,
- .cancel = cxl_fw_cancel,
- .cleanup = cxl_fw_cleanup,
+ .prepare = cxl_fw_prepare,
+ .write = cxl_fw_write,
+ .poll_complete = cxl_fw_poll_complete,
+ .cancel = cxl_fw_cancel,
+ .cleanup = cxl_fw_cleanup,
};

static void devm_cxl_remove_fw_upload(void *fwl)
--
2.34.1