Skip to content

DRM device-alloc cleanup

David Herrmann dri-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5drm: add drm_dev_alloc() helperdrivers/gpu/drm/drm_pci.c drivers/gpu/drm/drm_platform.c drivers/gpu/drm/drm_stub.c +2 more+80 -570 replies
2/5drm: merge device setup into drm_dev_register()drivers/gpu/drm/drm_pci.c drivers/gpu/drm/drm_platform.c drivers/gpu/drm/drm_stub.c +2 more+96 -1673 replies
3/5drm: move drm_lastclose() to drm_fops.cdrivers/gpu/drm/drm_drv.c drivers/gpu/drm/drm_fops.c+70 -700 replies
4/5drm: introduce drm_dev_free() to fix error pathsdrivers/gpu/drm/drm_pci.c drivers/gpu/drm/drm_platform.c drivers/gpu/drm/drm_stub.c +2 more+29 -130 replies
5/5drm: move device unregistration into drm_dev_unregister()drivers/gpu/drm/drm_stub.c include/drm/drmP.h+37 -251 reply

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchDaniel Vetter
1/5
2/5
3/5
4/5
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/5] DRM device-alloc cleanup

Hi

This cleans up the bus drivers in DRM. Instead of copying the device alloc/free semantics into each bus driver (drm_{pci,platform,usb}.c) we now have a central place in drm_stub.c.

This introduces drm_dev_{alloc,free,register,unregister}(). They have the same semantics as most other kernel subsystems. *_alloc() allocates a new device and populates the static fields and sub-objects. *_free() frees an unregistered object allocated via *_alloc(). *_register() registers a DRM device and *_unregister() obviously unregisters a DRM device. A *_free() is still needed after calling *_unregister() (same as for "struct device"). No ref-counting is added as it is not required by any driver.

Note that the bus drivers are modified to use the new helpers directly. However, I didn't modify the drivers to use *_unregister() and *_free() directly. Instead, the drm_put_dev() helper was modified to use these. Reason for that is that I have pending patches to make device hotplugging safer regarding mmaps. But these aren't ready, yet. Hopefully I can get them ready for rc5 or rc6.

Tested on nouveau.

David

David Herrmann (5):
drm: add drm_dev_alloc() helper
drm: merge device setup into drm_dev_register()
drm: move drm_lastclose() to drm_fops.c
drm: introduce drm_dev_free() to fix error paths
drm: move device unregistration into drm_dev_unregister()

 drivers/gpu/drm/drm_drv.c      |  70 ----------
 drivers/gpu/drm/drm_fops.c     |  70 ++++++++++
 drivers/gpu/drm/drm_pci.c      |  62 ++-------
 drivers/gpu/drm/drm_platform.c |  59 +-------
 drivers/gpu/drm/drm_stub.c     | 310 ++++++++++++++++++++++++++++-------------
 drivers/gpu/drm/drm_usb.c      |  57 +-------
 include/drm/drmP.h             |   8 +-
 7 files changed, 308 insertions(+), 328 deletions(-)
Signature · 1 line
1.8.4