Commit d5c04dff authored by Deepak Sharma's avatar Deepak Sharma Committed by Emil Velikov

drm/vgem: Fix vgem_init to get drm device available.

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.

v2: rebase, address checkpatch typo and line over 80 characters

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDeepak Sharma <deepak.sharma@amd.com>
Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarEmil Velikov <emil.velikov@collabora.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181023163550.15211-1-emil.l.velikov@gmail.com
parent 99fe21a7
...@@ -471,31 +471,31 @@ static int __init vgem_init(void) ...@@ -471,31 +471,31 @@ static int __init vgem_init(void)
if (!vgem_device) if (!vgem_device)
return -ENOMEM; return -ENOMEM;
ret = drm_dev_init(&vgem_device->drm, &vgem_driver, NULL);
if (ret)
goto out_free;
vgem_device->platform = vgem_device->platform =
platform_device_register_simple("vgem", -1, NULL, 0); platform_device_register_simple("vgem", -1, NULL, 0);
if (IS_ERR(vgem_device->platform)) { if (IS_ERR(vgem_device->platform)) {
ret = PTR_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_coerce_mask_and_coherent(&vgem_device->platform->dev,
DMA_BIT_MASK(64)); 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 */ /* Final step: expose the device/driver to userspace */
ret = drm_dev_register(&vgem_device->drm, 0); ret = drm_dev_register(&vgem_device->drm, 0);
if (ret) if (ret)
goto out_unregister; goto out_fini;
return 0; return 0;
out_unregister:
platform_device_unregister(vgem_device->platform);
out_fini: out_fini:
drm_dev_fini(&vgem_device->drm); drm_dev_fini(&vgem_device->drm);
out_unregister:
platform_device_unregister(vgem_device->platform);
out_free: out_free:
kfree(vgem_device); kfree(vgem_device);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment