Skip to contentSkip to conversation

drm/vmwgfx: Call vmw_driver_{load, unload}() before registering device

PATCH Superseded Thomas Zimmermann 2 participants 4 messages Dec 9, 2019 – Dec 10, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH 1/1 drm/vmwgfx: Call vmw_driver_{load, unload}() before registering device

The load/unload callbacks in struct drm_driver are deprecated. Remove them and call functions explicitly.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 44 +++++++++++++++++++++++++----
 1 file changed, 38 insertions(+), 6 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +38 -6
index e962048f65d2..f34f1eb57cfa 100644
@@ -28,10 +28,10 @@
 #include <linux/console.h>
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
+#include <linux/pci.h>
 
 #include <drm/drm_drv.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_pci.h>
 #include <drm/drm_sysfs.h>
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_module.h>
@@ -1211,8 +1211,10 @@ static void vmw_remove(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
 
+	drm_dev_unregister(dev);
+	vmw_driver_unload(dev);
+	drm_dev_put(dev);
 	pci_disable_device(pdev);
-	drm_put_dev(dev);
 }
 
 static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
@@ -1329,7 +1331,7 @@ static int vmw_pm_freeze(struct device *kdev)
 
 	vmw_fence_fifo_down(dev_priv->fman);
 	__vmw_svga_disable(dev_priv);
-
+
 	vmw_release_device_late(dev_priv);
 	return 0;
 }
@@ -1391,8 +1393,6 @@ static const struct file_operations vmwgfx_driver_fops = {
 static struct drm_driver driver = {
 	.driver_features =
 	DRIVER_MODESET | DRIVER_RENDER | DRIVER_ATOMIC,
-	.load = vmw_driver_load,
-	.unload = vmw_driver_unload,
 	.get_vblank_counter = vmw_get_vblank_counter,
 	.enable_vblank = vmw_enable_vblank,
 	.disable_vblank = vmw_disable_vblank,
@@ -1431,7 +1431,39 @@ static struct pci_driver vmw_pci_driver = {
 
 static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-	return drm_get_pci_dev(pdev, ent, &driver);
+	struct drm_device *dev;
+	int ret;
+
+	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 = vmw_driver_load(dev, ent->driver_data);
+	if (ret)
+		goto err_drm_dev_put;
+
+	ret = drm_dev_register(dev, ent->driver_data);
+	if (ret)
+		goto err_vmw_driver_unload;
+
+	return 0;
+
+err_vmw_driver_unload:
+	vmw_driver_unload(dev);
+err_drm_dev_put:
+	drm_dev_put(dev);
+err_pci_disable_device:
+	pci_disable_device(pdev);
+	return ret;
 }
 
 static int __init vmwgfx_init(void)

--
2.24.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

Re: [PATCH] drm/vmwgfx: Call vmw_driver_{load,unload}() before registering device

Hi,

Quoted 6 lines · Thomas Zimmermann

The load/unload callbacks in struct drm_driver are deprecated. Remove them and call functions explicitly.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 44 +++++++

Hmm, which tree is this diff against? I get

Applying: drm/vmwgfx: Call vmw_driver_{load, unload}() before registering device
Using index info to reconstruct a base tree...
M drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
error: patch failed: drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:1329
error: drivers/gpu/drm/vmwgfx/vmwgfx_drv.c: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Patch failed at 0001 drm/vmwgfx: Call vmw_driver_{load, unload}() before registering device

On both drm-misc-next and linus' master?

Thanks,

Thomas

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#2 lore raw

Re: [PATCH] drm/vmwgfx: Call vmw_driver_{load,unload}() before registering device

Hi

Am 10.12.19 um 11:37 schrieb Thomas Hellstrom:

Quoted 23 lines

Hi,

Quoted 6 lines · Thomas Zimmermann

The load/unload callbacks in struct drm_driver are deprecated. Remove them and call functions explicitly.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 44 +++++++

Hmm, which tree is this diff against? I get

Applying: drm/vmwgfx: Call vmw_driver_{load, unload}() before registering device
Using index info to reconstruct a base tree...
M drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
error: patch failed: drivers/gpu/drm/vmwgfx/vmwgfx_drv.c:1329
error: drivers/gpu/drm/vmwgfx/vmwgfx_drv.c: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Patch failed at 0001 drm/vmwgfx: Call vmw_driver_{load, unload}() before registering device

Quoted 1 line

On both drm-misc-next and linus' master?

It's against one of yesterday's drm-tip. Let me know if you prefer a patch against drm-misc-next.

Best regards
Thomas

Quoted 12 lines

Thanks,

Thomas

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Re: [PATCH] drm/vmwgfx: Call vmw_driver_{load,unload}() before registering device

In reply to Thomas Zimmermann
Quoted 37 lines · Thomas Zimmermann

The load/unload callbacks in struct drm_driver are deprecated. Remove them and call functions explicitly.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 44 +++++++++++++++++++++++++----
 1 file changed, 38 insertions(+), 6 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +4 -2
index e962048f65d2..f34f1eb57cfa 100644
@@ -28,10 +28,10 @@
 #include <linux/console.h>
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
+#include <linux/pci.h>
 
 #include <drm/drm_drv.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_pci.h>
 #include <drm/drm_sysfs.h>
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_module.h>
@@ -1211,8 +1211,10 @@ static void vmw_remove(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
 
+	drm_dev_unregister(dev);
+	vmw_driver_unload(dev);
+	drm_dev_put(dev);
 	pci_disable_device(pdev);
-	drm_put_dev(dev);
 }
 
 static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,

drivers/gpu/drm/vmwgfx/vmwgfx_drv.c static int vmw_pm_freeze(struct device *kdev) · line 1334

Quoted 5 lines
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +1 -1
@@ -1329,7 +1331,7 @@ static int vmw_pm_freeze(struct device *kdev)
 
 	vmw_fence_fifo_down(dev_priv->fman);
 	__vmw_svga_disable(dev_priv);
-
+

Unrelated whitespace-fixup.

Otherwise looks good, but still conflicts in the above hunk when I try to apply it. Could be some TAB-mangling on the way perhaps.

Could you remove that hunk and resend?

Thanks,

Thomas

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel