1. 02 Apr, 2020 2 commits
  2. 01 Apr, 2020 8 commits
  3. 31 Mar, 2020 4 commits
  4. 30 Mar, 2020 5 commits
  5. 28 Mar, 2020 12 commits
  6. 27 Mar, 2020 5 commits
  7. 26 Mar, 2020 4 commits
    • Daniel Vetter's avatar
      drm: Add docs for managed resources · 9e1ed9fb
      Daniel Vetter authored
      All collected together to provide a consistent story in one patch,
      instead of the somewhat bumpy refactor-evolution leading to this.
      
      Also some thoughts on what the next steps could be:
      
      - Create a macro called devm_drm_dev_alloc() which essentially wraps
        the kzalloc(); devm_drm_dev_init(); drmm_add_final_kfree() combo.
        Needs to be a macro since we'll have to do some typeof trickery and
        casting to make this fully generic for all drivers that embed struct
        drm_device into their own thing.
      
      - A lot of the simple drivers now have essentially just
        drm_dev_unplug(); drm_atomic_helper_shutdown(); as their
        $bus_driver->remove hook. We could create a devm_mode_config_reset
        which sets drm_atomic_helper_shutdown as it's cleanup action, and a
        devm_drm_dev_register with drm_dev_unplug as it's cleanup action,
        and simple drivers wouldn't have a need for a ->remove function at
        all, and we could delete them.
      
      - For more complicated drivers we need drmm_ versions of a _lot_ more
        things. All the userspace visible objects (crtc, plane, encoder,
        crtc), anything else hanging of those (maybe a drmm_get_edid, at
        least for panels and other built-in stuff).
      
      Also some more thoughts on why we're not reusing devm_ with maybe a
      fake struct device embedded into the drm_device (we can't use the
      kdev, since that's in each drm_minor).
      
      - Code review gets extremely tricky, since every time you see a devm_
        you need to carefully check whether the fake device (with the
        drm_device lifetim) or the real device (with the lifetim of the
        underlying physical device and driver binding) are used. That's not
        going to help at all, and we have enormous amounts of drivers who
        use devm_ where they really shouldn't. Having different types makes
        sure the compiler type checks this for us and ensures correctness.
      
      - The set of functions are very much non-overlapping. E.g.
        devm_ioremap makes total sense, drmm_ioremap has the wrong lifetime,
        since hw resources need to be cleaned out at driver unbind and wont
        outlive that like a drm_device. Similar, but other way round for
        drmm_connector_init (which is the only correct version, devm_ for
        drm_connector is just buggy). Simply not having the wrong version
        again prevents bugs.
      
      Finally I guess this opens a huge todo for all the drivers. I'm
      semi-tempted to do a tree-wide s/devm_kzalloc/drmm_kzalloc/ since most
      likely that'll fix an enormous amount of bugs and most likely not
      cause any issues at all (aside from maybe holding onto memory slightly
      too long).
      
      v2:
      - Doc improvements from Laurent.
      - Also add kerneldoc for the new drmm_add_action_or_reset.
      
      v3:
      - Remove kerneldoc for drmm_remove_action.
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: linux-doc@vger.kernel.org
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      
      fixup docs
      Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-52-daniel.vetter@ffwll.ch
      9e1ed9fb
    • Daniel Vetter's avatar
      drm/udl: drop drm_driver.release hook · b1a981bd
      Daniel Vetter authored
      There's only two functions called from that:
      drm_kms_helper_poll_fini() and udl_free_urb_list(). Both of these are
      also called from the ubs_driver->disconnect hook, so entirely
      pointless to do the same again in the ->release hook.
      
      Furthermore by the time we clean up the drm_driver we really shouldn't
      be touching hardware anymore, so stopping the poll worker and freeing
      the urb allocations in ->disconnect is the right thing to do.
      
      Now disconnect still cleans things up before unregistering the driver,
      but that's a different issue.
      
      v2: Use _fini, not _disable in unplug, motivated by discussions with
      Thomas. _disable/_enable are for suspend/resume.
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Sean Paul <sean@poorly.run>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: Emil Velikov <emil.l.velikov@gmail.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: "Noralf Trønnes" <noralf@tronnes.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-51-daniel.vetter@ffwll.ch
      b1a981bd
    • Daniel Vetter's avatar
      drm/udl: Drop explicit drm_mode_config_cleanup call · fe5b7c86
      Daniel Vetter authored
      It's right above the drm_dev_put().
      
      This allows us to delete a bit of onion unwinding in
      udl_modeset_init().
      
      This is made possible by a preceeding patch which added a drmm_
      cleanup action to drm_mode_config_init(), hence all we need to do to
      ensure that drm_mode_config_cleanup() is run on final drm_device
      cleanup is check the new error code for _init().
      
      v2: Explain why this cleanup is possible (Laurent).
      
      v3: Use drmm_mode_config_init() for more clarity (Sam, Thomas)
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Sean Paul <sean@poorly.run>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: Emil Velikov <emil.l.velikov@gmail.com>
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Cc: "Noralf Trønnes" <noralf@tronnes.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-50-daniel.vetter@ffwll.ch
      fe5b7c86
    • Daniel Vetter's avatar
      drm/mipi-dbi: Drop explicit drm_mode_config_cleanup call · 3421a6c4
      Daniel Vetter authored
      Allows us to drop the drm_driver.release callback from all
      drivers, and remove the mipi_dbi_release() function.
      
      This is made possible by a preceeding patch which added a drmm_
      cleanup action to drm_mode_config_init(), hence all we need to do to
      ensure that drm_mode_config_cleanup() is run on final drm_device
      cleanup is check the new error code for _init().
      
      v2: Explain why this cleanup is possible (Laurent).
      
      v3: Use drmm_mode_config_init() for more clarity (Sam, Thomas)
      
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: Noralf Trønnes <noralf@tronnes.org> (v2)
      Tested-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: David Lechner <david@lechnology.com>
      Cc: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
      Cc: "Noralf Trønnes" <noralf@tronnes.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-49-daniel.vetter@ffwll.ch
      3421a6c4