summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/qxl/qxl_drv.c
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <krisman@collabora.co.uk>2017-01-27 04:05:48 +0300
committerGerd Hoffmann <kraxel@redhat.com>2017-02-02 12:02:37 +0300
commitcbdded7f8a633ee9418047c50a7114ce2282b912 (patch)
treea9192b0b9f595c0dbab7799865c536ba34286159 /drivers/gpu/drm/qxl/qxl_drv.c
parentd74d74aeaf0b29a158bc95c63c6b6b107a57f4f5 (diff)
downloadlinux-cbdded7f8a633ee9418047c50a7114ce2282b912.tar.xz
drm: qxl: Embed drm_device into driver structure
This is the recommended way to create the drm_device structure, according to DRM documentation. Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/20170127010548.27970-4-krisman@collabora.co.uk Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/qxl/qxl_drv.c')
-rw-r--r--drivers/gpu/drm/qxl/qxl_drv.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index 6e0f8a2d8ac9..8e17c241e63c 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -62,7 +62,6 @@ static struct pci_driver qxl_pci_driver;
static int
qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- struct drm_device *drm;
struct qxl_device *qdev;
int ret;
@@ -72,29 +71,19 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return -EINVAL; /* TODO: ENODEV ? */
}
- drm = drm_dev_alloc(&qxl_driver, &pdev->dev);
- if (IS_ERR(drm))
- return -ENOMEM;
-
qdev = kzalloc(sizeof(struct qxl_device), GFP_KERNEL);
- if (!qdev) {
- ret = -ENOMEM;
- goto free_drm_device;
- }
+ if (!qdev)
+ return -ENOMEM;
ret = pci_enable_device(pdev);
if (ret)
- goto free_drm_device;
-
- drm->pdev = pdev;
- pci_set_drvdata(pdev, drm);
- drm->dev_private = qdev;
+ goto free_dev;
- ret = qxl_device_init(qdev, drm, pdev, ent->driver_data);
+ ret = qxl_device_init(qdev, &qxl_driver, pdev, ent->driver_data);
if (ret)
goto disable_pci;
- ret = drm_vblank_init(drm, 1);
+ ret = drm_vblank_init(&qdev->ddev, 1);
if (ret)
goto unload;
@@ -102,10 +91,10 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ret)
goto vblank_cleanup;
- drm_kms_helper_poll_init(qdev->ddev);
+ drm_kms_helper_poll_init(&qdev->ddev);
/* Complete initialization. */
- ret = drm_dev_register(drm, ent->driver_data);
+ ret = drm_dev_register(&qdev->ddev, ent->driver_data);
if (ret)
goto modeset_cleanup;
@@ -114,14 +103,13 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
modeset_cleanup:
qxl_modeset_fini(qdev);
vblank_cleanup:
- drm_vblank_cleanup(drm);
+ drm_vblank_cleanup(&qdev->ddev);
unload:
qxl_device_fini(qdev);
disable_pci:
pci_disable_device(pdev);
-free_drm_device:
+free_dev:
kfree(qdev);
- kfree(drm);
return ret;
}