spi: s3c64xx: add spi-id property instead of alias
authorJaewon Kim <jaewon02.kim@samsung.com>
Mon, 10 Sep 2018 05:14:34 +0000 (14:14 +0900)
committerChanho Park <chanho61.park@samsung.com>
Mon, 10 Sep 2018 08:02:21 +0000 (17:02 +0900)
This patch adds spi-id DT property for cases where there is no spi alias.

Change-Id: I39f7bfc50f06de3bb4d6642a7ef85a49b59c209e
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
drivers/spi/spi-s3c64xx.c

index ee8fb61..7bc0ef3 100644 (file)
@@ -1160,11 +1160,15 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
        if (pdev->dev.of_node) {
                ret = of_alias_get_id(pdev->dev.of_node, "spi");
                if (ret < 0) {
-                       dev_err(&pdev->dev, "failed to get alias id, errno %d\n",
-                               ret);
-                       goto err0;
+                       if (of_property_read_u32(pdev->dev.of_node,
+                                               "spi-id", &sdd->port_id)) {
+                               dev_err(&pdev->dev,
+                                       "failed to get alias id,%d\n", ret);
+                               goto err0;
+                       };
+               } else {
+                       sdd->port_id = ret;
                }
-               sdd->port_id = ret;
        } else {
                sdd->port_id = pdev->id;
        }