linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/6] cxl: Fix checkpatch issues
       [not found] <CGME20231010082321epcas2p292c86c6757dcc1cfeeeb796c29a3e07b@epcas2p2.samsung.com>
@ 2023-10-10  8:26 ` Jeongtae Park
       [not found]   ` <CGME20231010082321epcas2p39eb70352eb4e1febe51f9aa56681002e@epcas2p3.samsung.com>
                     ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Jeongtae Park @ 2023-10-10  8:26 UTC (permalink / raw)
  To: Dan Williams, Alison Schofield, Vishal Verma, Ben Widawsky,
	Jonathan Cameron, Dave Jiang, Davidlohr Bueso, Fan Ni, linux-cxl
  Cc: linux-kernel, Greg Kroah-Hartman, Kyungsan Kim, Wonjae Lee,
	Hojin Nam, Junhyeok Im, Jehoon Park, Jeongtae Park,
	Jeongtae Park

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/20230922113443.3297726-1-jtp.park@samsung.com/

---
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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/6] cxl/trace: Fix improper SPDX comment style for header file
       [not found]   ` <CGME20231010082321epcas2p39eb70352eb4e1febe51f9aa56681002e@epcas2p3.samsung.com>
@ 2023-10-10  8:26     ` Jeongtae Park
  0 siblings, 0 replies; 8+ messages in thread
From: Jeongtae Park @ 2023-10-10  8:26 UTC (permalink / raw)
  To: Dan Williams, Alison Schofield, Vishal Verma, Ben Widawsky,
	Jonathan Cameron, Dave Jiang, Davidlohr Bueso, Fan Ni, linux-cxl
  Cc: linux-kernel, Greg Kroah-Hartman, Kyungsan Kim, Wonjae Lee,
	Hojin Nam, Junhyeok Im, Jehoon Park, Jeongtae Park,
	Jeongtae Park, Jonathan Cameron

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

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jeongtae Park <jtp.park@samsung.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/6] cxl/region: Fix a checkpatch warning
       [not found]   ` <CGME20231010082321epcas2p13641bd794b1c26d2137bb51093fd49f7@epcas2p1.samsung.com>
@ 2023-10-10  8:26     ` Jeongtae Park
  2023-10-11 20:23       ` Jonathan Cameron
  0 siblings, 1 reply; 8+ messages in thread
From: Jeongtae Park @ 2023-10-10  8:26 UTC (permalink / raw)
  To: Dan Williams, Alison Schofield, Vishal Verma, Ben Widawsky,
	Jonathan Cameron, Dave Jiang, Davidlohr Bueso, Fan Ni, linux-cxl
  Cc: linux-kernel, Greg Kroah-Hartman, Kyungsan Kim, Wonjae Lee,
	Hojin Nam, Junhyeok Im, Jehoon Park, Jeongtae Park,
	Jeongtae Park

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 <jtp.park@samsung.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 3/6] cxl/mem: Fix a checkpatch error
       [not found]   ` <CGME20231010082321epcas2p369390101e543193908ad3578dcbac6a8@epcas2p3.samsung.com>
@ 2023-10-10  8:26     ` Jeongtae Park
  0 siblings, 0 replies; 8+ messages in thread
From: Jeongtae Park @ 2023-10-10  8:26 UTC (permalink / raw)
  To: Dan Williams, Alison Schofield, Vishal Verma, Ben Widawsky,
	Jonathan Cameron, Dave Jiang, Davidlohr Bueso, Fan Ni, linux-cxl
  Cc: linux-kernel, Greg Kroah-Hartman, Kyungsan Kim, Wonjae Lee,
	Hojin Nam, Junhyeok Im, Jehoon Park, Jeongtae Park,
	Jeongtae Park, Jonathan Cameron

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

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jeongtae Park <jtp.park@samsung.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 4/6] cxl: Fix a checkpatch error
       [not found]   ` <CGME20231010082321epcas2p26c6ba3f7298bd8266c59761e080cc732@epcas2p2.samsung.com>
@ 2023-10-10  8:26     ` Jeongtae Park
  0 siblings, 0 replies; 8+ messages in thread
From: Jeongtae Park @ 2023-10-10  8:26 UTC (permalink / raw)
  To: Dan Williams, Alison Schofield, Vishal Verma, Ben Widawsky,
	Jonathan Cameron, Dave Jiang, Davidlohr Bueso, Fan Ni, linux-cxl
  Cc: linux-kernel, Greg Kroah-Hartman, Kyungsan Kim, Wonjae Lee,
	Hojin Nam, Junhyeok Im, Jehoon Park, Jeongtae Park,
	Jeongtae Park, Jonathan Cameron

ERROR: Macros with complex values should be enclosed in parentheses

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Jeongtae Park <jtp.park@samsung.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 5/6] cxl: Fix block comment style
       [not found]   ` <CGME20231010082321epcas2p253634722bcbe0dc9189fcdb67d3a2e29@epcas2p2.samsung.com>
