]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm: pl111: Simplify vexpress init
authorRob Herring <robh@kernel.org>
Thu, 2 Apr 2020 17:34:25 +0000 (11:34 -0600)
committerRob Herring <robh@kernel.org>
Tue, 28 Apr 2020 19:06:20 +0000 (14:06 -0500)
The init VExpress variants currently instantiates a 'muxfpga' driver for
the sole purpose of getting a regmap for it. There's no reason to
instantiate a driver and doing so just complicates things. The muxfpga
driver also isn't unregistered properly on module unload. Let's
just simplify all this this by just calling
devm_regmap_init_vexpress_config() directly.

Cc: Eric Anholt <eric@anholt.net>
Cc: dri-devel@lists.freedesktop.org
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200409013947.12667-3-robh@kernel.org
drivers/gpu/drm/pl111/pl111_versatile.c
drivers/gpu/drm/pl111/pl111_vexpress.c
drivers/gpu/drm/pl111/pl111_vexpress.h

index 4f325c410b5d1cab92f155f173ce2b5f2fc51d7a..f891f9bf3a93bfa1973ee6ca2363d7216979ff82 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/regmap.h>
+#include <linux/vexpress.h>
 
 #include "pl111_versatile.h"
 #include "pl111_vexpress.h"
@@ -391,17 +392,8 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv)
        }
 
        /* Versatile Express special handling */
-       if (versatile_clcd_type == VEXPRESS_CLCD_V2M) {
+       if (IS_ENABLED(CONFIG_VEXPRESS_CONFIG) && versatile_clcd_type == VEXPRESS_CLCD_V2M) {
                struct platform_device *pdev;
-
-               /* Registers a driver for the muxfpga */
-               ret = vexpress_muxfpga_init();
-               if (ret) {
-                       dev_err(dev, "unable to initialize muxfpga driver\n");
-                       of_node_put(np);
-                       return ret;
-               }
-
                /* Call into deep Vexpress configuration API */
                pdev = of_find_device_by_node(np);
                if (!pdev) {
@@ -409,13 +401,8 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv)
                        of_node_put(np);
                        return -EPROBE_DEFER;
                }
-               map = dev_get_drvdata(&pdev->dev);
-               if (!map) {
-                       dev_err(dev, "sysreg has not yet probed\n");
-                       platform_device_put(pdev);
-                       of_node_put(np);
-                       return -EPROBE_DEFER;
-               }
+               map = devm_regmap_init_vexpress_config(&pdev->dev);
+               platform_device_put(pdev);
        } else {
                map = syscon_node_to_regmap(np);
        }
index 350570fe06b5f39664d8fd38c9f37e1fac051b3e..37ed3f1da8200656b5beeaa99dcd808436ad653e 100644 (file)
@@ -94,45 +94,3 @@ int pl111_vexpress_clcd_init(struct device *dev,
 
        return 0;
 }
-
-/*
- * This sets up the regmap pointer that will then be retrieved by
- * the detection code in pl111_versatile.c and passed in to the
- * pl111_vexpress_clcd_init() function above.
- */
-static int vexpress_muxfpga_probe(struct platform_device *pdev)
-{
-       struct device *dev = &pdev->dev;
-       struct regmap *map;
-
-       map = devm_regmap_init_vexpress_config(&pdev->dev);
-       if (IS_ERR(map))
-               return PTR_ERR(map);
-       dev_set_drvdata(dev, map);
-
-       return 0;
-}
-
-static const struct of_device_id vexpress_muxfpga_match[] = {
-       { .compatible = "arm,vexpress-muxfpga", },
-       {}
-};
-
-static struct platform_driver vexpress_muxfpga_driver = {
-       .driver = {
-               .name = "vexpress-muxfpga",
-               .of_match_table = of_match_ptr(vexpress_muxfpga_match),
-       },
-       .probe = vexpress_muxfpga_probe,
-};
-
-int vexpress_muxfpga_init(void)
-{
-       int ret;
-
-       ret = platform_driver_register(&vexpress_muxfpga_driver);
-       /* -EBUSY just means this driver is already registered */
-       if (ret == -EBUSY)
-               ret = 0;
-       return ret;
-}
index 5d3681bb4c002395dc5ee8c5736099fe97824536..bb54864ca91eead810a87c0f286db2d127c54973 100644 (file)
@@ -10,8 +10,6 @@ int pl111_vexpress_clcd_init(struct device *dev,
                             struct pl111_drm_dev_private *priv,
                             struct regmap *map);
 
-int vexpress_muxfpga_init(void);
-
 #else
 
 static inline int pl111_vexpress_clcd_init(struct device *dev,
@@ -21,9 +19,4 @@ static inline int pl111_vexpress_clcd_init(struct device *dev,
        return -ENODEV;
 }
 
-static inline int vexpress_muxfpga_init(void)
-{
-       return 0;
-}
-
 #endif