2023-09-21 05:19:40

by Jeongtae Park

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

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 (7):
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 whitespace error/warnings
cxl/trace: Enclose a multiple statements macro in a do while loop

drivers/cxl/core/memdev.c | 12 ++++++------
drivers/cxl/core/region.c | 7 +++----
drivers/cxl/core/trace.h | 26 ++++++++++++++------------
drivers/cxl/cxl.h | 4 ++--
drivers/cxl/cxlmem.h | 2 +-
5 files changed, 26 insertions(+), 25 deletions(-)


base-commit: fe77cc2e5a6a7c85f5c6ef8a39d7694ffc7f41c9
--
2.34.1


2023-09-21 05:20:03

by Jeongtae Park

[permalink] [raw]
Subject: [PATCH 7/7] cxl/trace: Enclose a multiple statements macro in a do while loop

ERROR: Macros with complex values should be enclosed in parentheses

Signed-off-by: Jeongtae Park <[email protected]>
---
drivers/cxl/core/trace.h | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
index 7aee7fb008a5..e2338773dcd6 100644
--- a/drivers/cxl/core/trace.h
+++ b/drivers/cxl/core/trace.h
@@ -199,17 +199,19 @@ TRACE_EVENT(cxl_overflow,
__field(u8, hdr_maint_op_class)

#define CXL_EVT_TP_fast_assign(cxlmd, l, hdr) \
- __assign_str(memdev, dev_name(&(cxlmd)->dev)); \
- __assign_str(host, dev_name((cxlmd)->dev.parent)); \
- __entry->log = (l); \
- __entry->serial = (cxlmd)->cxlds->serial; \
- memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \
- __entry->hdr_length = (hdr).length; \
- __entry->hdr_flags = get_unaligned_le24((hdr).flags); \
- __entry->hdr_handle = le16_to_cpu((hdr).handle); \
- __entry->hdr_related_handle = le16_to_cpu((hdr).related_handle); \
- __entry->hdr_timestamp = le64_to_cpu((hdr).timestamp); \
- __entry->hdr_maint_op_class = (hdr).maint_op_class
+ do { \
+ __assign_str(memdev, dev_name(&(cxlmd)->dev)); \
+ __assign_str(host, dev_name((cxlmd)->dev.parent)); \
+ __entry->log = (l); \
+ __entry->serial = (cxlmd)->cxlds->serial; \
+ memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \
+ __entry->hdr_length = (hdr).length; \
+ __entry->hdr_flags = get_unaligned_le24((hdr).flags); \
+ __entry->hdr_handle = le16_to_cpu((hdr).handle); \
+ __entry->hdr_related_handle = le16_to_cpu((hdr).related_handle); \
+ __entry->hdr_timestamp = le64_to_cpu((hdr).timestamp); \
+ __entry->hdr_maint_op_class = (hdr).maint_op_class; \
+ } while (0)

#define CXL_EVT_TP_printk(fmt, ...) \
TP_printk("memdev=%s host=%s serial=%lld log=%s : time=%llu uuid=%pUb " \
--
2.34.1

2023-09-21 05:39:42

by Jeongtae Park

[permalink] [raw]
Subject: [PATCH 6/7] cxl/memdev: Fix whitespace error/warnings

ERROR: code indent should use tabs where possible
WARNING: please, no spaces at the start of a line

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

diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
index f99e7ec3cc40..ce67df163452 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)
@@ -1010,7 +1010,7 @@ static int cxl_memdev_security_init(struct cxl_memdev *cxlmd)
}

return devm_add_action_or_reset(cxlds->dev, put_sanitize, mds);
- }
+}

