Re: [PATCHv4 1/3] drm/vgem: Add a dummy platform device

From: Chris Wilson
Date: Thu May 04 2017 - 16:23:47 EST

On Thu, May 04, 2017 at 11:45:46AM -0700, Laura Abbott wrote:
> The vgem driver is currently registered independent of any actual
> device. Some usage of the dmabuf APIs require an actual device structure
> to do anything. Register a dummy platform device for use with dmabuf.
> Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Laura Abbott <labbott@xxxxxxxxxx>
> ---
> v4: Switch from the now removed platformdev to a static platform device.

I was thinking of avoiding the static, i.e.

static struct vgem_device {
struct drm_device drm;

struct device *platform;
} *vgem_device;


vgem_device = kzalloc(sizeof(*vgem_device), GFP_KERNEEL);

ret = drm_dev_init(&vgem_device->drm, &vgem_drv, NULL);

vgem_device->platform = platform_device_register_simple("vgem");

And then platform_device_unregister() should be done in a new
vgem_drv.release callback.

I'm not going to insist upon it as I can send a patch to move over to
the "modern" drm_device subclassing later.

Chris Wilson, Intel Open Source Technology Centre