aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-12-15 03:16:34 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-04 19:30:34 -0500
commit20bb8095a467dde88bd09a55ed62c60fada2e5c9 (patch)
treed4c387d24cb5a4731c9a0427598e3374710c6732 /drivers/tty
parenta197a191f73a75d80d5b67e09e0b89c214dc3690 (diff)
serial/imx: let probing fail for the dt case without a valid alias
When the uart device is instantiated by dt but dt doesn't provide an alias then better let probing fail instead of falling back to an unrelated device id used for the line number and no platform data. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/imx.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 2813f0210377..92a5987924cf 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1302,6 +1302,10 @@ static int serial_imx_resume(struct platform_device *dev)
1302} 1302}
1303 1303
1304#ifdef CONFIG_OF 1304#ifdef CONFIG_OF
1305/*
1306 * This function returns 1 iff pdev isn't a device instatiated by dt, 0 iff it
1307 * could successfully get all information from dt or a negative errno.
1308 */
1305static int serial_imx_probe_dt(struct imx_port *sport, 1309static int serial_imx_probe_dt(struct imx_port *sport,
1306 struct platform_device *pdev) 1310 struct platform_device *pdev)
1307{ 1311{
@@ -1311,7 +1315,8 @@ static int serial_imx_probe_dt(struct imx_port *sport,
1311 int ret; 1315 int ret;
1312 1316
1313 if (!np) 1317 if (!np)
1314 return -ENODEV; 1318 /* no device tree device */
1319 return 1;
1315 1320
1316 ret = of_alias_get_id(np, "serial"); 1321 ret = of_alias_get_id(np, "serial");
1317 if (ret < 0) { 1322 if (ret < 0) {
@@ -1334,7 +1339,7 @@ static int serial_imx_probe_dt(struct imx_port *sport,
1334static inline int serial_imx_probe_dt(struct imx_port *sport, 1339static inline int serial_imx_probe_dt(struct imx_port *sport,
1335 struct platform_device *pdev) 1340 struct platform_device *pdev)
1336{ 1341{
1337 return -ENODEV; 1342 return 1;
1338} 1343}
1339#endif 1344#endif
1340 1345
@@ -1369,8 +1374,10 @@ static int serial_imx_probe(struct platform_device *pdev)
1369 return -ENOMEM; 1374 return -ENOMEM;
1370 1375
1371 ret = serial_imx_probe_dt(sport, pdev); 1376 ret = serial_imx_probe_dt(sport, pdev);
1372 if (ret == -ENODEV) 1377 if (ret > 0)
1373 serial_imx_probe_pdata(sport, pdev); 1378 serial_imx_probe_pdata(sport, pdev);
1379 else if (ret < 0)
1380 goto free;
1374 1381
1375 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1382 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1376 if (!res) { 1383 if (!res) {