Commit 8ff5446a authored by Thomas Zimmermann's avatar Thomas Zimmermann Committed by Jani Nikula

drm/i915: Remove references to struct drm_device.pdev

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

v6:
	* also remove assignment in selftests/ in a later patch (Chris)
v5:
	* remove assignment in later patch (Chris)
v3:
	* rebased
v2:
	* move gt/ and gvt/ changes into separate patches
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210128133127.2311-2-tzimmermann@suse.de
parent 4043277a
...@@ -2127,7 +2127,7 @@ bool intel_bios_is_valid_vbt(const void *buf, size_t size) ...@@ -2127,7 +2127,7 @@ bool intel_bios_is_valid_vbt(const void *buf, size_t size)
static struct vbt_header *oprom_get_vbt(struct drm_i915_private *dev_priv) static struct vbt_header *oprom_get_vbt(struct drm_i915_private *dev_priv)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
void __iomem *p = NULL, *oprom; void __iomem *p = NULL, *oprom;
struct vbt_header *vbt; struct vbt_header *vbt;
u16 vbt_size; u16 vbt_size;
......
...@@ -96,7 +96,7 @@ static void fixed_450mhz_get_cdclk(struct drm_i915_private *dev_priv, ...@@ -96,7 +96,7 @@ static void fixed_450mhz_get_cdclk(struct drm_i915_private *dev_priv,
static void i85x_get_cdclk(struct drm_i915_private *dev_priv, static void i85x_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config) struct intel_cdclk_config *cdclk_config)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
u16 hpllcc = 0; u16 hpllcc = 0;
/* /*
...@@ -138,7 +138,7 @@ static void i85x_get_cdclk(struct drm_i915_private *dev_priv, ...@@ -138,7 +138,7 @@ static void i85x_get_cdclk(struct drm_i915_private *dev_priv,
static void i915gm_get_cdclk(struct drm_i915_private *dev_priv, static void i915gm_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config) struct intel_cdclk_config *cdclk_config)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
u16 gcfgc = 0; u16 gcfgc = 0;
pci_read_config_word(pdev, GCFGC, &gcfgc); pci_read_config_word(pdev, GCFGC, &gcfgc);
...@@ -162,7 +162,7 @@ static void i915gm_get_cdclk(struct drm_i915_private *dev_priv, ...@@ -162,7 +162,7 @@ static void i915gm_get_cdclk(struct drm_i915_private *dev_priv,
static void i945gm_get_cdclk(struct drm_i915_private *dev_priv, static void i945gm_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config) struct intel_cdclk_config *cdclk_config)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
u16 gcfgc = 0; u16 gcfgc = 0;
pci_read_config_word(pdev, GCFGC, &gcfgc); pci_read_config_word(pdev, GCFGC, &gcfgc);
...@@ -256,7 +256,7 @@ static unsigned int intel_hpll_vco(struct drm_i915_private *dev_priv) ...@@ -256,7 +256,7 @@ static unsigned int intel_hpll_vco(struct drm_i915_private *dev_priv)
static void g33_get_cdclk(struct drm_i915_private *dev_priv, static void g33_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config) struct intel_cdclk_config *cdclk_config)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
static const u8 div_3200[] = { 12, 10, 8, 7, 5, 16 }; static const u8 div_3200[] = { 12, 10, 8, 7, 5, 16 };
static const u8 div_4000[] = { 14, 12, 10, 8, 6, 20 }; static const u8 div_4000[] = { 14, 12, 10, 8, 6, 20 };
static const u8 div_4800[] = { 20, 14, 12, 10, 8, 24 }; static const u8 div_4800[] = { 20, 14, 12, 10, 8, 24 };
...@@ -305,7 +305,7 @@ static void g33_get_cdclk(struct drm_i915_private *dev_priv, ...@@ -305,7 +305,7 @@ static void g33_get_cdclk(struct drm_i915_private *dev_priv,
static void pnv_get_cdclk(struct drm_i915_private *dev_priv, static void pnv_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config) struct intel_cdclk_config *cdclk_config)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
u16 gcfgc = 0; u16 gcfgc = 0;
pci_read_config_word(pdev, GCFGC, &gcfgc); pci_read_config_word(pdev, GCFGC, &gcfgc);
...@@ -339,7 +339,7 @@ static void pnv_get_cdclk(struct drm_i915_private *dev_priv, ...@@ -339,7 +339,7 @@ static void pnv_get_cdclk(struct drm_i915_private *dev_priv,
static void i965gm_get_cdclk(struct drm_i915_private *dev_priv, static void i965gm_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config) struct intel_cdclk_config *cdclk_config)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
static const u8 div_3200[] = { 16, 10, 8 }; static const u8 div_3200[] = { 16, 10, 8 };
static const u8 div_4000[] = { 20, 12, 10 }; static const u8 div_4000[] = { 20, 12, 10 };
static const u8 div_5333[] = { 24, 16, 14 }; static const u8 div_5333[] = { 24, 16, 14 };
...@@ -384,7 +384,7 @@ static void i965gm_get_cdclk(struct drm_i915_private *dev_priv, ...@@ -384,7 +384,7 @@ static void i965gm_get_cdclk(struct drm_i915_private *dev_priv,
static void gm45_get_cdclk(struct drm_i915_private *dev_priv, static void gm45_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config) struct intel_cdclk_config *cdclk_config)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
unsigned int cdclk_sel; unsigned int cdclk_sel;
u16 tmp = 0; u16 tmp = 0;
......
...@@ -644,7 +644,7 @@ static void csr_load_work_fn(struct work_struct *work) ...@@ -644,7 +644,7 @@ static void csr_load_work_fn(struct work_struct *work)
dev_priv = container_of(work, typeof(*dev_priv), csr.work); dev_priv = container_of(work, typeof(*dev_priv), csr.work);
csr = &dev_priv->csr; csr = &dev_priv->csr;
request_firmware(&fw, dev_priv->csr.fw_path, &dev_priv->drm.pdev->dev); request_firmware(&fw, dev_priv->csr.fw_path, dev_priv->drm.dev);
parse_csr_fw(dev_priv, fw); parse_csr_fw(dev_priv, fw);
if (dev_priv->csr.dmc_payload) { if (dev_priv->csr.dmc_payload) {
......
...@@ -425,7 +425,7 @@ static void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi, ...@@ -425,7 +425,7 @@ static void i2c_acpi_find_adapter(struct intel_dsi *intel_dsi,
const u16 slave_addr) const u16 slave_addr)
{ {
struct drm_device *drm_dev = intel_dsi->base.base.dev; struct drm_device *drm_dev = intel_dsi->base.base.dev;
struct device *dev = &drm_dev->pdev->dev; struct device *dev = drm_dev->dev;
struct acpi_device *acpi_dev; struct acpi_device *acpi_dev;
struct list_head resource_list; struct list_head resource_list;
struct i2c_adapter_lookup lookup; struct i2c_adapter_lookup lookup;
......
...@@ -167,7 +167,7 @@ static int intelfb_create(struct drm_fb_helper *helper, ...@@ -167,7 +167,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
struct intel_framebuffer *intel_fb = ifbdev->fb; struct intel_framebuffer *intel_fb = ifbdev->fb;
struct drm_device *dev = helper->dev; struct drm_device *dev = helper->dev;
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
struct i915_ggtt *ggtt = &dev_priv->ggtt; struct i915_ggtt *ggtt = &dev_priv->ggtt;
const struct i915_ggtt_view view = { const struct i915_ggtt_view view = {
.type = I915_GGTT_VIEW_NORMAL, .type = I915_GGTT_VIEW_NORMAL,
......
...@@ -840,7 +840,7 @@ static const struct i2c_lock_operations gmbus_lock_ops = { ...@@ -840,7 +840,7 @@ static const struct i2c_lock_operations gmbus_lock_ops = {
*/ */
int intel_gmbus_setup(struct drm_i915_private *dev_priv) int intel_gmbus_setup(struct drm_i915_private *dev_priv)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
struct intel_gmbus *bus; struct intel_gmbus *bus;
unsigned int pin; unsigned int pin;
int ret; int ret;
......
...@@ -80,6 +80,7 @@ static struct platform_device * ...@@ -80,6 +80,7 @@ static struct platform_device *
lpe_audio_platdev_create(struct drm_i915_private *dev_priv) lpe_audio_platdev_create(struct drm_i915_private *dev_priv)
{ {
struct drm_device *dev = &dev_priv->drm; struct drm_device *dev = &dev_priv->drm;
struct pci_dev *pdev = to_pci_dev(dev->dev);
struct platform_device_info pinfo = {}; struct platform_device_info pinfo = {};
struct resource *rsc; struct resource *rsc;
struct platform_device *platdev; struct platform_device *platdev;
...@@ -99,9 +100,9 @@ lpe_audio_platdev_create(struct drm_i915_private *dev_priv) ...@@ -99,9 +100,9 @@ lpe_audio_platdev_create(struct drm_i915_private *dev_priv)
rsc[0].flags = IORESOURCE_IRQ; rsc[0].flags = IORESOURCE_IRQ;
rsc[0].name = "hdmi-lpe-audio-irq"; rsc[0].name = "hdmi-lpe-audio-irq";
rsc[1].start = pci_resource_start(dev->pdev, 0) + rsc[1].start = pci_resource_start(pdev, 0) +
I915_HDMI_LPE_AUDIO_BASE; I915_HDMI_LPE_AUDIO_BASE;
rsc[1].end = pci_resource_start(dev->pdev, 0) + rsc[1].end = pci_resource_start(pdev, 0) +
I915_HDMI_LPE_AUDIO_BASE + I915_HDMI_LPE_AUDIO_SIZE - 1; I915_HDMI_LPE_AUDIO_BASE + I915_HDMI_LPE_AUDIO_SIZE - 1;
rsc[1].flags = IORESOURCE_MEM; rsc[1].flags = IORESOURCE_MEM;
rsc[1].name = "hdmi-lpe-audio-mmio"; rsc[1].name = "hdmi-lpe-audio-mmio";
......
...@@ -247,7 +247,7 @@ static int swsci(struct drm_i915_private *dev_priv, ...@@ -247,7 +247,7 @@ static int swsci(struct drm_i915_private *dev_priv,
u32 function, u32 parm, u32 *parm_out) u32 function, u32 parm, u32 *parm_out)
{ {
struct opregion_swsci *swsci = dev_priv->opregion.swsci; struct opregion_swsci *swsci = dev_priv->opregion.swsci;
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
u32 main_function, sub_function, scic; u32 main_function, sub_function, scic;
u16 swsci_val; u16 swsci_val;
u32 dslp; u32 dslp;
...@@ -807,7 +807,7 @@ static int intel_load_vbt_firmware(struct drm_i915_private *dev_priv) ...@@ -807,7 +807,7 @@ static int intel_load_vbt_firmware(struct drm_i915_private *dev_priv)
if (!name || !*name) if (!name || !*name)
return -ENOENT; return -ENOENT;
ret = request_firmware(&fw, name, &dev_priv->drm.pdev->dev); ret = request_firmware(&fw, name, dev_priv->drm.dev);
if (ret) { if (ret) {
drm_err(&dev_priv->drm, drm_err(&dev_priv->drm,
"Requesting VBT firmware \"%s\" failed (%d)\n", "Requesting VBT firmware \"%s\" failed (%d)\n",
...@@ -840,7 +840,7 @@ static int intel_load_vbt_firmware(struct drm_i915_private *dev_priv) ...@@ -840,7 +840,7 @@ static int intel_load_vbt_firmware(struct drm_i915_private *dev_priv)
int intel_opregion_setup(struct drm_i915_private *dev_priv) int intel_opregion_setup(struct drm_i915_private *dev_priv)
{ {
struct intel_opregion *opregion = &dev_priv->opregion; struct intel_opregion *opregion = &dev_priv->opregion;
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
u32 asls, mboxes; u32 asls, mboxes;
char buf[sizeof(OPREGION_SIGNATURE)]; char buf[sizeof(OPREGION_SIGNATURE)];
int err = 0; int err = 0;
......
...@@ -202,7 +202,7 @@ struct intel_overlay { ...@@ -202,7 +202,7 @@ struct intel_overlay {
static void i830_overlay_clock_gating(struct drm_i915_private *dev_priv, static void i830_overlay_clock_gating(struct drm_i915_private *dev_priv,
bool enable) bool enable)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
u8 val; u8 val;
/* WA_OVERLAY_CLKGATE:alm */ /* WA_OVERLAY_CLKGATE:alm */
......
...@@ -557,7 +557,7 @@ static u32 i9xx_get_backlight(struct intel_connector *connector) ...@@ -557,7 +557,7 @@ static u32 i9xx_get_backlight(struct intel_connector *connector)
if (panel->backlight.combination_mode) { if (panel->backlight.combination_mode) {
u8 lbpc; u8 lbpc;
pci_read_config_byte(dev_priv->drm.pdev, LBPC, &lbpc); pci_read_config_byte(to_pci_dev(dev_priv->drm.dev), LBPC, &lbpc);
val *= lbpc; val *= lbpc;
} }
...@@ -631,7 +631,7 @@ static void i9xx_set_backlight(const struct drm_connector_state *conn_state, u32 ...@@ -631,7 +631,7 @@ static void i9xx_set_backlight(const struct drm_connector_state *conn_state, u32
lbpc = level * 0xfe / panel->backlight.max + 1; lbpc = level * 0xfe / panel->backlight.max + 1;
level /= lbpc; level /= lbpc;
pci_write_config_byte(dev_priv->drm.pdev, LBPC, lbpc); pci_write_config_byte(to_pci_dev(dev_priv->drm.dev), LBPC, lbpc);
} }
if (IS_GEN(dev_priv, 4)) { if (IS_GEN(dev_priv, 4)) {
......
...@@ -160,7 +160,7 @@ static struct intel_quirk intel_quirks[] = { ...@@ -160,7 +160,7 @@ static struct intel_quirk intel_quirks[] = {
void intel_init_quirks(struct drm_i915_private *i915) void intel_init_quirks(struct drm_i915_private *i915)
{ {
struct pci_dev *d = i915->drm.pdev; struct pci_dev *d = to_pci_dev(i915->drm.dev);
int i; int i;
for (i = 0; i < ARRAY_SIZE(intel_quirks); i++) { for (i = 0; i < ARRAY_SIZE(intel_quirks); i++) {
......
...@@ -3281,7 +3281,7 @@ static bool ...@@ -3281,7 +3281,7 @@ static bool
intel_sdvo_init_ddc_proxy(struct intel_sdvo *sdvo, intel_sdvo_init_ddc_proxy(struct intel_sdvo *sdvo,
struct drm_i915_private *dev_priv) struct drm_i915_private *dev_priv)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
sdvo->ddc.owner = THIS_MODULE; sdvo->ddc.owner = THIS_MODULE;
sdvo->ddc.class = I2C_CLASS_DDC; sdvo->ddc.class = I2C_CLASS_DDC;
......
...@@ -25,7 +25,7 @@ static i915_reg_t intel_vga_cntrl_reg(struct drm_i915_private *i915) ...@@ -25,7 +25,7 @@ static i915_reg_t intel_vga_cntrl_reg(struct drm_i915_private *i915)
/* Disable the VGA plane that we never use */ /* Disable the VGA plane that we never use */
void intel_vga_disable(struct drm_i915_private *dev_priv) void intel_vga_disable(struct drm_i915_private *dev_priv)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
i915_reg_t vga_reg = intel_vga_cntrl_reg(dev_priv); i915_reg_t vga_reg = intel_vga_cntrl_reg(dev_priv);
u8 sr1; u8 sr1;
...@@ -76,7 +76,7 @@ void intel_vga_redisable(struct drm_i915_private *i915) ...@@ -76,7 +76,7 @@ void intel_vga_redisable(struct drm_i915_private *i915)
void intel_vga_reset_io_mem(struct drm_i915_private *i915) void intel_vga_reset_io_mem(struct drm_i915_private *i915)
{ {
struct pci_dev *pdev = i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
/* /*
* After we re-enable the power well, if we touch VGA register 0x3d5 * After we re-enable the power well, if we touch VGA register 0x3d5
...@@ -136,7 +136,7 @@ intel_vga_set_decode(void *cookie, bool enable_decode) ...@@ -136,7 +136,7 @@ intel_vga_set_decode(void *cookie, bool enable_decode)
int intel_vga_register(struct drm_i915_private *i915) int intel_vga_register(struct drm_i915_private *i915)
{ {
struct pci_dev *pdev = i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
int ret; int ret;
/* /*
...@@ -156,7 +156,7 @@ int intel_vga_register(struct drm_i915_private *i915) ...@@ -156,7 +156,7 @@ int intel_vga_register(struct drm_i915_private *i915)
void intel_vga_unregister(struct drm_i915_private *i915) void intel_vga_unregister(struct drm_i915_private *i915)
{ {
struct pci_dev *pdev = i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
vga_client_register(pdev, NULL, NULL, NULL); vga_client_register(pdev, NULL, NULL, NULL);
} }
...@@ -35,7 +35,7 @@ static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj) ...@@ -35,7 +35,7 @@ static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)
* to handle all possible callers, and given typical object sizes, * to handle all possible callers, and given typical object sizes,
* the alignment of the buddy allocation will naturally match. * the alignment of the buddy allocation will naturally match.
*/ */
vaddr = dma_alloc_coherent(&obj->base.dev->pdev->dev, vaddr = dma_alloc_coherent(obj->base.dev->dev,
roundup_pow_of_two(obj->base.size), roundup_pow_of_two(obj->base.size),
&dma, GFP_KERNEL); &dma, GFP_KERNEL);
if (!vaddr) if (!vaddr)
...@@ -83,7 +83,7 @@ static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj) ...@@ -83,7 +83,7 @@ static int i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)
err_st: err_st:
kfree(st); kfree(st);
err_pci: err_pci:
dma_free_coherent(&obj->base.dev->pdev->dev, dma_free_coherent(obj->base.dev->dev,
roundup_pow_of_two(obj->base.size), roundup_pow_of_two(obj->base.size),
vaddr, dma); vaddr, dma);
return -ENOMEM; return -ENOMEM;
...@@ -129,7 +129,7 @@ i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj, ...@@ -129,7 +129,7 @@ i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj,
sg_free_table(pages); sg_free_table(pages);
kfree(pages); kfree(pages);
dma_free_coherent(&obj->base.dev->pdev->dev, dma_free_coherent(obj->base.dev->dev,
roundup_pow_of_two(obj->base.size), roundup_pow_of_two(obj->base.size),
vaddr, dma); vaddr, dma);
} }
......
...@@ -172,7 +172,7 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj) ...@@ -172,7 +172,7 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
max_segment = PAGE_SIZE; max_segment = PAGE_SIZE;
goto rebuild_st; goto rebuild_st;
} else { } else {
dev_warn(&i915->drm.pdev->dev, dev_warn(i915->drm.dev,
"Failed to DMA remap %lu pages\n", "Failed to DMA remap %lu pages\n",
page_count); page_count);
goto err_pages; goto err_pages;
......
...@@ -26,12 +26,12 @@ static int init_fake_lmem_bar(struct intel_memory_region *mem) ...@@ -26,12 +26,12 @@ static int init_fake_lmem_bar(struct intel_memory_region *mem)
if (ret) if (ret)
return ret; return ret;
mem->remap_addr = dma_map_resource(&i915->drm.pdev->dev, mem->remap_addr = dma_map_resource(i915->drm.dev,
mem->region.start, mem->region.start,
mem->fake_mappable.size, mem->fake_mappable.size,
PCI_DMA_BIDIRECTIONAL, PCI_DMA_BIDIRECTIONAL,
DMA_ATTR_FORCE_CONTIGUOUS); DMA_ATTR_FORCE_CONTIGUOUS);
if (dma_mapping_error(&i915->drm.pdev->dev, mem->remap_addr)) { if (dma_mapping_error(i915->drm.dev, mem->remap_addr)) {
drm_mm_remove_node(&mem->fake_mappable); drm_mm_remove_node(&mem->fake_mappable);
return -EINVAL; return -EINVAL;
} }
...@@ -56,7 +56,7 @@ static void release_fake_lmem_bar(struct intel_memory_region *mem) ...@@ -56,7 +56,7 @@ static void release_fake_lmem_bar(struct intel_memory_region *mem)
drm_mm_remove_node(&mem->fake_mappable); drm_mm_remove_node(&mem->fake_mappable);
dma_unmap_resource(&mem->i915->drm.pdev->dev, dma_unmap_resource(mem->i915->drm.dev,
mem->remap_addr, mem->remap_addr,
mem->fake_mappable.size, mem->fake_mappable.size,
PCI_DMA_BIDIRECTIONAL, PCI_DMA_BIDIRECTIONAL,
...@@ -104,7 +104,7 @@ static const struct intel_memory_region_ops intel_region_lmem_ops = { ...@@ -104,7 +104,7 @@ static const struct intel_memory_region_ops intel_region_lmem_ops = {
struct intel_memory_region * struct intel_memory_region *
intel_setup_fake_lmem(struct drm_i915_private *i915) intel_setup_fake_lmem(struct drm_i915_private *i915)
{ {
struct pci_dev *pdev = i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
struct intel_memory_region *mem; struct intel_memory_region *mem;
resource_size_t mappable_end; resource_size_t mappable_end;
resource_size_t io_start; resource_size_t io_start;
......
...@@ -819,7 +819,7 @@ static int i915_rps_boost_info(struct seq_file *m, void *data) ...@@ -819,7 +819,7 @@ static int i915_rps_boost_info(struct seq_file *m, void *data)
static int i915_runtime_pm_status(struct seq_file *m, void *unused) static int i915_runtime_pm_status(struct seq_file *m, void *unused)
{ {
struct drm_i915_private *dev_priv = node_to_i915(m->private); struct drm_i915_private *dev_priv = node_to_i915(m->private);
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
if (!HAS_RUNTIME_PM(dev_priv)) if (!HAS_RUNTIME_PM(dev_priv))
seq_puts(m, "Runtime power management not supported\n"); seq_puts(m, "Runtime power management not supported\n");
......
...@@ -91,7 +91,7 @@ static const struct drm_driver driver; ...@@ -91,7 +91,7 @@ static const struct drm_driver driver;
static int i915_get_bridge_dev(struct drm_i915_private *dev_priv) static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
{ {
int domain = pci_domain_nr(dev_priv->drm.pdev->bus); int domain = pci_domain_nr(to_pci_dev(dev_priv->drm.dev)->bus);
dev_priv->bridge_dev = dev_priv->bridge_dev =
pci_get_domain_bus_and_slot(domain, 0, PCI_DEVFN(0, 0)); pci_get_domain_bus_and_slot(domain, 0, PCI_DEVFN(0, 0));
...@@ -459,7 +459,6 @@ static void intel_sanitize_options(struct drm_i915_private *dev_priv) ...@@ -459,7 +459,6 @@ static void intel_sanitize_options(struct drm_i915_private *dev_priv)
*/ */
static int i915_set_dma_info(struct drm_i915_private *i915) static int i915_set_dma_info(struct drm_i915_private *i915)
{ {
struct pci_dev *pdev = i915->drm.pdev;
unsigned int mask_size = INTEL_INFO(i915)->dma_mask_size; unsigned int mask_size = INTEL_INFO(i915)->dma_mask_size;
int ret; int ret;
...@@ -469,9 +468,9 @@ static int i915_set_dma_info(struct drm_i915_private *i915) ...@@ -469,9 +468,9 @@ static int i915_set_dma_info(struct drm_i915_private *i915)
* We don't have a max segment size, so set it to the max so sg's * We don't have a max segment size, so set it to the max so sg's
* debugging layer doesn't complain * debugging layer doesn't complain
*/ */
dma_set_max_seg_size(&pdev->dev, UINT_MAX); dma_set_max_seg_size(i915->drm.dev, UINT_MAX);
ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(mask_size)); ret = dma_set_mask(i915->drm.dev, DMA_BIT_MASK(mask_size));
if (ret) if (ret)
goto mask_err; goto mask_err;
...@@ -491,7 +490,7 @@ static int i915_set_dma_info(struct drm_i915_private *i915) ...@@ -491,7 +490,7 @@ static int i915_set_dma_info(struct drm_i915_private *i915)
if (IS_I965G(i915) || IS_I965GM(i915)) if (IS_I965G(i915) || IS_I965GM(i915))
mask_size = 32; mask_size = 32;
ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(mask_size)); ret = dma_set_coherent_mask(i915->drm.dev, DMA_BIT_MASK(mask_size));
if (ret) if (ret)
goto mask_err; goto mask_err;
...@@ -511,7 +510,7 @@ static int i915_set_dma_info(struct drm_i915_private *i915) ...@@ -511,7 +510,7 @@ static int i915_set_dma_info(struct drm_i915_private *i915)
*/ */
static int i915_driver_hw_probe(struct drm_i915_private *dev_priv) static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
int ret; int ret;
if (i915_inject_probe_failure(dev_priv)) if (i915_inject_probe_failure(dev_priv))
...@@ -638,7 +637,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv) ...@@ -638,7 +637,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
*/ */
static void i915_driver_hw_remove(struct drm_i915_private *dev_priv) static void i915_driver_hw_remove(struct drm_i915_private *dev_priv)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
i915_perf_fini(dev_priv); i915_perf_fini(dev_priv);
...@@ -1091,7 +1090,7 @@ static int i915_drm_prepare(struct drm_device *dev) ...@@ -1091,7 +1090,7 @@ static int i915_drm_prepare(struct drm_device *dev)
static int i915_drm_suspend(struct drm_device *dev) static int i915_drm_suspend(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
pci_power_t opregion_target_state; pci_power_t opregion_target_state;
disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); disable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
...@@ -1148,7 +1147,7 @@ get_suspend_mode(struct drm_i915_private *dev_priv, bool hibernate) ...@@ -1148,7 +1147,7 @@ get_suspend_mode(struct drm_i915_private *dev_priv, bool hibernate)
static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation) static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
{ {
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; struct intel_runtime_pm *rpm = &dev_priv->runtime_pm;
int ret; int ret;
...@@ -1278,7 +1277,7 @@ static int i915_drm_resume(struct drm_device *dev) ...@@ -1278,7 +1277,7 @@ static int i915_drm_resume(struct drm_device *dev)
static int i915_drm_resume_early(struct drm_device *dev) static int i915_drm_resume_early(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
int ret; int ret;
/* /*
......
...@@ -1289,7 +1289,7 @@ static inline struct drm_i915_private *pdev_to_i915(struct pci_dev *pdev) ...@@ -1289,7 +1289,7 @@ static inline struct drm_i915_private *pdev_to_i915(struct pci_dev *pdev)
#define INTEL_DEVID(dev_priv) (RUNTIME_INFO(dev_priv)->device_id) #define INTEL_DEVID(dev_priv) (RUNTIME_INFO(dev_priv)->device_id)
#define REVID_FOREVER 0xff #define REVID_FOREVER 0xff
#define INTEL_REVID(dev_priv) ((dev_priv)->drm.pdev->revision) #define INTEL_REVID(dev_priv) (to_pci_dev((dev_priv)->drm.dev)->revision)
#define INTEL_GEN_MASK(s, e) ( \ #define INTEL_GEN_MASK(s, e) ( \
BUILD_BUG_ON_ZERO(!__builtin_constant_p(s)) + \ BUILD_BUG_ON_ZERO(!__builtin_constant_p(s)) + \
......
...@@ -28,7 +28,7 @@ int i915_gem_gtt_prepare_pages(struct drm_i915_gem_object *obj, ...@@ -28,7 +28,7 @@ int i915_gem_gtt_prepare_pages(struct drm_i915_gem_object *obj,
struct sg_table *pages) struct sg_table *pages)
{ {
do { do {
if (dma_map_sg_attrs(&obj->base.dev->pdev->dev, if (dma_map_sg_attrs(obj->base.dev->dev,
pages->sgl, pages->nents, pages->sgl, pages->nents,
PCI_DMA_BIDIRECTIONAL, PCI_DMA_BIDIRECTIONAL,
DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_SKIP_CPU_SYNC |
...@@ -63,8 +63,7 @@ void i915_gem_gtt_finish_pages(struct drm_i915_gem_object *obj, ...@@ -63,8 +63,7 @@ void i915_gem_gtt_finish_pages(struct drm_i915_gem_object *obj,
/* Wait a bit, in the hope it avoids the hang */ /* Wait a bit, in the hope it avoids the hang */
usleep_range(100, 250); usleep_range(100, 250);
dma_unmap_sg(&i915->drm.pdev->dev, dma_unmap_sg(i915->drm.dev, pages->sgl, pages->nents,
pages->sgl, pages->nents,
PCI_DMA_BIDIRECTIONAL); PCI_DMA_BIDIRECTIONAL);
} }
......
...@@ -12,6 +12,7 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data, ...@@ -12,6 +12,7 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_i915_private *i915 = to_i915(dev); struct drm_i915_private *i915 = to_i915(dev);
struct pci_dev *pdev = to_pci_dev(dev->dev);
const struct sseu_dev_info *sseu = &i915->gt.info.sseu; const struct sseu_dev_info *sseu = &i915->gt.info.sseu;
drm_i915_getparam_t *param = data; drm_i915_getparam_t *param = data;
int value; int value;
...@@ -24,10 +25,10 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data, ...@@ -24,10 +25,10 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data,
/* Reject all old ums/dri params. */ /* Reject all old ums/dri params. */
return -ENODEV; return -ENODEV;
case I915_PARAM_CHIPSET_ID: case I915_PARAM_CHIPSET_ID:
value = i915->drm.pdev->device; value = pdev->device;
break; break;
case I915_PARAM_REVISION: case I915_PARAM_REVISION:
value = i915->drm.pdev->revision; value = pdev->revision;
break; break;
case I915_PARAM_NUM_FENCES_AVAIL: case I915_PARAM_NUM_FENCES_AVAIL:
value = i915->ggtt.num_fences; value = i915->ggtt.num_fences;
......
...@@ -644,7 +644,7 @@ static void err_print_params(struct drm_i915_error_state_buf *m, ...@@ -644,7 +644,7 @@ static void err_print_params(struct drm_i915_error_state_buf *m,
static void err_print_pciid(struct drm_i915_error_state_buf *m, static void err_print_pciid(struct drm_i915_error_state_buf *m,
struct drm_i915_private *i915) struct drm_i915_private *i915)
{ {
struct pci_dev *pdev = i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
err_printf(m, "PCI ID: 0x%04x\n", pdev->device); err_printf(m, "PCI ID: 0x%04x\n", pdev->device);
err_printf(m, "PCI Revision: 0x%02x\n", pdev->revision); err_printf(m, "PCI Revision: 0x%02x\n", pdev->revision);
......
...@@ -4377,7 +4377,7 @@ static void intel_irq_postinstall(struct drm_i915_private *dev_priv) ...@@ -4377,7 +4377,7 @@ static void intel_irq_postinstall(struct drm_i915_private *dev_priv)
*/ */
int intel_irq_install(struct drm_i915_private *dev_priv) int intel_irq_install(struct drm_i915_private *dev_priv)
{ {
int irq = dev_priv->drm.pdev->irq; int irq = to_pci_dev(dev_priv->drm.dev)->irq;
int ret; int ret;
/* /*
...@@ -4412,7 +4412,7 @@ int intel_irq_install(struct drm_i915_private *dev_priv) ...@@ -4412,7 +4412,7 @@ int intel_irq_install(struct drm_i915_private *dev_priv)
*/ */
void intel_irq_uninstall(struct drm_i915_private *dev_priv) void intel_irq_uninstall(struct drm_i915_private *dev_priv)
{ {
int irq = dev_priv->drm.pdev->irq; int irq = to_pci_dev(dev_priv->drm.dev)->irq;
/* /*
* FIXME we can get called twice during driver probe * FIXME we can get called twice during driver probe
...@@ -4472,5 +4472,5 @@ bool intel_irqs_enabled(struct drm_i915_private *dev_priv) ...@@ -4472,5 +4472,5 @@ bool intel_irqs_enabled(struct drm_i915_private *dev_priv)
void intel_synchronize_irq(struct drm_i915_private *i915) void intel_synchronize_irq(struct drm_i915_private *i915)
{ {
synchronize_irq(i915->drm.pdev->irq); synchronize_irq(to_pci_dev(i915->drm.dev)->irq);
} }
...@@ -1124,7 +1124,7 @@ static void i915_pmu_unregister_cpuhp_state(struct i915_pmu *pmu) ...@@ -1124,7 +1124,7 @@ static void i915_pmu_unregister_cpuhp_state(struct i915_pmu *pmu)
static bool is_igp(struct drm_i915_private *i915) static bool is_igp(struct drm_i915_private *i915)
{ {
struct pci_dev *pdev = i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
/* IGP is 0000:00:02.0 */ /* IGP is 0000:00:02.0 */
return pci_domain_nr(pdev->bus) == 0 && return pci_domain_nr(pdev->bus) == 0 &&
......
...@@ -85,7 +85,7 @@ static void intel_restore_swf(struct drm_i915_private *dev_priv) ...@@ -85,7 +85,7 @@ static void intel_restore_swf(struct drm_i915_private *dev_priv)
void i915_save_display(struct drm_i915_private *dev_priv) void i915_save_display(struct drm_i915_private *dev_priv)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
/* Display arbitration control */ /* Display arbitration control */
if (INTEL_GEN(dev_priv) <= 4) if (INTEL_GEN(dev_priv) <= 4)
...@@ -100,7 +100,7 @@ void i915_save_display(struct drm_i915_private *dev_priv) ...@@ -100,7 +100,7 @@ void i915_save_display(struct drm_i915_private *dev_priv)
void i915_restore_display(struct drm_i915_private *dev_priv) void i915_restore_display(struct drm_i915_private *dev_priv)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
intel_restore_swf(dev_priv); intel_restore_swf(dev_priv);
......
...@@ -54,14 +54,14 @@ static const struct vga_switcheroo_client_ops i915_switcheroo_ops = { ...@@ -54,14 +54,14 @@ static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
int i915_switcheroo_register(struct drm_i915_private *i915) int i915_switcheroo_register(struct drm_i915_private *i915)
{ {
struct pci_dev *pdev = i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
return vga_switcheroo_register_client(pdev, &i915_switcheroo_ops, false); return vga_switcheroo_register_client(pdev, &i915_switcheroo_ops, false);
} }
void i915_switcheroo_unregister(struct drm_i915_private *i915) void i915_switcheroo_unregister(struct drm_i915_private *i915)
{ {
struct pci_dev *pdev = i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
vga_switcheroo_unregister_client(pdev); vga_switcheroo_unregister_client(pdev);
} }
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
*/ */
void intel_vgpu_detect(struct drm_i915_private *dev_priv) void intel_vgpu_detect(struct drm_i915_private *dev_priv)
{ {
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
u64 magic; u64 magic;
u16 version_major; u16 version_major;
void __iomem *shared_area; void __iomem *shared_area;
......
...@@ -205,7 +205,7 @@ void intel_device_info_subplatform_init(struct drm_i915_private *i915) ...@@ -205,7 +205,7 @@ void intel_device_info_subplatform_init(struct drm_i915_private *i915)
} }
if (IS_TIGERLAKE(i915)) { if (IS_TIGERLAKE(i915)) {
struct pci_dev *root, *pdev = i915->drm.pdev; struct pci_dev *root, *pdev = to_pci_dev(i915->drm.dev);
root = list_first_entry(&pdev->bus->devices, typeof(*root), bus_list); root = list_first_entry(&pdev->bus->devices, typeof(*root), bus_list);
......
...@@ -625,7 +625,7 @@ void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm) ...@@ -625,7 +625,7 @@ void intel_runtime_pm_init_early(struct intel_runtime_pm *rpm)
{ {
struct drm_i915_private *i915 = struct drm_i915_private *i915 =
container_of(rpm, struct drm_i915_private, runtime_pm); container_of(rpm, struct drm_i915_private, runtime_pm);
struct pci_dev *pdev = i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
struct device *kdev = &pdev->dev; struct device *kdev = &pdev->dev;
rpm->kdev = kdev; rpm->kdev = kdev;
......
...@@ -1780,7 +1780,7 @@ static int i915_pmic_bus_access_notifier(struct notifier_block *nb, ...@@ -1780,7 +1780,7 @@ static int i915_pmic_bus_access_notifier(struct notifier_block *nb,
static int uncore_mmio_setup(struct intel_uncore *uncore) static int uncore_mmio_setup(struct intel_uncore *uncore)
{ {
struct drm_i915_private *i915 = uncore->i915; struct drm_i915_private *i915 = uncore->i915;
struct pci_dev *pdev = i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
int mmio_bar; int mmio_bar;
int mmio_size; int mmio_size;
...@@ -1812,7 +1812,7 @@ static int uncore_mmio_setup(struct intel_uncore *uncore) ...@@ -1812,7 +1812,7 @@ static int uncore_mmio_setup(struct intel_uncore *uncore)
static void uncore_mmio_cleanup(struct intel_uncore *uncore) static void uncore_mmio_cleanup(struct intel_uncore *uncore)
{ {
struct pci_dev *pdev = uncore->i915->drm.pdev; struct pci_dev *pdev = to_pci_dev(uncore->i915->drm.dev);
pci_iounmap(pdev, uncore->regs); pci_iounmap(pdev, uncore->regs);
} }
......
...@@ -74,7 +74,7 @@ struct i915_ppgtt *mock_ppgtt(struct drm_i915_private *i915, const char *name) ...@@ -74,7 +74,7 @@ struct i915_ppgtt *mock_ppgtt(struct drm_i915_private *i915, const char *name)
ppgtt->vm.i915 = i915; ppgtt->vm.i915 = i915;
ppgtt->vm.total = round_down(U64_MAX, PAGE_SIZE); ppgtt->vm.total = round_down(U64_MAX, PAGE_SIZE);
ppgtt->vm.file = ERR_PTR(-ENODEV); ppgtt->vm.file = ERR_PTR(-ENODEV);
ppgtt->vm.dma = &i915->drm.pdev->dev; ppgtt->vm.dma = i915->drm.dev;
i915_address_space_init(&ppgtt->vm, VM_CLASS_PPGTT); i915_address_space_init(&ppgtt->vm, VM_CLASS_PPGTT);
......
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