Linux CXL
 help / color / mirror / Atom feed
* [PATCH v2] cxl/mbox: Remove useless cast in cxl_mem_create_range_info()
@ 2023-08-15 17:20 alison.schofield
  2023-08-16  1:52 ` Dan Williams
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: alison.schofield @ 2023-08-15 17:20 UTC (permalink / raw)
  To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
	Vishal Verma, Ira Weiny, Dan Williams
  Cc: Andy Shevchenko, linux-cxl

From: Alison Schofield <alison.schofield@intel.com>

DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED() macro
which already has the (struct resource) for the compound literal.
The user of the macro should not repeat the cast.

Cleans up these sparse warnings:
drivers/cxl/core/mbox.c:1184:18: warning: cast to non-scalar
drivers/cxl/core/mbox.c:1184:18: warning: cast from non-scalar

Fixes: 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---

Changes in v2:
- Update commit log (Andy)
- Add fixes tag (Jonathan)

 drivers/cxl/core/mbox.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index d6d067fbee97..01de4b438b2a 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -1180,8 +1180,7 @@ int cxl_mem_create_range_info(struct cxl_memdev_state *mds)
 		return 0;
 	}
 
-	cxlds->dpa_res =
-		(struct resource)DEFINE_RES_MEM(0, mds->total_bytes);
+	cxlds->dpa_res = DEFINE_RES_MEM(0, mds->total_bytes);
 
 	if (mds->partition_align_bytes == 0) {
 		rc = add_dpa_res(dev, &cxlds->dpa_res, &cxlds->ram_res, 0,

base-commit: fe77cc2e5a6a7c85f5c6ef8a39d7694ffc7f41c9
-- 
2.37.3


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

* RE: [PATCH v2] cxl/mbox: Remove useless cast in cxl_mem_create_range_info()
  2023-08-15 17:20 [PATCH v2] cxl/mbox: Remove useless cast in cxl_mem_create_range_info() alison.schofield
@ 2023-08-16  1:52 ` Dan Williams
  2023-08-17 13:04 ` Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Williams @ 2023-08-16  1:52 UTC (permalink / raw)
  To: alison.schofield, Davidlohr Bueso, Jonathan Cameron, Dave Jiang,
	Vishal Verma, Ira Weiny, Dan Williams
  Cc: Andy Shevchenko, linux-cxl

alison.schofield@ wrote:
> From: Alison Schofield <alison.schofield@intel.com>
> 
> DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED() macro
> which already has the (struct resource) for the compound literal.
> The user of the macro should not repeat the cast.
> 
> Cleans up these sparse warnings:
> drivers/cxl/core/mbox.c:1184:18: warning: cast to non-scalar
> drivers/cxl/core/mbox.c:1184:18: warning: cast from non-scalar
> 
> Fixes: 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>

Looks good to me.

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

* Re: [PATCH v2] cxl/mbox: Remove useless cast in cxl_mem_create_range_info()
  2023-08-15 17:20 [PATCH v2] cxl/mbox: Remove useless cast in cxl_mem_create_range_info() alison.schofield
  2023-08-16  1:52 ` Dan Williams
@ 2023-08-17 13:04 ` Andy Shevchenko
  2023-08-17 15:10 ` Davidlohr Bueso
  2023-08-23 16:56 ` Jonathan Cameron
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2023-08-17 13:04 UTC (permalink / raw)
  To: alison.schofield
  Cc: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Vishal Verma,
	Ira Weiny, Dan Williams, linux-cxl

On Tue, Aug 15, 2023 at 10:20:52AM -0700, alison.schofield@intel.com wrote:
> From: Alison Schofield <alison.schofield@intel.com>
> 
> DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED() macro
> which already has the (struct resource) for the compound literal.
> The user of the macro should not repeat the cast.

s/repeat/use/


> Cleans up these sparse warnings:
> drivers/cxl/core/mbox.c:1184:18: warning: cast to non-scalar
> drivers/cxl/core/mbox.c:1184:18: warning: cast from non-scalar

With the above fixed,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thank you!

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2] cxl/mbox: Remove useless cast in cxl_mem_create_range_info()
  2023-08-15 17:20 [PATCH v2] cxl/mbox: Remove useless cast in cxl_mem_create_range_info() alison.schofield
  2023-08-16  1:52 ` Dan Williams
  2023-08-17 13:04 ` Andy Shevchenko
@ 2023-08-17 15:10 ` Davidlohr Bueso
  2023-08-23 16:56 ` Jonathan Cameron
  3 siblings, 0 replies; 5+ messages in thread
From: Davidlohr Bueso @ 2023-08-17 15:10 UTC (permalink / raw)
  To: alison.schofield
  Cc: Jonathan Cameron, Dave Jiang, Vishal Verma, Ira Weiny,
	Dan Williams, Andy Shevchenko, linux-cxl

On Tue, 15 Aug 2023, alison.schofield@intel.com wrote:

>From: Alison Schofield <alison.schofield@intel.com>
>
>DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED() macro
>which already has the (struct resource) for the compound literal.
>The user of the macro should not repeat the cast.
>
>Cleans up these sparse warnings:
>drivers/cxl/core/mbox.c:1184:18: warning: cast to non-scalar
>drivers/cxl/core/mbox.c:1184:18: warning: cast from non-scalar
>
>Fixes: 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")
>Signed-off-by: Alison Schofield <alison.schofield@intel.com>

Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>

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

* Re: [PATCH v2] cxl/mbox: Remove useless cast in cxl_mem_create_range_info()
  2023-08-15 17:20 [PATCH v2] cxl/mbox: Remove useless cast in cxl_mem_create_range_info() alison.schofield
                   ` (2 preceding siblings ...)
  2023-08-17 15:10 ` Davidlohr Bueso
@ 2023-08-23 16:56 ` Jonathan Cameron
  3 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2023-08-23 16:56 UTC (permalink / raw)
  To: alison.schofield
  Cc: Davidlohr Bueso, Dave Jiang, Vishal Verma, Ira Weiny,
	Dan Williams, Andy Shevchenko, linux-cxl

On Tue, 15 Aug 2023 10:20:52 -0700
alison.schofield@intel.com wrote:

> From: Alison Schofield <alison.schofield@intel.com>
> 
> DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED() macro
> which already has the (struct resource) for the compound literal.
> The user of the macro should not repeat the cast.
> 
> Cleans up these sparse warnings:
> drivers/cxl/core/mbox.c:1184:18: warning: cast to non-scalar
> drivers/cxl/core/mbox.c:1184:18: warning: cast from non-scalar
> 
> Fixes: 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
> 
> Changes in v2:
> - Update commit log (Andy)
> - Add fixes tag (Jonathan)
> 
>  drivers/cxl/core/mbox.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index d6d067fbee97..01de4b438b2a 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -1180,8 +1180,7 @@ int cxl_mem_create_range_info(struct cxl_memdev_state *mds)
>  		return 0;
>  	}
>  
> -	cxlds->dpa_res =
> -		(struct resource)DEFINE_RES_MEM(0, mds->total_bytes);
> +	cxlds->dpa_res = DEFINE_RES_MEM(0, mds->total_bytes);
>  
>  	if (mds->partition_align_bytes == 0) {
>  		rc = add_dpa_res(dev, &cxlds->dpa_res, &cxlds->ram_res, 0,
> 
> base-commit: fe77cc2e5a6a7c85f5c6ef8a39d7694ffc7f41c9


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

end of thread, other threads:[~2023-08-23 16:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-15 17:20 [PATCH v2] cxl/mbox: Remove useless cast in cxl_mem_create_range_info() alison.schofield
2023-08-16  1:52 ` Dan Williams
2023-08-17 13:04 ` Andy Shevchenko
2023-08-17 15:10 ` Davidlohr Bueso
2023-08-23 16:56 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox