[PATCH] drm: move debugfs init after dev->load()

Daniel Vetter daniel at ffwll.ch
Fri May 30 03:49:56 PDT 2014


On Fri, May 30, 2014 at 12:46 PM, Daniel Vetter <daniel at ffwll.ch> wrote:
> On Fri, May 30, 2014 at 12:37 AM, Rob Clark <robdclark at gmail.com> wrote:
>> Avoids ugly hacks in drivers debugfs code, if it depends on
>> dev->dev_private having already been initialized.
>>
>> Signed-off-by: Rob Clark <robdclark at gmail.com>
>
> So what I had in mind:
> - stop using drm_platform_init, instead roll your own copy of
> drm_get_platform_dev
> - don't driver->bus, instead use Thierry's set_busid interface
>
> Then as a second step you can stop calling your ->load callback and
> instead insert stuff between drm_dev_alloc and drm_dev_register. We
> have pretty much the same problem with sysfs as with debugfs, so your
> patch here doesn't really solve all that much - ->load should be
> called mostly before drm_dev_register sets up all the userspace
> interfaces.
>
> Long term I want to phase-out ->load except for legacy non-kms drivers.

Also this is debugfs. If someone races debugfs access with driver load
it will blow up pretty much everywhere in drm drivers (because of the
wrong init order). Imo there's absolutely no need for duct-tape like
this, nor for band-aids in drivers. At least in i915 we have 0
dev_priv != NULL checks.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list