[PATCH 2/2] drm: omapdrm: Perform initialization/cleanup at probe/remove time
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue Dec 13 22:31:31 UTC 2016
Hi Daniel,
On Tuesday 13 Dec 2016 22:48:50 Daniel Vetter wrote:
> On Tue, Dec 13, 2016 at 11:41:09PM +0200, Laurent Pinchart wrote:
> > On Tuesday 13 Dec 2016 22:21:10 Daniel Vetter wrote:
> >> On Tue, Dec 13, 2016 at 05:21:43PM +0200, Laurent Pinchart wrote:
> >>> +
> >>> + /* Allocate and initialize the DRM device. */
> >>> + ddev = drm_dev_alloc(&omap_drm_driver, &pdev->dev);
> >>
> >> Since this is a driver you work on, embedding is recommended, see
> >> drm_dev_init(). Looks soo much better.
> >
> > How does that work with drm_dev_unref() then ? When the last reference
> > goes away drm_dev_release() will kfree() the drm_device instance, which is
> > only valid if I allocate it dynamically.
>
> This is drm, we only solve shit half-assed until we realize how silly
> we've been. Meanwhile just place the drm_device as the first thing in your
> driver struct.
I think I'll skip it for now, and revisit that when the drm_device ->release()
operation lands.
> The kerneldoc for drm_dev_init even bothers to explain this all!
Not in Dave's drm-next, only in an obscure tree that hardly anyone knows about
;-)
--
Regards,
Laurent Pinchart
More information about the dri-devel
mailing list