nvmem: rockchip-efuse: Make use of of_device_get_match_data()
authorAndrey Smirnov <andrew.smirnov@gmail.com>
Fri, 9 Mar 2018 14:47:11 +0000 (14:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Mar 2018 18:28:14 +0000 (19:28 +0100)
Simplify code a bit by using of_device_get_match_data() instead of
of_match_device().

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Carlo Caione <carlo@caione.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: cphealy@gmail.com
Cc: linux-kernel@vger.kernel.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-amlogic@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvmem/rockchip-efuse.c

index fec6e4c..ade8848 100644 (file)
@@ -259,11 +259,11 @@ static int rockchip_efuse_probe(struct platform_device *pdev)
        struct resource *res;
        struct nvmem_device *nvmem;
        struct rockchip_efuse_chip *efuse;
-       const struct of_device_id *match;
+       const void *data;
        struct device *dev = &pdev->dev;
 
-       match = of_match_device(dev->driver->of_match_table, dev);
-       if (!match || !match->data) {
+       data = of_device_get_match_data(dev);
+       if (!data) {
                dev_err(dev, "failed to get match data\n");
                return -EINVAL;
        }
@@ -286,7 +286,7 @@ static int rockchip_efuse_probe(struct platform_device *pdev)
        if (of_property_read_u32(dev->of_node, "rockchip,efuse-size",
                                 &econfig.size))
                econfig.size = resource_size(res);
-       econfig.reg_read = match->data;
+       econfig.reg_read = data;
        econfig.priv = efuse;
        econfig.dev = efuse->dev;
        nvmem = devm_nvmem_register(dev, &econfig);