[PATCH] drm/hisilicon: Add load and unload callback functions

From: Tian Tao
Date: Wed Dec 23 2020 - 00:58:30 EST


Add the callback functions of drm_driver structure member functions
load and unload, no need to call load in the hibmc_pci_probe function
and unload in the hibmc_pci_remove function.

Signed-off-by: Tian Tao <tiantao6@xxxxxxxxxxxxx>
---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 0d4e902..109ca87 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -27,6 +27,9 @@

DEFINE_DRM_GEM_FOPS(hibmc_fops);

+static int hibmc_load(struct drm_device *dev, unsigned long flags);
+static void hibmc_unload(struct drm_device *dev);
+
static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
{
struct drm_device *dev = (struct drm_device *)arg;
@@ -63,6 +66,8 @@ static const struct drm_driver hibmc_driver = {
.dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset,
.gem_prime_mmap = drm_gem_prime_mmap,
.irq_handler = hibmc_drm_interrupt,
+ .load = hibmc_load,
+ .unload = hibmc_unload,
};

static int __maybe_unused hibmc_pm_suspend(struct device *dev)
@@ -248,7 +253,7 @@ static int hibmc_hw_init(struct hibmc_drm_private *priv)
return 0;
}

-static int hibmc_unload(struct drm_device *dev)
+static void hibmc_unload(struct drm_device *dev)
{
drm_atomic_helper_shutdown(dev);

@@ -256,11 +261,9 @@ static int hibmc_unload(struct drm_device *dev)
drm_irq_uninstall(dev);

pci_disable_msi(dev->pdev);
-
- return 0;
}

-static int hibmc_load(struct drm_device *dev)
+static int hibmc_load(struct drm_device *dev, unsigned long flags)
{
struct hibmc_drm_private *priv = to_hibmc_drm_private(dev);
int ret;
@@ -335,12 +338,6 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
goto err_return;
}

- ret = hibmc_load(dev);
- if (ret) {
- drm_err(dev, "failed to load hibmc: %d\n", ret);
- goto err_return;
- }
-
ret = drm_dev_register(dev, 0);
if (ret) {
drm_err(dev, "failed to register drv for userspace access: %d\n",
--
2.7.4