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
This commit is contained in:
Dave Airlie 2018-09-27 11:00:06 +10:00
commit 18eb2f6e19
5 changed files with 12 additions and 27 deletions

View File

@ -37,7 +37,7 @@ static const struct file_operations hibmc_fops = {
.llseek = no_llseek, .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 drm_device *dev = (struct drm_device *)arg;
struct hibmc_drm_private *priv = 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 pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev); 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); return drm_mode_config_helper_suspend(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;
} }
static int __maybe_unused hibmc_pm_resume(struct device *dev) static int __maybe_unused hibmc_pm_resume(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev); 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); return drm_mode_config_helper_resume(drm_dev);
drm_kms_helper_poll_enable(drm_dev);
return 0;
} }
static const struct dev_pm_ops hibmc_pm_ops = { static const struct dev_pm_ops hibmc_pm_ops = {
@ -387,7 +373,7 @@ err_unload:
err_disable: err_disable:
pci_disable_device(pdev); pci_disable_device(pdev);
err_free: err_free:
drm_dev_unref(dev); drm_dev_put(dev);
return ret; return ret;
} }
@ -398,11 +384,11 @@ static void hibmc_pci_remove(struct pci_dev *pdev)
drm_dev_unregister(dev); drm_dev_unregister(dev);
hibmc_unload(dev); hibmc_unload(dev);
drm_dev_unref(dev); drm_dev_put(dev);
} }
static struct pci_device_id hibmc_pci_table[] = { static struct pci_device_id hibmc_pci_table[] = {
{0x19e5, 0x1711, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VDEVICE(HUAWEI, 0x1711) },
{0,} {0,}
}; };

View File

@ -47,7 +47,6 @@ struct hibmc_drm_private {
/* drm */ /* drm */
struct drm_device *dev; struct drm_device *dev;
bool mode_config_initialized; bool mode_config_initialized;
struct drm_atomic_state *suspend_state;
/* ttm */ /* ttm */
struct drm_global_reference mem_global_ref; struct drm_global_reference mem_global_ref;

View 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", DRM_DEBUG_DRIVER("surface width(%d), height(%d) and bpp(%d)\n",
sizes->surface_width, sizes->surface_height, sizes->surface_width, sizes->surface_height,
sizes->surface_bpp); sizes->surface_bpp);
sizes->surface_depth = 32;
bytes_per_pixel = DIV_ROUND_UP(sizes->surface_bpp, 8); 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); hi_fbdev->fb = hibmc_framebuffer_init(priv->dev, &mode_cmd, gobj);
if (IS_ERR(hi_fbdev->fb)) { if (IS_ERR(hi_fbdev->fb)) {
ret = PTR_ERR(hi_fbdev->fb); ret = PTR_ERR(hi_fbdev->fb);
hi_fbdev->fb = NULL;
DRM_ERROR("failed to initialize framebuffer: %d\n", ret); DRM_ERROR("failed to initialize framebuffer: %d\n", ret);
goto out_release_fbi; goto out_release_fbi;
} }

View File

@ -283,7 +283,7 @@ static void hibmc_bo_unref(struct hibmc_bo **bo)
return; return;
tbo = &((*bo)->bo); tbo = &((*bo)->bo);
ttm_bo_unref(&tbo); ttm_bo_put(tbo);
*bo = NULL; *bo = NULL;
} }

View File

@ -193,7 +193,7 @@ static int kirin_drm_bind(struct device *dev)
ret = kirin_drm_kms_init(drm_dev); ret = kirin_drm_kms_init(drm_dev);
if (ret) if (ret)
goto err_drm_dev_unref; goto err_drm_dev_put;
ret = drm_dev_register(drm_dev, 0); ret = drm_dev_register(drm_dev, 0);
if (ret) if (ret)
@ -203,8 +203,8 @@ static int kirin_drm_bind(struct device *dev)
err_kms_cleanup: err_kms_cleanup:
kirin_drm_kms_cleanup(drm_dev); kirin_drm_kms_cleanup(drm_dev);
err_drm_dev_unref: err_drm_dev_put:
drm_dev_unref(drm_dev); drm_dev_put(drm_dev);
return ret; return ret;
} }
@ -215,7 +215,7 @@ static void kirin_drm_unbind(struct device *dev)
drm_dev_unregister(drm_dev); drm_dev_unregister(drm_dev);
kirin_drm_kms_cleanup(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 = { static const struct component_master_ops kirin_drm_ops = {