On Wed, Oct 25, 2017 at 04:02:26PM -0700, Deepak Sharma wrote: > From: Deepak Sharma <deepak.sharma@xxxxxxx> > > Modify vgem_init to take platform dev as parent in drm_dev_init. > This will make drm device available at "/sys/devices/platform/vgem" > in x86 chromebook. > > Signed-off-by: Deepak Sharma <deepak.sharma@xxxxxxx> Reviewed-by: Sean Paul <seanpaul@xxxxxxxxxxxx> > --- > drivers/gpu/drm/vgem/vgem_drv.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c > index c938af8c40cf..17e2eafc62b8 100644 > --- a/drivers/gpu/drm/vgem/vgem_drv.c > +++ b/drivers/gpu/drm/vgem/vgem_drv.c > @@ -471,31 +471,30 @@ static int __init vgem_init(void) > if (!vgem_device) > return -ENOMEM; > > - ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL); > - if (ret) > - goto out_free; > - > vgem_device->platform = > platform_device_register_simple("vgem", -1, NULL, 0); > if (IS_ERR(vgem_device->platform)) { > ret = PTR_ERR(vgem_device->platform); > - goto out_fini; > + goto out_free; > } > > dma_coerce_mask_and_coherent(&vgem_device->platform->dev, > DMA_BIT_MASK(64)); > + ret = drm_dev_init(&vgem_device->drm, &vgem_driver, &vgem_device->platform->dev); > + if (ret) > + goto out_unregister; > > /* Final step: expose the device/driver to userspace */ > ret = drm_dev_register(&vgem_device->drm, 0); > if (ret) > - goto out_unregister; > + goto out_fini; > > return 0; > > -out_unregister: > - platform_device_unregister(vgem_device->platform); > out_fini: > drm_dev_fini(&vgem_device->drm); > +out_unregister: > + platform_device_unregister(vgem_device->platform); > out_free: > kfree(vgem_device); > return ret; > -- > 2.14.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel