[PATCH v3 1/4] drm/mgag200: Create fbdev console after registering device

Thomas Zimmermann tzimmermann at suse.de
Thu Dec 5 16:01:39 UTC 2019


Generic fbdev console emulation is a DRM client. For consistency with
other clients, it should be created after registering the DRM device.
Hence move the fbdev code to the appropriate place.

Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/mgag200/mgag200_drv.c  | 6 ++++++
 drivers/gpu/drm/mgag200/mgag200_main.c | 4 ----
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 30b3b827adf8..8e641b29eb01 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -74,8 +74,14 @@ static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		goto err_mgag200_driver_unload;
 
+	ret = drm_fbdev_generic_setup(dev, 0);
+	if (ret)
+		goto err_mgag200_driver_unregister;
+
 	return 0;
 
+err_mgag200_driver_unregister:
+	drm_dev_unregister(dev);
 err_mgag200_driver_unload:
 	mgag200_driver_unload(dev);
 err_drm_dev_put:
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c
index e278b6a547bd..b680cf47cbb9 100644
--- a/drivers/gpu/drm/mgag200/mgag200_main.c
+++ b/drivers/gpu/drm/mgag200/mgag200_main.c
@@ -181,10 +181,6 @@ int mgag200_driver_load(struct drm_device *dev, unsigned long flags)
 		dev_warn(&dev->pdev->dev,
 			"Could not initialize cursors. Not doing hardware cursors.\n");
 
-	r = drm_fbdev_generic_setup(mdev->dev, 0);
-	if (r)
-		goto err_modeset;
-
 	return 0;
 
 err_modeset:
-- 
2.23.0



More information about the dri-devel mailing list