summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_platform.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-09-14 10:14:38 (GMT)
committerDave Airlie <airlied@redhat.com>2010-09-14 10:39:04 (GMT)
commitb64c115eb22516ecd187c74ad6de3f1693f1dc7b (patch)
tree9f80fe97b68f33d6c40f82e29bd271a0613aa9dd /drivers/gpu/drm/drm_platform.c
parent930a9e283516a3a3595c0c515113f1b78d07f695 (diff)
downloadlinux-b64c115eb22516ecd187c74ad6de3f1693f1dc7b.tar.xz
drm: fix race between driver loading and userspace open.
Not 100% sure this is due to BKL removal, its most likely a combination of that + userspace timing changes in udev/plymouth. The drm adds the sysfs device before the driver has completed internal loading, this causes udev to make the node and plymouth to open it before we've completed loading. The proper solution is to delay the sysfs manipulation until later in loading however this causes knock on issues with sysfs connector nodes, so we can use the global mutex to serialise loading and userspace opens. Reported-by: Toni Spets (hifi on #radeon) Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_platform.c')
-rw-r--r--drivers/gpu/drm/drm_platform.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index 460e9a3..92d1d0f 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -53,6 +53,8 @@ int drm_get_platform_dev(struct platform_device *platdev,
dev->platformdev = platdev;
dev->dev = &platdev->dev;
+ mutex_lock(&drm_global_mutex);
+
ret = drm_fill_in_dev(dev, NULL, driver);
if (ret) {
@@ -87,6 +89,8 @@ int drm_get_platform_dev(struct platform_device *platdev,
list_add_tail(&dev->driver_item, &driver->device_list);
+ mutex_unlock(&drm_global_mutex);
+
DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
driver->name, driver->major, driver->minor, driver->patchlevel,
driver->date, dev->primary->index);
@@ -100,6 +104,7 @@ err_g2:
drm_put_minor(&dev->control);
err_g1:
kfree(dev);
+ mutex_unlock(&drm_global_mutex);
return ret;
}
EXPORT_SYMBOL(drm_get_platform_dev);