Skip to content

Commit cbcab50

Browse files
committed
drm: pl111: Simplify vexpress init
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 <[email protected]> Cc: [email protected] Acked-by: Sam Ravnborg <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Rob Herring <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 66ddc1e commit cbcab50

File tree

3 files changed

+4
-66
lines changed

3 files changed

+4
-66
lines changed

drivers/gpu/drm/pl111/pl111_versatile.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/of.h>
99
#include <linux/of_platform.h>
1010
#include <linux/regmap.h>
11+
#include <linux/vexpress.h>
1112

1213
#include "pl111_versatile.h"
1314
#include "pl111_vexpress.h"
@@ -391,31 +392,17 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv)
391392
}
392393

393394
/* Versatile Express special handling */
394-
if (versatile_clcd_type == VEXPRESS_CLCD_V2M) {
395+
if (IS_ENABLED(CONFIG_VEXPRESS_CONFIG) && versatile_clcd_type == VEXPRESS_CLCD_V2M) {
395396
struct platform_device *pdev;
396-
397-
/* Registers a driver for the muxfpga */
398-
ret = vexpress_muxfpga_init();
399-
if (ret) {
400-
dev_err(dev, "unable to initialize muxfpga driver\n");
401-
of_node_put(np);
402-
return ret;
403-
}
404-
405397
/* Call into deep Vexpress configuration API */
406398
pdev = of_find_device_by_node(np);
407399
if (!pdev) {
408400
dev_err(dev, "can't find the sysreg device, deferring\n");
409401
of_node_put(np);
410402
return -EPROBE_DEFER;
411403
}
412-
map = dev_get_drvdata(&pdev->dev);
413-
if (!map) {
414-
dev_err(dev, "sysreg has not yet probed\n");
415-
platform_device_put(pdev);
416-
of_node_put(np);
417-
return -EPROBE_DEFER;
418-
}
404+
map = devm_regmap_init_vexpress_config(&pdev->dev);
405+
platform_device_put(pdev);
419406
} else {
420407
map = syscon_node_to_regmap(np);
421408
}

drivers/gpu/drm/pl111/pl111_vexpress.c

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -94,45 +94,3 @@ int pl111_vexpress_clcd_init(struct device *dev,
9494

9595
return 0;
9696
}
97-
98-
/*
99-
* This sets up the regmap pointer that will then be retrieved by
100-
* the detection code in pl111_versatile.c and passed in to the
101-
* pl111_vexpress_clcd_init() function above.
102-
*/
103-
static int vexpress_muxfpga_probe(struct platform_device *pdev)
104-
{
105-
struct device *dev = &pdev->dev;
106-
struct regmap *map;
107-
108-
map = devm_regmap_init_vexpress_config(&pdev->dev);
109-
if (IS_ERR(map))
110-
return PTR_ERR(map);
111-
dev_set_drvdata(dev, map);
112-
113-
return 0;
114-
}
115-
116-
static const struct of_device_id vexpress_muxfpga_match[] = {
117-
{ .compatible = "arm,vexpress-muxfpga", },
118-
{}
119-
};
120-
121-
static struct platform_driver vexpress_muxfpga_driver = {
122-
.driver = {
123-
.name = "vexpress-muxfpga",
124-
.of_match_table = of_match_ptr(vexpress_muxfpga_match),
125-
},
126-
.probe = vexpress_muxfpga_probe,
127-
};
128-
129-
int vexpress_muxfpga_init(void)
130-
{
131-
int ret;
132-
133-
ret = platform_driver_register(&vexpress_muxfpga_driver);
134-
/* -EBUSY just means this driver is already registered */
135-
if (ret == -EBUSY)
136-
ret = 0;
137-
return ret;
138-
}

drivers/gpu/drm/pl111/pl111_vexpress.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ int pl111_vexpress_clcd_init(struct device *dev,
1010
struct pl111_drm_dev_private *priv,
1111
struct regmap *map);
1212

13-
int vexpress_muxfpga_init(void);
14-
1513
#else
1614

1715
static inline int pl111_vexpress_clcd_init(struct device *dev,
@@ -21,9 +19,4 @@ static inline int pl111_vexpress_clcd_init(struct device *dev,
2119
return -ENODEV;
2220
}
2321

24-
static inline int vexpress_muxfpga_init(void)
25-
{
26-
return 0;
27-
}
28-
2922
#endif

0 commit comments

Comments
 (0)