All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [v4] dma/contiguous: avoid warning about unused size_bytes
@ 2025-04-09 15:15 ` Arnd Bergmann
  2025-04-09 15:29   ` Marek Szyprowski
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2025-04-09 15:15 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Arnd Bergmann, Robin Murphy, Michal Nazarewicz, Kyungmin Park,
	iommu, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

When building with W=1, this variable is unused for configs with
CONFIG_CMA_SIZE_SEL_PERCENTAGE=y:

kernel/dma/contiguous.c:67:26: error: 'size_bytes' defined but not used [-Werror=unused-const-variable=]

Change this to a macro to avoid the warning.

Fixes: c64be2bb1c6e ("drivers: add Contiguous Memory Allocator")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v4: fix type mistake from v3
v3: use a macro instead of constant
v2: fix spelling mistake.
---
 kernel/dma/contiguous.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
index 055da410ac71..8df0dfaaca18 100644
--- a/kernel/dma/contiguous.c
+++ b/kernel/dma/contiguous.c
@@ -64,8 +64,7 @@ struct cma *dma_contiguous_default_area;
  * Users, who want to set the size of global CMA area for their system
  * should use cma= kernel parameter.
  */
-static const phys_addr_t size_bytes __initconst =
-	(phys_addr_t)CMA_SIZE_MBYTES * SZ_1M;
+#define size_bytes ((phys_addr_t)CMA_SIZE_MBYTES * SZ_1M)
 static phys_addr_t  size_cmdline __initdata = -1;
 static phys_addr_t base_cmdline __initdata;
 static phys_addr_t limit_cmdline __initdata;
-- 
2.39.5


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

* Re: [PATCH] [v4] dma/contiguous: avoid warning about unused size_bytes
  2025-04-09 15:15 ` [PATCH] [v4] dma/contiguous: avoid warning about unused size_bytes Arnd Bergmann
@ 2025-04-09 15:29   ` Marek Szyprowski
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Szyprowski @ 2025-04-09 15:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Robin Murphy, Michal Nazarewicz, Kyungmin Park,
	iommu, linux-kernel

On 09.04.2025 17:15, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> When building with W=1, this variable is unused for configs with
> CONFIG_CMA_SIZE_SEL_PERCENTAGE=y:
>
> kernel/dma/contiguous.c:67:26: error: 'size_bytes' defined but not used [-Werror=unused-const-variable=]
>
> Change this to a macro to avoid the warning.
>
> Fixes: c64be2bb1c6e ("drivers: add Contiguous Memory Allocator")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>


Thanks, applied to dma-mapping-fixes branch.


> ---
> v4: fix type mistake from v3
> v3: use a macro instead of constant
> v2: fix spelling mistake.
> ---
>   kernel/dma/contiguous.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
> index 055da410ac71..8df0dfaaca18 100644
> --- a/kernel/dma/contiguous.c
> +++ b/kernel/dma/contiguous.c
> @@ -64,8 +64,7 @@ struct cma *dma_contiguous_default_area;
>    * Users, who want to set the size of global CMA area for their system
>    * should use cma= kernel parameter.
>    */
> -static const phys_addr_t size_bytes __initconst =
> -	(phys_addr_t)CMA_SIZE_MBYTES * SZ_1M;
> +#define size_bytes ((phys_addr_t)CMA_SIZE_MBYTES * SZ_1M)
>   static phys_addr_t  size_cmdline __initdata = -1;
>   static phys_addr_t base_cmdline __initdata;
>   static phys_addr_t limit_cmdline __initdata;

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


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

end of thread, other threads:[~2025-04-09 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20250409151611eucas1p299f54f1a61fb8412e515129c82021cd5@eucas1p2.samsung.com>
2025-04-09 15:15 ` [PATCH] [v4] dma/contiguous: avoid warning about unused size_bytes Arnd Bergmann
2025-04-09 15:29   ` Marek Szyprowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.