[PATCH] drm/sysfs: fix hotplug regression since lifetime changes
David Herrmann
dh.herrmann at gmail.com
Thu Nov 21 01:49:24 PST 2013
Hi
On Thu, Nov 21, 2013 at 10:25 AM, Dave Airlie <airlied at gmail.com> wrote:
> On Thu, Nov 21, 2013 at 7:22 PM, Daniel Vetter <daniel at ffwll.ch> wrote:
>> On Thu, Nov 21, 2013 at 11:51:04AM +1000, Dave Airlie wrote:
>>> 5bdebb183c9702a8c57a01dff09337be3de337a6 changed the lifetimes, but it
>>> also meant we no longer set the device_type field properly, so the
>>> hotplug events in userspace weren't fully formed enough for drivers to care.
>>>
>>> Reported-by: Jesse Barnes <jbarnes at virtuosugeek.org>
>>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>>> ---
>>> drivers/gpu/drm/drm_sysfs.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
>>> index 1a35ea5..c6a3902 100644
>>> --- a/drivers/gpu/drm/drm_sysfs.c
>>> +++ b/drivers/gpu/drm/drm_sysfs.c
>>> @@ -516,6 +516,7 @@ int drm_sysfs_device_add(struct drm_minor *minor)
>>> DRM_ERROR("device create failed %ld\n", PTR_ERR(minor->kdev));
>>> return PTR_ERR(minor->kdev);
>>> }
>>> + minor->kdev->type = &drm_sysfs_device_minor;
>>
>> Isn't this one of the sysfs races Greg is fighting against? At least from
>> a cursor read through the driver core it looks like we'd better set the
>> dev->type before we set it up with device_create().
>
> Possibly but how can we do that? since minor->kdev is something we
> just created 2 lines earlier
> unless there is another create function I should be calling, I don't
> see a device_create_with_type.
See device_create_groups_vargs() in drivers/base/core.c. Just copy the
code from it and do device initialization yourself. device_create() is
only a wrapper around kzalloc()+device_register() anyway.
Thanks
David
>> Cc'ing Greg for insight.
>>
>> Aside: I wonder whether we could get rid of our drm_minor type and use it
>> for something more useful like the render node vs legacy node split ...
>
> Its ABI now. all the userspace drivers need it in the uevents for
> hotplug to keep working.
>
> Dave.
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
More information about the dri-devel
mailing list