i2c: sh_mobile: move type detection upwards
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Mon, 18 Dec 2017 21:57:56 +0000 (22:57 +0100)
committerWolfram Sang <wsa@the-dreams.de>
Mon, 15 Jan 2018 16:58:39 +0000 (17:58 +0100)
For refactoring reasons, we will need this information before the setup
callback. Also, simplify the comment to a oneliner.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-sh_mobile.c

index b01607b4fce2b82b674cf0fcc96bc64f20c35a80..1ac896e46b390c4b5329007c78c2052aaf719aae 100644 (file)
@@ -873,6 +873,10 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
        pd->bus_speed = ret ? STANDARD_MODE : bus_speed;
        pd->clks_per_count = 1;
 
+       /* Newer variants come with two new bits in ICIC */
+       if (resource_size(res) > 0x17)
+               pd->flags |= IIC_FLAG_HAS_ICIC67;
+
        config = of_device_get_match_data(&dev->dev);
        if (config) {
                pd->clks_per_count = config->clks_per_count;
@@ -881,12 +885,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
                        config->setup(pd);
        }
 
-       /* The IIC blocks on SH-Mobile ARM processors
-        * come with two new bits in ICIC.
-        */
-       if (resource_size(res) > 0x17)
-               pd->flags |= IIC_FLAG_HAS_ICIC67;
-
        ret = sh_mobile_i2c_init(pd);
        if (ret)
                return ret;