Thread (178 messages) flat view 178 messages, 24 authors, 2014-03-26
STALE4522d REVIEWED: 1 (0M)

1 review trailer.

[PATCH 04/62] ARM: at91: fix broken "if () else" statement

From: arnd@arndb.de (Arnd Bergmann)
Date: 2014-03-21 15:48:50
Subsystem: arm port, arm/microchip (at91) soc support, the rest · Maintainers: Russell King, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Linus Torvalds

On Thursday 20 March 2014, Jean-Christophe PLAGNIOL-VILLARD wrote:
On Mar 20, 2014, at 3:29 AM, Arnd Bergmann [off-list ref] wrote:
quoted
-	if (data->flags & AT91_CF_TRUE_IDE)
#if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE)
+	if (data->flags & AT91_CF_TRUE_IDE)
I prefer if (IS_ENABLED())
quoted
		pdev->name = "pata_at91";
+	else
#else
#warning "board requires AT91_CF_TRUE_IDE: enable pata_at91?
but this means drop this warning
quoted
#endif
Good idea, thanks!

	Arnd
From ce916f429091f98cc53ee9cf11e6e02b4dc3dc25 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <arnd@arndb.de>
Date: Thu, 13 Mar 2014 17:47:23 +0100
Subject: [PATCH] ARM: at91: fix broken "if () else" statement

If CONFIG_PATA_AT91 is disabled, the code in at91_add_device_cf
is turned into invalid C statements due to the lack of an
expression before the 'else' clause.

This moves the first half of the condition inside of the #ifdef,
which seems to be what the author intended.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Nicolas Ferre <redacted>
Cc: Andrew Victor <redacted>
Cc: Jean-Christophe Plagniol-Villard <redacted>
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 2ae7715..33fa98d 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -1263,12 +1263,8 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
 	at91_set_A_periph(AT91_PIN_PC10, 0);    /* CFRNW */
 	at91_set_A_periph(AT91_PIN_PC15, 1);    /* NWAIT */
 
-	if (data->flags & AT91_CF_TRUE_IDE)
-#if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE)
+	if (IS_ENABLED(CONFIG_PATA_AT91) && (data->flags & AT91_CF_TRUE_IDE)
 		pdev->name = "pata_at91";
-#else
-#warning "board requires AT91_CF_TRUE_IDE: enable pata_at91"
-#endif
 	else
 		pdev->name = "at91_cf";
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help