Commit 4d4dad21 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/hibmc: Remove references to struct drm_device.pdev

Using struct drm_device.pdev is deprecated. Convert hibmc to struct
drm_device.dev. No functional changes.

v3:
	* rebased
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarTian Tao <tiantao6@hisilicon.com>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Cc: Xinliang Liu <xinliang.liu@linaro.org>
Cc: Tian Tao  <tiantao6@hisilicon.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: Chen Feng <puck.chen@hisilicon.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210107080748.4768-4-tzimmermann@suse.de
parent 8f66090b
...@@ -210,8 +210,8 @@ static void hibmc_hw_config(struct hibmc_drm_private *priv) ...@@ -210,8 +210,8 @@ static void hibmc_hw_config(struct hibmc_drm_private *priv)
static int hibmc_hw_map(struct hibmc_drm_private *priv) static int hibmc_hw_map(struct hibmc_drm_private *priv)
{ {
struct drm_device *dev = &priv->dev;
struct pci_dev *pdev = dev->pdev; struct pci_dev *pdev = dev->pdev;
struct pci_dev *pdev = to_pci_dev(dev->dev);
resource_size_t addr, size, ioaddr, iosize; resource_size_t addr, size, ioaddr, iosize;
ioaddr = pci_resource_start(pdev, 1); ioaddr = pci_resource_start(pdev, 1);
...@@ -255,13 +255,14 @@ static int hibmc_unload(struct drm_device *dev) ...@@ -255,13 +255,14 @@ static int hibmc_unload(struct drm_device *dev)
if (dev->irq_enabled) if (dev->irq_enabled)
drm_irq_uninstall(dev); drm_irq_uninstall(dev);
pci_disable_msi(dev->pdev); pci_disable_msi(to_pci_dev(dev->dev));
return 0; return 0;
} }
static int hibmc_load(struct drm_device *dev) static int hibmc_load(struct drm_device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev->dev);
struct hibmc_drm_private *priv = to_hibmc_drm_private(dev); struct hibmc_drm_private *priv = to_hibmc_drm_private(dev);
int ret; int ret;
...@@ -269,8 +270,7 @@ static int hibmc_load(struct drm_device *dev) ...@@ -269,8 +270,7 @@ static int hibmc_load(struct drm_device *dev)
if (ret) if (ret)
goto err; goto err;
ret = drmm_vram_helper_init(dev, pci_resource_start(dev->pdev, 0), ret = drmm_vram_helper_init(dev, pci_resource_start(pdev, 0), priv->fb_size);
priv->fb_size);
if (ret) { if (ret) {
drm_err(dev, "Error initializing VRAM MM; %d\n", ret); drm_err(dev, "Error initializing VRAM MM; %d\n", ret);
goto err; goto err;
...@@ -286,11 +286,11 @@ static int hibmc_load(struct drm_device *dev) ...@@ -286,11 +286,11 @@ static int hibmc_load(struct drm_device *dev)
goto err; goto err;
} }
ret = pci_enable_msi(dev->pdev); ret = pci_enable_msi(pdev);
if (ret) { if (ret) {
drm_warn(dev, "enabling MSI failed: %d\n", ret); drm_warn(dev, "enabling MSI failed: %d\n", ret);
} else { } else {
ret = drm_irq_install(dev, dev->pdev->irq); ret = drm_irq_install(dev, pdev->irq);
if (ret) if (ret)
drm_warn(dev, "install irq failed: %d\n", ret); drm_warn(dev, "install irq failed: %d\n", ret);
} }
...@@ -326,7 +326,6 @@ static int hibmc_pci_probe(struct pci_dev *pdev, ...@@ -326,7 +326,6 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
} }
dev = &priv->dev; dev = &priv->dev;
dev->pdev = pdev;
pci_set_drvdata(pdev, dev); pci_set_drvdata(pdev, dev);
ret = pcim_enable_device(pdev); ret = pcim_enable_device(pdev);
......
...@@ -83,7 +83,7 @@ int hibmc_ddc_create(struct drm_device *drm_dev, ...@@ -83,7 +83,7 @@ int hibmc_ddc_create(struct drm_device *drm_dev,
connector->adapter.owner = THIS_MODULE; connector->adapter.owner = THIS_MODULE;
connector->adapter.class = I2C_CLASS_DDC; connector->adapter.class = I2C_CLASS_DDC;
snprintf(connector->adapter.name, I2C_NAME_SIZE, "HIS i2c bit bus"); snprintf(connector->adapter.name, I2C_NAME_SIZE, "HIS i2c bit bus");
connector->adapter.dev.parent = &drm_dev->pdev->dev; connector->adapter.dev.parent = drm_dev->dev;
i2c_set_adapdata(&connector->adapter, connector); i2c_set_adapdata(&connector->adapter, connector);
connector->adapter.algo_data = &connector->bit_data; connector->adapter.algo_data = &connector->bit_data;
......
// SPDX-License-Identifier: GPL-2.0-or-later
/* Hisilicon Hibmc SoC drm driver
*
* Based on the bochs drm driver.
*
* Copyright (c) 2016 Huawei Limited.
*
* Author:
* Rongrong Zou <zourongrong@huawei.com>
* Rongrong Zou <zourongrong@gmail.com>
* Jianhua Li <lijianhua@huawei.com>
*/
#include <linux/pci.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_gem.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_gem_vram_helper.h>
#include <drm/drm_print.h>
#include "hibmc_drm_drv.h"
int hibmc_mm_init(struct hibmc_drm_private *hibmc)
{
struct drm_vram_mm *vmm;
int ret;
struct drm_device *dev = hibmc->dev;
struct pci_dev *pdev = to_pci_dev(dev->dev);
vmm = drm_vram_helper_alloc_mm(dev, pci_resource_start(pdev, 0),
hibmc->fb_size);
if (IS_ERR(vmm)) {
ret = PTR_ERR(vmm);
drm_err(dev, "Error initializing VRAM MM; %d\n", ret);
return ret;
}
return 0;
}
void hibmc_mm_fini(struct hibmc_drm_private *hibmc)
{
if (!hibmc->dev->vram_mm)
return;
drm_vram_helper_release_mm(hibmc->dev);
}
int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args)
{
return drm_gem_vram_fill_create_dumb(file, dev, 0, 128, args);
}
const struct drm_mode_config_funcs hibmc_mode_funcs = {
.mode_valid = drm_vram_helper_mode_valid,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
.fb_create = drm_gem_fb_create,
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment