Merge tag 'drm-hisilicon-next-2018-09-26' of github.com:xin3liang/linux into drm...
authorDave Airlie <airlied@redhat.com>
Thu, 27 Sep 2018 01:00:06 +0000 (11:00 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 27 Sep 2018 01:00:12 +0000 (11:00 +1000)
- A crash fix founded in recent linux-next from John Garry
- One sparse warning fix from Souptick Joarder
- Some xxx_unref cleanup from Thomas Zimmermann

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Xinliang Liu <xinliang.liu@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/CAGd==04mXPMjVZ3=cM8r+DSQNM6zy7Anc4T2OsHjZgSsazBTPQ@mail.gmail.com
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c

index d4f6f1f9df5b73e06fd7f19999aa345f1b46798a..68c0c297b3a53b2961fa46a55e197d14d3dc389d 100644 (file)
@@ -37,7 +37,7 @@ static const struct file_operations hibmc_fops = {
        .llseek         = no_llseek,
 };
 
-irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
+static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
 {
        struct drm_device *dev = (struct drm_device *)arg;
        struct hibmc_drm_private *priv =
@@ -74,30 +74,16 @@ static int __maybe_unused hibmc_pm_suspend(struct device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
-       struct hibmc_drm_private *priv = drm_dev->dev_private;
-
-       drm_kms_helper_poll_disable(drm_dev);
-       priv->suspend_state = drm_atomic_helper_suspend(drm_dev);
-       if (IS_ERR(priv->suspend_state)) {
-               DRM_ERROR("drm_atomic_helper_suspend failed: %ld\n",
-                         PTR_ERR(priv->suspend_state));
-               drm_kms_helper_poll_enable(drm_dev);
-               return PTR_ERR(priv->suspend_state);
-       }
 
-       return 0;
+       return drm_mode_config_helper_suspend(drm_dev);
 }
 
 static int  __maybe_unused hibmc_pm_resume(struct device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
-       struct hibmc_drm_private *priv = drm_dev->dev_private;
 
-       drm_atomic_helper_resume(drm_dev, priv->suspend_state);
-       drm_kms_helper_poll_enable(drm_dev);
-
-       return 0;
+       return drm_mode_config_helper_resume(drm_dev);
 }
 
 static const struct dev_pm_ops hibmc_pm_ops = {
@@ -387,7 +373,7 @@ err_unload:
 err_disable:
        pci_disable_device(pdev);
 err_free:
-       drm_dev_unref(dev);
+       drm_dev_put(dev);
 
        return ret;
 }
@@ -398,11 +384,11 @@ static void hibmc_pci_remove(struct pci_dev *pdev)
 
        drm_dev_unregister(dev);
        hibmc_unload(dev);
-       drm_dev_unref(dev);
+       drm_dev_put(dev);
 }
 
 static struct pci_device_id hibmc_pci_table[] = {
-       {0x19e5, 0x1711, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       { PCI_VDEVICE(HUAWEI, 0x1711) },
        {0,}
 };
 
index e195521eb41e9b54c89c428afc3bfbf7c4a41216..45c25a488f429f58b126de5ce1a5c2ef6c4aa8d5 100644 (file)
@@ -47,7 +47,6 @@ struct hibmc_drm_private {
        /* drm */
        struct drm_device  *dev;
        bool mode_config_initialized;
-       struct drm_atomic_state *suspend_state;
 
        /* ttm */
        struct drm_global_reference mem_global_ref;
index b92595c477ef63038811e1af940822599eb577e3..edcca17615001cb4ba37e7ac3601d731189f36c8 100644 (file)
@@ -71,7 +71,6 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper,
        DRM_DEBUG_DRIVER("surface width(%d), height(%d) and bpp(%d)\n",
                         sizes->surface_width, sizes->surface_height,
                         sizes->surface_bpp);
-       sizes->surface_depth = 32;
 
        bytes_per_pixel = DIV_ROUND_UP(sizes->surface_bpp, 8);
 
@@ -122,6 +121,7 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper,
        hi_fbdev->fb = hibmc_framebuffer_init(priv->dev, &mode_cmd, gobj);
        if (IS_ERR(hi_fbdev->fb)) {
                ret = PTR_ERR(hi_fbdev->fb);
+               hi_fbdev->fb = NULL;
                DRM_ERROR("failed to initialize framebuffer: %d\n", ret);
                goto out_release_fbi;
        }
index 4871025f7573aede35d63db6623ddecd837ff9d9..2e3e0bdb8932f8a210b698a1adb8d8a089e91e2b 100644 (file)
@@ -283,7 +283,7 @@ static void hibmc_bo_unref(struct hibmc_bo **bo)
                return;
 
        tbo = &((*bo)->bo);
-       ttm_bo_unref(&tbo);
+       ttm_bo_put(tbo);
        *bo = NULL;
 }
 
index ddb0403f1975e690a415cdbeb3fa12aded8b5744..e6a62d5a00a3af0164a113ffc971304a80f5cbb5 100644 (file)
@@ -193,7 +193,7 @@ static int kirin_drm_bind(struct device *dev)
 
        ret = kirin_drm_kms_init(drm_dev);
        if (ret)
-               goto err_drm_dev_unref;
+               goto err_drm_dev_put;
 
        ret = drm_dev_register(drm_dev, 0);
        if (ret)
@@ -203,8 +203,8 @@ static int kirin_drm_bind(struct device *dev)
 
 err_kms_cleanup:
        kirin_drm_kms_cleanup(drm_dev);
-err_drm_dev_unref:
-       drm_dev_unref(drm_dev);
+err_drm_dev_put:
+       drm_dev_put(drm_dev);
 
        return ret;
 }
@@ -215,7 +215,7 @@ static void kirin_drm_unbind(struct device *dev)
 
        drm_dev_unregister(drm_dev);
        kirin_drm_kms_cleanup(drm_dev);
-       drm_dev_unref(drm_dev);
+       drm_dev_put(drm_dev);
 }
 
 static const struct component_master_ops kirin_drm_ops = {