* [PATCH] arm64: mm: use macro instead of if judgement of ZONE_DMA
@ 2014-10-16 9:19 Yifan Zhang
2014-10-17 10:51 ` Uwe Kleine-König
0 siblings, 1 reply; 3+ messages in thread
From: Yifan Zhang @ 2014-10-16 9:19 UTC (permalink / raw)
To: linux-arm-kernel
if disable CONFIG_ZONE_DMA, ZONE_DMA becomes undefined.
Signed-off-by: Yifan Zhang <zhangyf@marvell.com>
---
arch/arm64/mm/init.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index
494297c..887ca5d 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -82,10 +82,10 @@ static void __init zone_sizes_init(unsigned long
min, unsigned long max)
memset(zone_size, 0, sizeof(zone_size));
/* 4GB maximum for 32-bit only capable devices */
- if (IS_ENABLED(CONFIG_ZONE_DMA)) {
- max_dma = PFN_DOWN(max_zone_dma_phys());
- zone_size[ZONE_DMA] = max_dma - min;
- }
+#ifdef CONFIG_ZONE_DMA
+ max_dma = PFN_DOWN(max_zone_dma_phys());
+ zone_size[ZONE_DMA] = max_dma - min;
+#endif
zone_size[ZONE_NORMAL] = max - max_dma;
memcpy(zhole_size, zone_size, sizeof(zhole_size)); @@ -97,10
+97,12 @@ static void __init zone_sizes_init(unsigned long min,
unsigned long max)
if (start >= max)
continue;
- if (IS_ENABLED(CONFIG_ZONE_DMA) && start < max_dma) {
+#ifdef CONFIG_ZONE_DMA
+ if (start < max_dma) {
unsigned long dma_end = min(end, max_dma);
zhole_size[ZONE_DMA] -= dma_end - start;
}
+#endif
if (end > max_dma) {
unsigned long normal_end = min(end, max);
--
1.7.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] arm64: mm: use macro instead of if judgement of ZONE_DMA
2014-10-16 9:19 [PATCH] arm64: mm: use macro instead of if judgement of ZONE_DMA Yifan Zhang
@ 2014-10-17 10:51 ` Uwe Kleine-König
2014-10-17 11:23 ` Yifan Zhang
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2014-10-17 10:51 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
On Thu, Oct 16, 2014 at 05:19:43PM +0800, Yifan Zhang wrote:
> @@ -82,10 +82,10 @@ static void __init zone_sizes_init(unsigned long
> min, unsigned long max)
>
> memset(zone_size, 0, sizeof(zone_size));
>
>
>
> /* 4GB maximum for 32-bit only capable devices */
>
> - if (IS_ENABLED(CONFIG_ZONE_DMA)) {
>
> - max_dma = PFN_DOWN(max_zone_dma_phys());
>
> - zone_size[ZONE_DMA] = max_dma - min;
>
> - }
>
> +#ifdef CONFIG_ZONE_DMA
>
> + max_dma = PFN_DOWN(max_zone_dma_phys());
>
> + zone_size[ZONE_DMA] = max_dma - min;
>
> +#endif
Apart from your patch being broken (probably by your MUA or MTA) usually
if (IS_ENABLED(...)) is preferred over #ifdef because it doesn't stand
out over the other program source.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] arm64: mm: use macro instead of if judgement of ZONE_DMA
2014-10-17 10:51 ` Uwe Kleine-König
@ 2014-10-17 11:23 ` Yifan Zhang
0 siblings, 0 replies; 3+ messages in thread
From: Yifan Zhang @ 2014-10-17 11:23 UTC (permalink / raw)
To: linux-arm-kernel
Hi Uwe,
Yes, the first patch is broken. So I sent a v2 which is in correct format.
I understand IS_ENABLED is better, but in this case, we can't use "if"
since "ZONE_DMA" is defined under "#ifdef CONFIG_ZONE_DMA". In current
code, once we disable CONFIG_ZONE_DMA, "zone_size[ZONE_DMA]" will
report compiling error as below:
# configuration written to .config
#
making android
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CC scripts/mod/devicetable-offsets.s
GEN scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
HOSTLD scripts/mod/modpost
CHK include/generated/compile.h
CC arch/arm64/mm/init.o
make[1]: Nothing to be done for `dtbs'.
CGIT kernel/gitinfo.S
arch/arm64/mm/init.c: In function 'zone_sizes_init':
arch/arm64/mm/init.c:85:13: error: 'ZONE_DMA' undeclared (first use in
this function)
zone_size[ZONE_DMA] = max_dma - min;
^
arch/arm64/mm/init.c:85:13: note: each undeclared identifier is
reported only once for each function it appears in
make[1]: *** [arch/arm64/mm/init.o] Error 1
make: *** [arch/arm64/mm] Error 2
make: *** Waiting for unfinished jobs....
AS kernel/gitinfo.o
LD kernel/built-in.o
BR,
Yifan
On Fri, Oct 17, 2014 at 6:51 PM, Uwe Kleine-K?nig
<u.kleine-koenig@pengutronix.de> wrote:
> Hello,
>
> On Thu, Oct 16, 2014 at 05:19:43PM +0800, Yifan Zhang wrote:
>> @@ -82,10 +82,10 @@ static void __init zone_sizes_init(unsigned long
>> min, unsigned long max)
>>
>> memset(zone_size, 0, sizeof(zone_size));
>>
>>
>>
>> /* 4GB maximum for 32-bit only capable devices */
>>
>> - if (IS_ENABLED(CONFIG_ZONE_DMA)) {
>>
>> - max_dma = PFN_DOWN(max_zone_dma_phys());
>>
>> - zone_size[ZONE_DMA] = max_dma - min;
>>
>> - }
>>
>> +#ifdef CONFIG_ZONE_DMA
>>
>> + max_dma = PFN_DOWN(max_zone_dma_phys());
>>
>> + zone_size[ZONE_DMA] = max_dma - min;
>>
>> +#endif
> Apart from your patch being broken (probably by your MUA or MTA) usually
> if (IS_ENABLED(...)) is preferred over #ifdef because it doesn't stand
> out over the other program source.
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-K?nig |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-17 11:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-16 9:19 [PATCH] arm64: mm: use macro instead of if judgement of ZONE_DMA Yifan Zhang
2014-10-17 10:51 ` Uwe Kleine-König
2014-10-17 11:23 ` Yifan Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox