summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDong Aisheng <b29396@freescale.com>2013-11-08 15:48:23 +0800
committerRobin Gong <b38343@freescale.com>2015-01-30 10:01:00 +0800
commitc0d09423760297ad97f30fa51c1ee1efab9d12d8 (patch)
treead25f1750e2a40f8c122684ac8183256a2e90993
parent3a7207f904d9e7aa802b704da7e3df26ddcf6720 (diff)
ENGR00286971-1 imx6q: add sanity check for getting gpio for flexcan
This is used to avoid a warning: WARNING: at /home/b29397/work/projects/linux-2.6-imx/drivers/gpio/gpiolib.c:126 gpio_to_desc+0x30/0x44() invalid GPIO -517 Modules linked in: .... gpiod_request: invalid GPIO Signed-off-by: Dong Aisheng <b29396@freescale.com> (cherry picked from commit e644b009e6e127f028f3a2708585fa867a9db35c)
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index cc8715c526d5..30a4aef274c3 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -125,7 +125,8 @@ static int __init imx6q_flexcan_fixup_auto(void)
flexcan_en_gpio = of_get_named_gpio(np, "trx-en-gpio", 0);
flexcan_stby_gpio = of_get_named_gpio(np, "trx-stby-gpio", 0);
- if (!gpio_request_one(flexcan_en_gpio, GPIOF_DIR_OUT, "flexcan-trx-en") &&
+ if (gpio_is_valid(flexcan_en_gpio) && gpio_is_valid(flexcan_stby_gpio) &&
+ !gpio_request_one(flexcan_en_gpio, GPIOF_DIR_OUT, "flexcan-trx-en") &&
!gpio_request_one(flexcan_stby_gpio, GPIOF_DIR_OUT, "flexcan-trx-stby")) {
/* flexcan 0 & 1 are using the same GPIOs for transceiver */
flexcan_pdata[0].transceiver_switch = imx6q_flexcan0_switch_auto;