/* ---------------------------------------------------------------------- */
-static int bochs_mm_init(struct bochs_device *bochs)
-{
- struct drm_vram_mm *vmm;
-
- vmm = drm_vram_helper_alloc_mm(bochs->dev, bochs->fb_base,
- bochs->fb_size);
- return PTR_ERR_OR_ZERO(vmm);
-}
-
-static void bochs_mm_fini(struct bochs_device *bochs)
-{
- if (!bochs->dev->vram_mm)
- return;
-
- drm_vram_helper_release_mm(bochs->dev);
-}
-
-/* ---------------------------------------------------------------------- */
-
static const uint32_t bochs_formats[] = {
DRM_FORMAT_XRGB8888,
DRM_FORMAT_BGRX8888,
/* ---------------------------------------------------------------------- */
/* drm interface */
-static void bochs_unload(struct drm_device *dev)
-{
- struct bochs_device *bochs = dev->dev_private;
-
- bochs_mm_fini(bochs);
-}
-
static int bochs_load(struct drm_device *dev)
{
struct bochs_device *bochs;
ret = bochs_hw_init(dev);
if (ret)
- goto err;
+ return ret;
- ret = bochs_mm_init(bochs);
+ ret = drmm_vram_helper_init(dev, bochs->fb_base, bochs->fb_size);
if (ret)
- goto err;
+ return ret;
ret = bochs_kms_init(bochs);
if (ret)
- goto err;
+ return ret;
return 0;
-
-err:
- bochs_unload(dev);
- return ret;
}
DEFINE_DRM_GEM_FOPS(bochs_fops);
.major = 1,
.minor = 0,
DRM_GEM_VRAM_DRIVER,
- .release = bochs_unload,
};
/* ---------------------------------------------------------------------- */
ret = drm_dev_register(dev, 0);
if (ret)
- goto err_unload;
+ goto err_free_dev;
drm_fbdev_generic_setup(dev, 32);
return ret;
-err_unload:
- bochs_unload(dev);
err_free_dev:
drm_dev_put(dev);
return ret;