* [PATCH] cxl/mbox: Drop extra struct resource cast
@ 2023-02-28 15:21 Jonathan Cameron
2023-02-28 15:44 ` Dave Jiang
2023-03-01 15:45 ` Andy Shevchenko
0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Cameron @ 2023-02-28 15:21 UTC (permalink / raw)
To: linux-cxl, Dan Williams; +Cc: Andy Shevchenko, linuxarm
DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED()
macro which already has the (struct resource) cast.
Fixes warnings with W=1 C=1
CC [M] drivers/cxl/core/mbox.o
CHECK drivers/cxl/core/mbox.c
drivers/cxl/core/mbox.c:1064:18: warning: cast to non-scalar
drivers/cxl/core/mbox.c:1064:18: warning: cast from non-scalar
Fixes: 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
I'm seeing a couple of other instances of this
drivers/acpi/arm64/gtdt.c
arch/arm/mach-shmobile/pm-rcar-gen2.c
Might get around to fixing them but more than happy if someone beats me to it.
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 f2addb457172..dce16088ceee 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -1052,8 +1052,7 @@ int cxl_mem_create_range_info(struct cxl_dev_state *cxlds)
struct device *dev = cxlds->dev;
int rc;
- cxlds->dpa_res =
- (struct resource)DEFINE_RES_MEM(0, cxlds->total_bytes);
+ cxlds->dpa_res = DEFINE_RES_MEM(0, cxlds->total_bytes);
if (cxlds->partition_align_bytes == 0) {
rc = add_dpa_res(dev, &cxlds->dpa_res, &cxlds->ram_res, 0,
--
2.37.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] cxl/mbox: Drop extra struct resource cast
2023-02-28 15:21 [PATCH] cxl/mbox: Drop extra struct resource cast Jonathan Cameron
@ 2023-02-28 15:44 ` Dave Jiang
2023-03-01 15:45 ` Andy Shevchenko
1 sibling, 0 replies; 4+ messages in thread
From: Dave Jiang @ 2023-02-28 15:44 UTC (permalink / raw)
To: Jonathan Cameron, linux-cxl, Dan Williams; +Cc: Andy Shevchenko, linuxarm
On 2/28/23 8:21 AM, Jonathan Cameron wrote:
> DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED()
> macro which already has the (struct resource) cast.
>
> Fixes warnings with W=1 C=1
> CC [M] drivers/cxl/core/mbox.o
> CHECK drivers/cxl/core/mbox.c
> drivers/cxl/core/mbox.c:1064:18: warning: cast to non-scalar
> drivers/cxl/core/mbox.c:1064:18: warning: cast from non-scalar
>
> Fixes: 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>
> I'm seeing a couple of other instances of this
> drivers/acpi/arm64/gtdt.c
> arch/arm/mach-shmobile/pm-rcar-gen2.c
>
> Might get around to fixing them but more than happy if someone beats me to it.
>
> 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 f2addb457172..dce16088ceee 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -1052,8 +1052,7 @@ int cxl_mem_create_range_info(struct cxl_dev_state *cxlds)
> struct device *dev = cxlds->dev;
> int rc;
>
> - cxlds->dpa_res =
> - (struct resource)DEFINE_RES_MEM(0, cxlds->total_bytes);
> + cxlds->dpa_res = DEFINE_RES_MEM(0, cxlds->total_bytes);
>
> if (cxlds->partition_align_bytes == 0) {
> rc = add_dpa_res(dev, &cxlds->dpa_res, &cxlds->ram_res, 0,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cxl/mbox: Drop extra struct resource cast
2023-02-28 15:21 [PATCH] cxl/mbox: Drop extra struct resource cast Jonathan Cameron
2023-02-28 15:44 ` Dave Jiang
@ 2023-03-01 15:45 ` Andy Shevchenko
2023-03-01 15:46 ` Andy Shevchenko
1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2023-03-01 15:45 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-cxl, Dan Williams, linuxarm
On Tue, Feb 28, 2023 at 03:21:12PM +0000, Jonathan Cameron wrote:
> DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED()
> macro which already has the (struct resource) cast.
It's not a cast. As commit message that brought it says: "Converting it to be
a compound literal..."
> Fixes warnings with W=1 C=1
> CC [M] drivers/cxl/core/mbox.o
> CHECK drivers/cxl/core/mbox.c
> drivers/cxl/core/mbox.c:1064:18: warning: cast to non-scalar
> drivers/cxl/core/mbox.c:1064:18: warning: cast from non-scalar
Otherwise it's a correct fix, thank you!
For the corrected version:
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Fixes: 52c4d11f1dce ("resource: Convert DEFINE_RES_NAMED() to be compound literal")
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>
> I'm seeing a couple of other instances of this
> drivers/acpi/arm64/gtdt.c
> arch/arm/mach-shmobile/pm-rcar-gen2.c
>
> Might get around to fixing them but more than happy if someone beats me to it.
>
> 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 f2addb457172..dce16088ceee 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -1052,8 +1052,7 @@ int cxl_mem_create_range_info(struct cxl_dev_state *cxlds)
> struct device *dev = cxlds->dev;
> int rc;
>
> - cxlds->dpa_res =
> - (struct resource)DEFINE_RES_MEM(0, cxlds->total_bytes);
> + cxlds->dpa_res = DEFINE_RES_MEM(0, cxlds->total_bytes);
>
> if (cxlds->partition_align_bytes == 0) {
> rc = add_dpa_res(dev, &cxlds->dpa_res, &cxlds->ram_res, 0,
> --
> 2.37.2
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cxl/mbox: Drop extra struct resource cast
2023-03-01 15:45 ` Andy Shevchenko
@ 2023-03-01 15:46 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2023-03-01 15:46 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-cxl, Dan Williams, linuxarm
On Wed, Mar 01, 2023 at 05:45:45PM +0200, Andy Shevchenko wrote:
> On Tue, Feb 28, 2023 at 03:21:12PM +0000, Jonathan Cameron wrote:
> > DEFINE_RES_MEM() is a wrapper around the DEFINE_RES_NAMED()
> > macro which already has the (struct resource) cast.
>
> It's not a cast. As commit message that brought it says: "Converting it to be
> a compound literal..."
...
> > - cxlds->dpa_res =
> > - (struct resource)DEFINE_RES_MEM(0, cxlds->total_bytes);
FWIW, here it's also not a cast.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-01 15:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-28 15:21 [PATCH] cxl/mbox: Drop extra struct resource cast Jonathan Cameron
2023-02-28 15:44 ` Dave Jiang
2023-03-01 15:45 ` Andy Shevchenko
2023-03-01 15:46 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox