Re: [PATCH 2/2] drm: omapdrm: Perform initialization/cleanup at probe/remove time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. The kerneldoc for drm_dev_init even bothers to explain this
all!
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux