Skip to contentSkip to conversation

Fix checking for multiple boot tags in board config.

PATCH In review Jonathan McDowell 3 participants 5 messages Apr 7, 2006 – May 15, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix checking for multiple boot tags in board config.

Currently if we look for more than one instance of a boot tag and it's defined in the board config rather than passed by the boot loader we can get stuck in a loop where the same tag is processed many times. This can be seen with the gpio-switch driver, for example. The patch below fixes this by respecting the skip parameter to get_config when we're scanning the board config structure.

arch/arm/plat-omap/common.c +6 -2
index 0625df5..39ab667 100644
@@ -114,8 +114,12 @@ static const void *get_config(u16 tag, s
 	 * in the kernel. */
 	for (i = 0; i < omap_board_config_size; i++) {
 		if (omap_board_config[i].tag == tag) {
-			kinfo = &omap_board_config[i];
-			break;
+			if (skip == 0) {
+				kinfo = &omap_board_config[i];
+				break;
+			} else {
+				skip--;
+			}
 		}
 	}
 	if (kinfo == NULL)
#1 lore raw
Quoted 18 lines · ext Jonathan McDowell

Currently if we look for more than one instance of a boot tag and it's defined in the board config rather than passed by the boot loader we can get stuck in a loop where the same tag is processed many times. This can be seen with the gpio-switch driver, for example. The patch below fixes this by respecting the skip parameter to get_config when we're scanning the board config structure.

arch/arm/plat-omap/common.c +0 -1
index 0625df5..39ab667 100644
@@ -114,8 +114,12 @@ static const void *get_config(u16 tag, s
 	 * in the kernel. */
 	for (i = 0; i < omap_board_config_size; i++) {
 		if (omap_board_config[i].tag == tag) {
-			kinfo = &omap_board_config[i];

arch/arm/plat-omap/common.c static const void *get_config(u16 tag, s · line 125

Quoted 10 lines
arch/arm/plat-omap/common.c +6 -1
-			break;
+			if (skip == 0) {
+				kinfo = &omap_board_config[i];
+				break;
+			} else {
+				skip--;
+			}
 		}
 	}
 	if (kinfo == NULL)

Should the case be handled when a configuration is present in both the boot tag and the board config? If so, we should stop parsing after the boot tags whenever the requested tag is found, even if there are less then 'skip' instances of it, and return NULL.

--Imre

Quoted 4 lines

_______________________________________________
Linux-omap-open-source mailing list
[email protected]
http://linux.omap.com/mailman/listinfo/linux-omap-open-source

#2 lore raw
Quoted 26 lines · Imre Deak
Quoted 25 lines · ext Jonathan McDowell

Currently if we look for more than one instance of a boot tag and it's defined in the board config rather than passed by the boot loader we can get stuck in a loop where the same tag is processed many times. This can be seen with the gpio-switch driver, for example. The patch below fixes this by respecting the skip parameter to get_config when we're scanning the board config structure.

arch/arm/plat-omap/common.c +6 -2
index 0625df5..39ab667 100644
@@ -114,8 +114,12 @@ static const void *get_config(u16 tag, s
 	 * in the kernel. */
 	for (i = 0; i < omap_board_config_size; i++) {
 		if (omap_board_config[i].tag == tag) {
-			kinfo = &omap_board_config[i];
-			break;
+			if (skip == 0) {
+				kinfo = &omap_board_config[i];
+				break;
+			} else {
+				skip--;
+			}
Quoted 8 lines

arch/arm/plat-omap/common.c static const void *get_config(u16 tag, s · line 125

Quoted 3 lines
arch/arm/plat-omap/common.c +0 -0
 		}
 	}
 	if (kinfo == NULL)

Should the case be handled when a configuration is present in both the boot tag and the board config? If so, we should stop parsing after the boot tags whenever the requested tag is found, even if there are less then 'skip' instances of it, and return NULL.

If a config option that can appear multiple times (ie when the skip option would apply) is present in both the boot tag and board config I'd expect both to have effect. You might have some instances of a device that exist on all variants of the board (that would be in the board config) and then some additional instances that would be controlled by the boot tags passed by the boot loader. Though equally I can see the argument for the other way when you'd want to override the defaults. :)

J.

Signature · 2 lines
 [    101 things you can't have too much of : 46 - Clinton jokes.     ]
 [ http://www.blackcatnetworks.co.uk/ - IPv6 enabled ADSL/dialup/colo ]
#3 lore raw
Quoted 36 lines · ext Jonathan McDowell
Quoted 26 lines · Imre Deak
Quoted 25 lines · ext Jonathan McDowell

Currently if we look for more than one instance of a boot tag and it's defined in the board config rather than passed by the boot loader we can get stuck in a loop where the same tag is processed many times. This can be seen with the gpio-switch driver, for example. The patch below fixes this by respecting the skip parameter to get_config when we're scanning the board config structure.

arch/arm/plat-omap/common.c +6 -2
index 0625df5..39ab667 100644
@@ -114,8 +114,12 @@ static const void *get_config(u16 tag, s
 	 * in the kernel. */
 	for (i = 0; i < omap_board_config_size; i++) {
 		if (omap_board_config[i].tag == tag) {
-			kinfo = &omap_board_config[i];
-			break;
+			if (skip == 0) {
+				kinfo = &omap_board_config[i];
+				break;
+			} else {
+				skip--;
+			}
Quoted 8 lines

arch/arm/plat-omap/common.c static const void *get_config(u16 tag, s · line 125

Quoted 3 lines
arch/arm/plat-omap/common.c +0 -0
 		}
 	}
 	if (kinfo == NULL)

Should the case be handled when a configuration is present in both the boot tag and the board config? If so, we should stop parsing after the boot tags whenever the requested tag is found, even if there are less then 'skip' instances of it, and return NULL.

Quoted 8 lines

If a config option that can appear multiple times (ie when the skip option would apply) is present in both the boot tag and board config I'd expect both to have effect. You might have some instances of a device that exist on all variants of the board (that would be in the board config) and then some additional instances that would be controlled by the boot tags passed by the boot loader. Though equally I can see the argument for the other way when you'd want to override the defaults. :)

Ok, I didn't consider the semantic where we merge the two configurations. And since it was the implied behavior so far, fixing it with your patch seems to be the right thing.

--Imre

#4 lore raw
Quoted 46 lines · Imre Deak
Quoted 36 lines · ext Jonathan McDowell
Quoted 26 lines · Imre Deak
Quoted 25 lines · ext Jonathan McDowell

Currently if we look for more than one instance of a boot tag and it's defined in the board config rather than passed by the boot loader we can get stuck in a loop where the same tag is processed many times. This can be seen with the gpio-switch driver, for example. The patch below fixes this by respecting the skip parameter to get_config when we're scanning the board config structure.

arch/arm/plat-omap/common.c +6 -2
index 0625df5..39ab667 100644
@@ -114,8 +114,12 @@ static const void *get_config(u16 tag, s
 	 * in the kernel. */
 	for (i = 0; i < omap_board_config_size; i++) {
 		if (omap_board_config[i].tag == tag) {
-			kinfo = &omap_board_config[i];
-			break;
+			if (skip == 0) {
+				kinfo = &omap_board_config[i];
+				break;
+			} else {
+				skip--;
+			}
Quoted 8 lines

arch/arm/plat-omap/common.c static const void *get_config(u16 tag, s · line 125

Quoted 3 lines
arch/arm/plat-omap/common.c +0 -0
 		}
 	}
 	if (kinfo == NULL)

Should the case be handled when a configuration is present in both the boot tag and the board config? If so, we should stop parsing after the boot tags whenever the requested tag is found, even if there are less then 'skip' instances of it, and return NULL.

Quoted 8 lines

If a config option that can appear multiple times (ie when the skip option would apply) is present in both the boot tag and board config I'd expect both to have effect. You might have some instances of a device that exist on all variants of the board (that would be in the board config) and then some additional instances that would be controlled by the boot tags passed by the boot loader. Though equally I can see the argument for the other way when you'd want to override the defaults. :)

Quoted 3 lines

Ok, I didn't consider the semantic where we merge the two configurations. And since it was the implied behavior so far, fixing it with your patch seems to be the right thing.

Pushing this today.

Tony