[RFC 1/3] drm: Add a way to iterate over minors

David Herrmann dh.herrmann at gmail.com
Wed Aug 24 10:53:45 UTC 2016


Hey

On Wed, Aug 10, 2016 at 4:34 PM, Daniel Vetter <daniel at ffwll.ch> wrote:
> On Wed, Aug 10, 2016 at 4:27 PM, Noralf Trønnes <noralf at tronnes.org> wrote:
>> Den 10.08.2016 10:43, skrev Daniel Vetter:
>>>
>>> On Tue, Aug 09, 2016 at 07:45:40PM +0200, Noralf Trønnes wrote:
>>>>
>>>> This adds a way for in-kernel users to iterate over the available
>>>> DRM minors. The implementation is oops safe so the panic code
>>>> can safely use it.
>>>>
>>>> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
>>>
>>> Why iterate over minors? I'd kinda have expected we'd iterate over devices
>>> instead ... And looking ahead, that seems to be what you actually want.
>>
>>
>> I did this because I couldn't find a list of drm_devices anywhere. Only
>> minors.
>> But I can do a drm_for_each_device() based on the minor "list".
>
> Hm, the drm drivers are all part of the drm class, we should be able
> to iterate them I think. Otherwise let's just add a new list instead
> of jumping through hoops.
> New list with it's own lock (which we then trylock from the panic
> handler) would be safest I think.

You can use class_for_each_device() (or register a class_interface to
be notified of new entries as well). However, that will iterate all
minors, so you need to filter for the primary one. I think that should
be sufficient, no need for a separate list.

Thanks
David


More information about the dri-devel mailing list