struct cxl_memdev *devm_cxl_add_memdev(struct cxl_dev_state *cxlds)
{
--
2.34.1

2023-09-21 10:41:09

by Jeongtae Park

[permalink] [raw]
Subject: [PATCH 5/7] cxl: Fix block comment style

WARNING: Block comments should align the * on each line

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 545381355efb..0bbe0c15bfa9 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -334,7 +334,7 @@ enum cxl_decoder_type {
* @flags: memory type capabilities and locking
* @commit: device/decoder-type specific callback to commit settings to hw
* @reset: device/decoder-type specific callback to reset hw settings
-*/
+ */
struct cxl_decoder {
struct device dev;
int id;
--
2.34.1

2023-09-21 23:10:29

by Dave Jiang

[permalink] [raw]
Subject: Re: [PATCH 5/7] cxl: Fix block comment style



On 9/20/23 19:51, Jeongtae Park wrote:
> WARNING: Block comments should align the * on each line
>
> Signed-off-by: Jeongtae Park <[email protected]>

Reviewed-by: Dave Jiang <[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 545381355efb..0bbe0c15bfa9 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -334,7 +334,7 @@ enum cxl_decoder_type {
> * @flags: memory type capabilities and locking
> * @commit: device/decoder-type specific callback to commit settings to hw
> * @reset: device/decoder-type specific callback to reset hw settings
> -*/
> + */
> struct cxl_decoder {
> struct device dev;
> int id;

2023-09-22 00:32:35

by Dave Jiang

[permalink] [raw]
Subject: Re: [PATCH 6/7] cxl/memdev: Fix whitespace error/warnings



On 9/20/23 19:51, Jeongtae Park wrote:
> ERROR: code indent should use tabs where possible
> WARNING: please, no spaces at the start of a line
>
> Signed-off-by: Jeongtae Park <[email protected]>

two different issues?

> ---
> drivers/cxl/core/memdev.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
> index f99e7ec3cc40..ce67df163452 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)
> @@ -1010,7 +1010,7 @@ static int cxl_memdev_security_init(struct cxl_memdev *cxlmd)
> }
>
> return devm_add_action_or_reset(cxlds->dev, put_sanitize, mds);
> - }
> +}
>
> struct cxl_memdev *devm_cxl_add_memdev(struct cxl_dev_state *cxlds)
> {

2023-09-23 00:09:52

by Dave Jiang

[permalink] [raw]
Subject: Re: [PATCH 7/7] cxl/trace: Enclose a multiple statements macro in a do while loop



On 9/20/23 19:51, Jeongtae Park wrote:
> ERROR: Macros with complex values should be enclosed in parentheses
>
> Signed-off-by: Jeongtae Park <[email protected]>

I think that goes against typical traceevent macros layout. I would ignore checkpatch warnings on traceevent stuff.


> ---
> drivers/cxl/core/trace.h | 24 +++++++++++++-----------
> 1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
> index 7aee7fb008a5..e2338773dcd6 100644
> --- a/drivers/cxl/core/trace.h
> +++ b/drivers/cxl/core/trace.h
> @@ -199,17 +199,19 @@ TRACE_EVENT(cxl_overflow,
> __field(u8, hdr_maint_op_class)
>
> #define CXL_EVT_TP_fast_assign(cxlmd, l, hdr) \
> - __assign_str(memdev, dev_name(&(cxlmd)->dev)); \
> - __assign_str(host, dev_name((cxlmd)->dev.parent)); \
> - __entry->log = (l); \
> - __entry->serial = (cxlmd)->cxlds->serial; \
> - memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \
> - __entry->hdr_length = (hdr).length; \
> - __entry->hdr_flags = get_unaligned_le24((hdr).flags); \
> - __entry->hdr_handle = le16_to_cpu((hdr).handle); \
> - __entry->hdr_related_handle = le16_to_cpu((hdr).related_handle); \
> - __entry->hdr_timestamp = le64_to_cpu((hdr).timestamp); \
> - __entry->hdr_maint_op_class = (hdr).maint_op_class
> + do { \
> + __assign_str(memdev, dev_name(&(cxlmd)->dev)); \
> + __assign_str(host, dev_name((cxlmd)->dev.parent)); \
> + __entry->log = (l); \
> + __entry->serial = (cxlmd)->cxlds->serial; \
> + memcpy(&__entry->hdr_uuid, &(hdr).id, sizeof(uuid_t)); \
> + __entry->hdr_length = (hdr).length; \
> + __entry->hdr_flags = get_unaligned_le24((hdr).flags); \
> + __entry->hdr_handle = le16_to_cpu((hdr).handle); \
> + __entry->hdr_related_handle = le16_to_cpu((hdr).related_handle); \
> + __entry->hdr_timestamp = le64_to_cpu((hdr).timestamp); \
> + __entry->hdr_maint_op_class = (hdr).maint_op_class; \
> + } while (0)
>
> #define CXL_EVT_TP_printk(fmt, ...) \
> TP_printk("memdev=%s host=%s serial=%lld log=%s : time=%llu uuid=%pUb " \