drm: Simplify GETRESOURCES ioctl
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 11 Dec 2016 19:20:19 +0000 (20:20 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 12 Dec 2016 09:24:07 +0000 (10:24 +0100)
commit697cc9c8a2c39a42188840e35e212230a240f9e4
tree6dec27085029646b552e7ee03f61864ab71be126
parent122020af856181c24fe45903e43e3cc987c175f7
drm: Simplify GETRESOURCES ioctl

Looping twice when we can do it once is silly. Also use a consistent
style. Note that there's a good race with the connector list walking,
since that is no longer protected by mode_config.mutex. But that's for
a later patch to fix.

v2: Actually try to not blow up, somehow I lost the hunk that checks
we don't copy too much. Noticed by Chris.

v3:
- squash all drm_mode_getresources cleanups into one
- use consistent style for walking objects (Chris)

v4:
- Use u64_to_user_ptr (Chris)
- Don't forget to copy the last connector (Chris)

v5: Chris was right ...

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161211192019.29603-1-daniel.vetter@ffwll.ch
drivers/gpu/drm/drm_mode_config.c