linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: festevam@gmail.com (Fabio Estevam)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: mach-mxs/mx28evk: Only register devices if their GPIO requests succeeded
Date: Tue, 13 Sep 2011 17:25:19 -0300	[thread overview]
Message-ID: <1315945519-15178-1-git-send-email-festevam@gmail.com> (raw)

Currently framebuffer and MMC devices are registered even if their associated 
GPIO pins fail to be requested.

Change the logic so that the registration of such devices only occurs if their 
GPIO requests succeeded.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/mach-mxs/mach-mx28evk.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
index 3f86e7a..e5c66a2 100644
--- a/arch/arm/mach-mxs/mach-mx28evk.c
+++ b/arch/arm/mach-mxs/mach-mx28evk.c
@@ -353,7 +353,7 @@ static struct mxs_mmc_platform_data mx28evk_mmc_pdata[] __initdata = {
 
 static void __init mx28evk_init(void)
 {
-	int ret;
+	int ret, gpio_lcd_error;
 
 	mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads));
 
@@ -378,18 +378,23 @@ static void __init mx28evk_init(void)
 	}
 
 	ret = gpio_request_one(MX28EVK_LCD_ENABLE, GPIOF_DIR_OUT, "lcd-enable");
-	if (ret)
+	if (ret) {
 		pr_warn("failed to request gpio lcd-enable: %d\n", ret);
+		gpio_lcd_error = 1;
+	}
 	else
 		gpio_set_value(MX28EVK_LCD_ENABLE, 1);
 
 	ret = gpio_request_one(MX28EVK_BL_ENABLE, GPIOF_DIR_OUT, "bl-enable");
-	if (ret)
+	if (ret) {
 		pr_warn("failed to request gpio bl-enable: %d\n", ret);
+		gpio_lcd_error = 1;
+	}
 	else
 		gpio_set_value(MX28EVK_BL_ENABLE, 1);
 
-	mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
+	if (!gpio_lcd_error)
+		mx28_add_mxsfb(&mx28evk_mxsfb_pdata);
 
 	/* power on mmc slot by writing 0 to the gpio */
 	ret = gpio_request_one(MX28EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW,
@@ -402,8 +407,9 @@ static void __init mx28evk_init(void)
 			       "mmc1-slot-power");
 	if (ret)
 		pr_warn("failed to request gpio mmc1-slot-power: %d\n", ret);
-	mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]);
-
+	else
+		mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]);
+
 	gpio_led_register_device(0, &mx28evk_led_data);
 }
 
-- 
1.7.1

             reply	other threads:[~2011-09-13 20:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-13 20:25 Fabio Estevam [this message]
2011-09-14  3:18 ` [PATCH] ARM: mach-mxs/mx28evk: Only register devices if their GPIO requests succeeded Shawn Guo
2011-09-14  3:12   ` Fabio Estevam
2011-09-14  3:31     ` Shawn Guo
2011-09-14  3:37 ` Shawn Guo
2011-09-14  6:55 ` Uwe Kleine-König
2011-09-14 13:23   ` Fabio Estevam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315945519-15178-1-git-send-email-festevam@gmail.com \
    --to=festevam@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).