diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2019-11-13 16:58:56 +0100 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2019-11-14 13:54:30 +0100 |
commit | ecd4b234e250939eafa17846f29f77a1b6f5a247 (patch) | |
tree | e3b8810ffab9bd179931e7abc246cacdafefe55b | |
parent | 3bf149bd3fe12abc358386862bc1a2d8902e5c4b (diff) | |
download | blackbird-op-linux-ecd4b234e250939eafa17846f29f77a1b6f5a247.tar.gz blackbird-op-linux-ecd4b234e250939eafa17846f29f77a1b6f5a247.zip |
drm/ast: Replace drm_get_pci_device() and drm_put_dev()
Both functions are deprecated. Open-code them them in preparation
of removing struct drm_driver.{load,unload}.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191113155857.9507-2-tzimmermann@suse.de
-rw-r--r-- | drivers/gpu/drm/ast/ast_drv.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index d763da6f0834..78c90a3c903b 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -86,9 +86,35 @@ static void ast_kick_out_firmware_fb(struct pci_dev *pdev) static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { + struct drm_device *dev; + int ret; + ast_kick_out_firmware_fb(pdev); - return drm_get_pci_dev(pdev, ent, &driver); + ret = pci_enable_device(pdev); + if (ret) + return ret; + + dev = drm_dev_alloc(&driver, &pdev->dev); + if (IS_ERR(dev)) { + ret = PTR_ERR(dev); + goto err_pci_disable_device; + } + + dev->pdev = pdev; + pci_set_drvdata(pdev, dev); + + ret = drm_dev_register(dev, ent->driver_data); + if (ret) + goto err_drm_dev_put; + + return 0; + +err_drm_dev_put: + drm_dev_put(dev); +err_pci_disable_device: + pci_disable_device(pdev); + return ret; } static void @@ -96,7 +122,8 @@ ast_pci_remove(struct pci_dev *pdev) { struct drm_device *dev = pci_get_drvdata(pdev); - drm_put_dev(dev); + drm_dev_unregister(dev); + drm_dev_put(dev); } static int ast_drm_freeze(struct drm_device *dev) |