mirror of https://gitee.com/openkylin/linux.git
drm/mgag200: Call mgag200_driver_{load, unload}() before registering device
The load/unload callbacks in struct drm_driver are deprecated. Remove them and call functions explicitly. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20191205090252.5711-1-tzimmermann@suse.de
This commit is contained in:
parent
50cbe0e379
commit
9623ecb07f
|
@ -6,13 +6,13 @@
|
||||||
* Dave Airlie
|
* Dave Airlie
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h>
|
|
||||||
#include <linux/console.h>
|
#include <linux/console.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/pci.h>
|
||||||
|
|
||||||
#include <drm/drm_drv.h>
|
#include <drm/drm_drv.h>
|
||||||
#include <drm/drm_file.h>
|
#include <drm/drm_file.h>
|
||||||
#include <drm/drm_ioctl.h>
|
#include <drm/drm_ioctl.h>
|
||||||
#include <drm/drm_pci.h>
|
|
||||||
#include <drm/drm_pciids.h>
|
#include <drm/drm_pciids.h>
|
||||||
|
|
||||||
#include "mgag200_drv.h"
|
#include "mgag200_drv.h"
|
||||||
|
@ -46,24 +46,56 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
|
||||||
|
|
||||||
static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||||
{
|
{
|
||||||
|
struct drm_device *dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "mgag200drmfb");
|
drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, "mgag200drmfb");
|
||||||
|
|
||||||
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 = mgag200_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_mgag200_driver_unload;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_mgag200_driver_unload:
|
||||||
|
mgag200_driver_unload(dev);
|
||||||
|
err_drm_dev_put:
|
||||||
|
drm_dev_put(dev);
|
||||||
|
err_pci_disable_device:
|
||||||
|
pci_disable_device(pdev);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mga_pci_remove(struct pci_dev *pdev)
|
static void mga_pci_remove(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
struct drm_device *dev = pci_get_drvdata(pdev);
|
struct drm_device *dev = pci_get_drvdata(pdev);
|
||||||
|
|
||||||
drm_put_dev(dev);
|
drm_dev_unregister(dev);
|
||||||
|
mgag200_driver_unload(dev);
|
||||||
|
drm_dev_put(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
|
DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
|
||||||
|
|
||||||
static struct drm_driver driver = {
|
static struct drm_driver driver = {
|
||||||
.driver_features = DRIVER_GEM | DRIVER_MODESET,
|
.driver_features = DRIVER_GEM | DRIVER_MODESET,
|
||||||
.load = mgag200_driver_load,
|
|
||||||
.unload = mgag200_driver_unload,
|
|
||||||
.fops = &mgag200_driver_fops,
|
.fops = &mgag200_driver_fops,
|
||||||
.name = DRIVER_NAME,
|
.name = DRIVER_NAME,
|
||||||
.desc = DRIVER_DESC,
|
.desc = DRIVER_DESC,
|
||||||
|
|
Loading…
Reference in New Issue