@ 2023-10-10  8:26     ` Jeongtae Park
  0 siblings, 0 replies; 8+ messages in thread
From: Jeongtae Park @ 2023-10-10  8:26 UTC (permalink / raw)
  To: Dan Williams, Alison Schofield, Vishal Verma, Ben Widawsky,
	Jonathan Cameron, Dave Jiang, Davidlohr Bueso, Fan Ni, linux-cxl
  Cc: linux-kernel, Greg Kroah-Hartman, Kyungsan Kim, Wonjae Lee,
	Hojin Nam, Junhyeok Im, Jehoon Park, Jeongtae Park,
	Jeongtae Park, Jonathan Cameron

WARNING: Block comments should align the * on each line

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jeongtae Park <jtp.park@samsung.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 6/6] cxl/memdev: Fix a whitespace error
       [not found]   ` <CGME20231010082321epcas2p29211e29f64b7a4d0a032df5f60c6942f@epcas2p2.samsung.com>
@ 2023-10-10  8:26     ` Jeongtae Park
  0 siblings, 0 replies; 8+ messages in thread
From: Jeongtae Park @ 2023-10-10  8:26 UTC (permalink / raw)
  To: Dan Williams, Alison Schofield, Vishal Verma, Ben Widawsky,
	Jonathan Cameron, Dave Jiang, Davidlohr Bueso, Fan Ni, linux-cxl
  Cc: linux-kernel, Greg Kroah-Hartman, Kyungsan Kim, Wonjae Lee,
	Hojin Nam, Junhyeok Im, Jehoon Park, Jeongtae Park,
	Jeongtae Park, Jonathan Cameron

ERROR: code indent should use tabs where possible

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jeongtae Park <jtp.park@samsung.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 2/6] cxl/region: Fix a checkpatch warning
  2023-10-10  8:26     ` [PATCH v3 2/6] cxl/region: Fix a checkpatch warning Jeongtae Park
@ 2023-10-11 20:23       ` Jonathan Cameron
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2023-10-11 20:23 UTC (permalink / raw)
  To: Jeongtae Park
  Cc: Dan Williams, Alison Schofield, Vishal Verma, Ben Widawsky,
	Dave Jiang, Davidlohr Bueso, Fan Ni, linux-cxl, linux-kernel,
	Greg Kroah-Hartman, Kyungsan Kim, Wonjae Lee, Hojin Nam,
	Junhyeok Im, Jehoon Park, Jeongtae Park

On Tue, 10 Oct 2023 17:26:04 +0900
Jeongtae Park <jtp.park@samsung.com> wrote:

> 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.

Oddly short line wrap - aim for 75 chars ish.

> 
> Signed-off-by: Jeongtae Park <jtp.park@samsung.com>


> ---
>  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);

This is an arch specific call.  Whilst today on x86 (only option) the only way to
return an error is if it's not supported, that's not necessarily going to be the
case for other architectures. So I'd prefer to keep the dev_err if this fails.

Jonathan

>  }
>  
>  static int cxl_region_decode_reset(struct cxl_region *cxlr, int count)


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-10-11 20:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20231010082321epcas2p292c86c6757dcc1cfeeeb796c29a3e07b@epcas2p2.samsung.com>
2023-10-10  8:26 ` [PATCH v3 0/6] cxl: Fix checkpatch issues Jeongtae Park
     [not found]   ` <CGME20231010082321epcas2p39eb70352eb4e1febe51f9aa56681002e@epcas2p3.samsung.com>
2023-10-10  8:26     ` [PATCH v3 1/6] cxl/trace: Fix improper SPDX comment style for header file Jeongtae Park
     [not found]   ` <CGME20231010082321epcas2p13641bd794b1c26d2137bb51093fd49f7@epcas2p1.samsung.com>
2023-10-10  8:26     ` [PATCH v3 2/6] cxl/region: Fix a checkpatch warning Jeongtae Park
2023-10-11 20:23       ` Jonathan Cameron
     [not found]   ` <CGME20231010082321epcas2p369390101e543193908ad3578dcbac6a8@epcas2p3.samsung.com>
2023-10-10  8:26     ` [PATCH v3 3/6] cxl/mem: Fix a checkpatch error Jeongtae Park
     [not found]   ` <CGME20231010082321epcas2p26c6ba3f7298bd8266c59761e080cc732@epcas2p2.samsung.com>
2023-10-10  8:26     ` [PATCH v3 4/6] cxl: " Jeongtae Park
     [not found]   ` <CGME20231010082321epcas2p253634722bcbe0dc9189fcdb67d3a2e29@epcas2p2.samsung.com>
2023-10-10  8:26     ` [PATCH v3 5/6] cxl: Fix block comment style Jeongtae Park
     [not found]   ` <CGME20231010082321epcas2p29211e29f64b7a4d0a032df5f60c6942f@epcas2p2.samsung.com>
2023-10-10  8:26     ` [PATCH v3 6/6] cxl/memdev: Fix a whitespace error Jeongtae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).