Skip to contentSkip to conversation

gpio/samsung: Complain loudly if we don't know the SoC

PATCH Superseded Mark Brown 2 participants 3 messages Oct 17, 2011 GPIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 gpio/samsung: Complain loudly if we don't know the SoC

If we don't know the SoC type then we won't add any chips which is rather unfortunate as neither GPIO nor pinmux APIs will work, breaking lots of different subsystems. Logging at least provides a hint to the user as to what's gone wrong.

---
 drivers/gpio/gpio-samsung.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpio/gpio-samsung.c +3 -0
index 8baa946..90455de 100644
@@ -2495,6 +2495,9 @@ static __init int samsung_gpiolib_init(void)
 		s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS);
 		s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS);
 #endif
+	} else {
+		pr_crit("Unknown SoC in gpio-samsung, no GPIOs added\n");
+		return -ENODEV;
 	}
 
 	return 0;
Signature · 1 line
1.7.6.3
#1 lore raw
Quoted 6 lines · Mark Brown

If we don't know the SoC type then we won't add any chips which is rather unfortunate as neither GPIO nor pinmux APIs will work, breaking lots of different subsystems. Logging at least provides a hint to the user as to what's gone wrong.

Be Bolder! May as well use WARN() and be really obnoxious. :-)

g.

Quoted 22 lines

---
?drivers/gpio/gpio-samsung.c | ? ?3 +++
?1 files changed, 3 insertions(+), 0 deletions(-)

drivers/gpio/gpio-samsung.c +0 -0
index 8baa946..90455de 100644
@@ -2495,6 +2495,9 @@ static __init int samsung_gpiolib_init(void)
 ? ? ? ? ? ? ? ?s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS);
 ? ? ? ? ? ? ? ?s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS);

?#endif
+ ? ? ? } else {
+ ? ? ? ? ? ? ? pr_crit("Unknown SoC in gpio-samsung, no GPIOs added\n");
+ ? ? ? ? ? ? ? return -ENODEV;
? ? ? ?}

? ? ? ?return 0;
--
1.7.6.3

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
author
#2 lore raw
Quoted 10 lines · Grant Likely

On Mon, Oct 17, 2011 at 3:04 PM, Mark Brown

Quoted 6 lines

If we don't know the SoC type then we won't add any chips which is rather unfortunate as neither GPIO nor pinmux APIs will work, breaking lots of different subsystems. Logging at least provides a hint to the user as to what's gone wrong.

Be Bolder! May as well use WARN() and be really obnoxious. :-)

Actually what's really unfortunate here is that in most configurations this will cause a catastrophic failure to boot so we never get far enough to see the logging at all. We really need aSCREAM_THROUGH_DEBUG_LL() or whatever. Or to fix these things to dump via that route if we don't have the console up yet, which is going to be more practical.