aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-09-26 21:00:06 -0400
committerDave Airlie <airlied@redhat.com>2018-09-26 21:00:12 -0400
commit18eb2f6e19d77900695987e3a2b775cccbe5b84e (patch)
treeeeeed59eaddabfafbf1065436873e9b067823f31 /drivers/gpu
parent2e240beefe48f011f8aaaeaae27536c0d6baa177 (diff)
parentc932c4f831e66fb5bb15229324825a4932ba3992 (diff)
Merge tag 'drm-hisilicon-next-2018-09-26' of github.com:xin3liang/linux into drm-next
- 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
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c26
-rw-r--r--drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h1
-rw-r--r--drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c2
-rw-r--r--drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c2
-rw-r--r--drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c8
5 files changed, 12 insertions, 27 deletions
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index d4f6f1f9df5b..68c0c297b3a5 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -37,7 +37,7 @@ static const struct file_operations hibmc_fops = {
37 .llseek = no_llseek, 37 .llseek = no_llseek,
38}; 38};
39 39
40irqreturn_t hibmc_drm_interrupt(int irq, void *arg) 40static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
41{ 41{
42 struct drm_device *dev = (struct drm_device *)arg; 42 struct drm_device *dev = (struct drm_device *)arg;
43 struct hibmc_drm_private *priv = 43 struct hibmc_drm_private *priv =
@@ -74,30 +74,16 @@ static int __maybe_unused hibmc_pm_suspend(struct device *dev)
74{ 74{
75 struct pci_dev *pdev = to_pci_dev(dev); 75 struct pci_dev *pdev = to_pci_dev(dev);
76 struct drm_device *drm_dev = pci_get_drvdata(pdev); 76 struct drm_device *drm_dev = pci_get_drvdata(pdev);
77 struct hibmc_drm_private *priv = drm_dev->dev_private;
78
79 drm_kms_helper_poll_disable(drm_dev);
80 priv->suspend_state = drm_atomic_helper_suspend(drm_dev);
81 if (IS_ERR(priv->suspend_state)) {
82 DRM_ERROR("drm_atomic_helper_suspend failed: %ld\n",
83 PTR_ERR(priv->suspend_state));
84 drm_kms_helper_poll_enable(drm_dev);
85 return PTR_ERR(priv->suspend_state);
86 }
87 77
88 return 0; 78 return drm_mode_config_helper_suspend(drm_dev);
89} 79}
90 80
91static int __maybe_unused hibmc_pm_resume(struct device *dev) 81static int __maybe_unused hibmc_pm_resume(struct device *dev)
92{ 82{
93 struct pci_dev *pdev = to_pci_dev(dev); 83 struct pci_dev *pdev = to_pci_dev(dev);
94 struct drm_device *drm_dev = pci_get_drvdata(pdev); 84 struct drm_device *drm_dev = pci_get_drvdata(pdev);
95 struct hibmc_drm_private *priv = drm_dev->dev_private;
96 85
97 drm_atomic_helper_resume(drm_dev, priv->suspend_state); 86 return drm_mode_config_helper_resume(drm_dev);
98 drm_kms_helper_poll_enable(drm_dev);
99
100 return 0;
101} 87}
102 88
103static const struct dev_pm_ops hibmc_pm_ops = { 89static const struct dev_pm_ops hibmc_pm_ops = {
@@ -387,7 +373,7 @@ err_unload:
387err_disable: 373err_disable:
388 pci_disable_device(pdev); 374 pci_disable_device(pdev);
389err_free: 375err_free:
390 drm_dev_unref(dev); 376 drm_dev_put(dev);
391 377
392 return ret; 378 return ret;
393} 379}
@@ -398,11 +384,11 @@ static void hibmc_pci_remove(struct pci_dev *pdev)
398 384
399 drm_dev_unregister(dev); 385 drm_dev_unregister(dev);
400 hibmc_unload(dev); 386 hibmc_unload(dev);
401 drm_dev_unref(dev); 387 drm_dev_put(dev);
402} 388}
403 389
404static struct pci_device_id hibmc_pci_table[] = { 390static struct pci_device_id hibmc_pci_table[] = {
405 {0x19e5, 0x1711, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 391 { PCI_VDEVICE(HUAWEI, 0x1711) },
406 {0,} 392 {0,}
407}; 393};
408 394
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
index e195521eb41e..45c25a488f42 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
@@ -47,7 +47,6 @@ struct hibmc_drm_private {
47 /* drm */ 47 /* drm */
48 struct drm_device *dev; 48 struct drm_device *dev;
49 bool mode_config_initialized; 49 bool mode_config_initialized;
50 struct drm_atomic_state *suspend_state;
51 50
52 /* ttm */ 51 /* ttm */
53 struct drm_global_reference mem_global_ref; 52 struct drm_global_reference mem_global_ref;
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
index b92595c477ef..edcca1761500 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
@@ -71,7 +71,6 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper,
71 DRM_DEBUG_DRIVER("surface width(%d), height(%d) and bpp(%d)\n", 71 DRM_DEBUG_DRIVER("surface width(%d), height(%d) and bpp(%d)\n",
72 sizes->surface_width, sizes->surface_height, 72 sizes->surface_width, sizes->surface_height,
73 sizes->surface_bpp); 73 sizes->surface_bpp);
74 sizes->surface_depth = 32;
75 74
76 bytes_per_pixel = DIV_ROUND_UP(sizes->surface_bpp, 8); 75 bytes_per_pixel = DIV_ROUND_UP(sizes->surface_bpp, 8);
77 76
@@ -122,6 +121,7 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper,
122 hi_fbdev->fb = hibmc_framebuffer_init(priv->dev, &mode_cmd, gobj); 121 hi_fbdev->fb = hibmc_framebuffer_init(priv->dev, &mode_cmd, gobj);
123 if (IS_ERR(hi_fbdev->fb)) { 122 if (IS_ERR(hi_fbdev->fb)) {
124 ret = PTR_ERR(hi_fbdev->fb); 123 ret = PTR_ERR(hi_fbdev->fb);
124 hi_fbdev->fb = NULL;
125 DRM_ERROR("failed to initialize framebuffer: %d\n", ret); 125 DRM_ERROR("failed to initialize framebuffer: %d\n", ret);
126 goto out_release_fbi; 126 goto out_release_fbi;
127 } 127 }
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
index 4871025f7573..2e3e0bdb8932 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
@@ -283,7 +283,7 @@ static void hibmc_bo_unref(struct hibmc_bo **bo)
283 return; 283 return;
284 284
285 tbo = &((*bo)->bo); 285 tbo = &((*bo)->bo);
286 ttm_bo_unref(&tbo); 286 ttm_bo_put(tbo);
287 *bo = NULL; 287 *bo = NULL;
288} 288}
289 289
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index ddb0403f1975..e6a62d5a00a3 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -193,7 +193,7 @@ static int kirin_drm_bind(struct device *dev)
193 193
194 ret = kirin_drm_kms_init(drm_dev); 194 ret = kirin_drm_kms_init(drm_dev);
195 if (ret) 195 if (ret)
196 goto err_drm_dev_unref; 196 goto err_drm_dev_put;
197 197
198 ret = drm_dev_register(drm_dev, 0); 198 ret = drm_dev_register(drm_dev, 0);
199 if (ret) 199 if (ret)
@@ -203,8 +203,8 @@ static int kirin_drm_bind(struct device *dev)
203 203
204err_kms_cleanup: 204err_kms_cleanup:
205 kirin_drm_kms_cleanup(drm_dev); 205 kirin_drm_kms_cleanup(drm_dev);
206err_drm_dev_unref: 206err_drm_dev_put:
207 drm_dev_unref(drm_dev); 207 drm_dev_put(drm_dev);
208 208
209 return ret; 209 return ret;
210} 210}
@@ -215,7 +215,7 @@ static void kirin_drm_unbind(struct device *dev)
215 215
216 drm_dev_unregister(drm_dev); 216 drm_dev_unregister(drm_dev);
217 kirin_drm_kms_cleanup(drm_dev); 217 kirin_drm_kms_cleanup(drm_dev);
218 drm_dev_unref(drm_dev); 218 drm_dev_put(drm_dev);
219} 219}
220 220
221static const struct component_master_ops kirin_drm_ops = { 221static const struct component_master_ops kirin_drm_ops = {