[PATCH 0/5] drm/gma500: Managed cleanup

Thomas Zimmermann tzimmermann at suse.de
Mon Sep 20 14:10:46 UTC 2021


Switch gma500 to managed cleanup and remove the manual cleanup
code from the driver's PCI callbacks.

Managed cleanup involves embedding the DRM device structure in the
driver's structure. In preparation, patch 1 replaces references all
references to dev_private with a helper function.

Patch 2 adds managed cleanup for pci_enable_device().

Patches 3 and 4 embed struct drm_device in struct_drm_psb_private. The
structure's memory is being automatically released.

Patch 5 adds managed cleanup for the device resources. Instead of
calling the large, monolithic function psb_driver_unload(), the release
code could be split up split into smaller helpers and reuse exising
functionality from devres.

Future work: for a number of drivers, the PCI remove callback contains
only a single call to drm_device_unregister(). In a later patchset,
this could be implemented as another shared helper within DRM.

Tested on Atom N2800 hardware.

Thomas Zimmermann (5):
  drm/gma500: Replace references to dev_private with helper function
  drm/gma500: Disable PCI device during shutdown
  drm/gma500: Embed struct drm_device in struct drm_psb_private
  drm/gma500: Remove dev_priv branch from unload function
  drm/gma500: Managed device release

 drivers/gpu/drm/gma500/backlight.c         |  12 +-
 drivers/gpu/drm/gma500/cdv_device.c        |  24 ++--
 drivers/gpu/drm/gma500/cdv_intel_display.c |  10 +-
 drivers/gpu/drm/gma500/cdv_intel_dp.c      |  12 +-
 drivers/gpu/drm/gma500/cdv_intel_lvds.c    |  22 +--
 drivers/gpu/drm/gma500/framebuffer.c       |  16 +--
 drivers/gpu/drm/gma500/gem.c               |   2 +-
 drivers/gpu/drm/gma500/gma_device.c        |   2 +-
 drivers/gpu/drm/gma500/gma_display.c       |  14 +-
 drivers/gpu/drm/gma500/gtt.c               |  18 +--
 drivers/gpu/drm/gma500/intel_bios.c        |  10 +-
 drivers/gpu/drm/gma500/intel_gmbus.c       |  12 +-
 drivers/gpu/drm/gma500/mid_bios.c          |  11 +-
 drivers/gpu/drm/gma500/mmu.c               |  12 +-
 drivers/gpu/drm/gma500/oaktrail_crtc.c     |   8 +-
 drivers/gpu/drm/gma500/oaktrail_device.c   |  20 +--
 drivers/gpu/drm/gma500/oaktrail_hdmi.c     |  18 +--
 drivers/gpu/drm/gma500/oaktrail_lvds.c     |  14 +-
 drivers/gpu/drm/gma500/oaktrail_lvds_i2c.c |   2 +-
 drivers/gpu/drm/gma500/opregion.c          |  14 +-
 drivers/gpu/drm/gma500/power.c             |  20 +--
 drivers/gpu/drm/gma500/psb_device.c        |  16 +--
 drivers/gpu/drm/gma500/psb_drv.c           | 147 ++++++++++-----------
 drivers/gpu/drm/gma500/psb_drv.h           |  24 ++--
 drivers/gpu/drm/gma500/psb_intel_display.c |  10 +-
 drivers/gpu/drm/gma500/psb_intel_lvds.c    |  31 ++---
 drivers/gpu/drm/gma500/psb_intel_sdvo.c    |  10 +-
 drivers/gpu/drm/gma500/psb_irq.c           |  26 ++--
 drivers/gpu/drm/gma500/psb_lid.c           |   2 +-
 29 files changed, 261 insertions(+), 278 deletions(-)

--
2.33.0



More information about the dri-devel mailing list