Skip to content

Commit 0a4587a

Browse files
author
Linus Walleij
committed
drm/pl111: Fix module probe bug
Commit a30933c27602 ("drm/pl111: Support the Versatile Express") Added a second module using the builtin_platform_driver() call, which works fine as long as you do not try to build the PL111 driver as a module, because a module can only have one initcall and cause the following build bug: (...) multiple definition of `init_module' (...) Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Pawel Moll <pawel.moll@arm.com> Cc: Eric Anholt <eric@anholt.net> Cc: Robin Murphy <robin.murphy@arm.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Fixes: a30933c27602 ("drm/pl111: Support the Versatile Express") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20180503140431.5798-1-linus.walleij@linaro.org
1 parent 0d49f30 commit 0a4587a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

drivers/gpu/drm/pl111/pl111_versatile.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv)
326326
if (versatile_clcd_type == VEXPRESS_CLCD_V2M) {
327327
struct platform_device *pdev;
328328

329+
/* Registers a driver for the muxfpga */
330+
ret = vexpress_muxfpga_init();
331+
if (ret) {
332+
dev_err(dev, "unable to initialize muxfpga driver\n");
333+
return ret;
334+
}
335+
329336
/* Call into deep Vexpress configuration API */
330337
pdev = of_find_device_by_node(np);
331338
if (!pdev) {

drivers/gpu/drm/pl111/pl111_vexpress.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,13 @@ static struct platform_driver vexpress_muxfpga_driver = {
122122
.probe = vexpress_muxfpga_probe,
123123
};
124124

125-
builtin_platform_driver(vexpress_muxfpga_driver);
125+
int vexpress_muxfpga_init(void)
126+
{
127+
int ret;
128+
129+
ret = platform_driver_register(&vexpress_muxfpga_driver);
130+
/* -EBUSY just means this driver is already registered */
131+
if (ret == -EBUSY)
132+
ret = 0;
133+
return ret;
134+
}

drivers/gpu/drm/pl111/pl111_vexpress.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ 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+
1315
#else
1416

1517
static inline int pl111_vexpress_clcd_init(struct device *dev,
@@ -19,4 +21,9 @@ static inline int pl111_vexpress_clcd_init(struct device *dev,
1921
return -ENODEV;
2022
}
2123

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

0 commit comments

Comments
 (0)