Commit 531cdb9d authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/savage: Remove references to struct drm_device.pdev

Replace all references to struct drm_device's pdev field with
an upcast from dev.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210502104953.21768-5-tzimmermann@suse.de
parent aa96a16a
...@@ -547,6 +547,7 @@ static void savage_fake_dma_flush(drm_savage_private_t * dev_priv) ...@@ -547,6 +547,7 @@ static void savage_fake_dma_flush(drm_savage_private_t * dev_priv)
int savage_driver_load(struct drm_device *dev, unsigned long chipset) int savage_driver_load(struct drm_device *dev, unsigned long chipset)
{ {
struct pci_dev *pdev = to_pci_dev(dev->dev);
drm_savage_private_t *dev_priv; drm_savage_private_t *dev_priv;
dev_priv = kzalloc(sizeof(drm_savage_private_t), GFP_KERNEL); dev_priv = kzalloc(sizeof(drm_savage_private_t), GFP_KERNEL);
...@@ -557,7 +558,7 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -557,7 +558,7 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset)
dev_priv->chipset = (enum savage_family)chipset; dev_priv->chipset = (enum savage_family)chipset;
pci_set_master(dev->pdev); pci_set_master(pdev);
return 0; return 0;
} }
...@@ -572,16 +573,17 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -572,16 +573,17 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset)
int savage_driver_firstopen(struct drm_device *dev) int savage_driver_firstopen(struct drm_device *dev)
{ {
drm_savage_private_t *dev_priv = dev->dev_private; drm_savage_private_t *dev_priv = dev->dev_private;
struct pci_dev *pdev = to_pci_dev(dev->dev);
unsigned long mmio_base, fb_base, fb_size, aperture_base; unsigned long mmio_base, fb_base, fb_size, aperture_base;
int ret = 0; int ret = 0;
if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) {
fb_base = pci_resource_start(dev->pdev, 0); fb_base = pci_resource_start(pdev, 0);
fb_size = SAVAGE_FB_SIZE_S3; fb_size = SAVAGE_FB_SIZE_S3;
mmio_base = fb_base + SAVAGE_FB_SIZE_S3; mmio_base = fb_base + SAVAGE_FB_SIZE_S3;
aperture_base = fb_base + SAVAGE_APERTURE_OFFSET; aperture_base = fb_base + SAVAGE_APERTURE_OFFSET;
/* this should always be true */ /* this should always be true */
if (pci_resource_len(dev->pdev, 0) == 0x08000000) { if (pci_resource_len(pdev, 0) == 0x08000000) {
/* Don't make MMIO write-cobining! We need 3 /* Don't make MMIO write-cobining! We need 3
* MTRRs. */ * MTRRs. */
dev_priv->mtrr_handles[0] = dev_priv->mtrr_handles[0] =
...@@ -595,16 +597,16 @@ int savage_driver_firstopen(struct drm_device *dev) ...@@ -595,16 +597,16 @@ int savage_driver_firstopen(struct drm_device *dev)
} else { } else {
DRM_ERROR("strange pci_resource_len %08llx\n", DRM_ERROR("strange pci_resource_len %08llx\n",
(unsigned long long) (unsigned long long)
pci_resource_len(dev->pdev, 0)); pci_resource_len(pdev, 0));
} }
} else if (dev_priv->chipset != S3_SUPERSAVAGE && } else if (dev_priv->chipset != S3_SUPERSAVAGE &&
dev_priv->chipset != S3_SAVAGE2000) { dev_priv->chipset != S3_SAVAGE2000) {
mmio_base = pci_resource_start(dev->pdev, 0); mmio_base = pci_resource_start(pdev, 0);
fb_base = pci_resource_start(dev->pdev, 1); fb_base = pci_resource_start(pdev, 1);
fb_size = SAVAGE_FB_SIZE_S4; fb_size = SAVAGE_FB_SIZE_S4;
aperture_base = fb_base + SAVAGE_APERTURE_OFFSET; aperture_base = fb_base + SAVAGE_APERTURE_OFFSET;
/* this should always be true */ /* this should always be true */
if (pci_resource_len(dev->pdev, 1) == 0x08000000) { if (pci_resource_len(pdev, 1) == 0x08000000) {
/* Can use one MTRR to cover both fb and /* Can use one MTRR to cover both fb and
* aperture. */ * aperture. */
dev_priv->mtrr_handles[0] = dev_priv->mtrr_handles[0] =
...@@ -613,13 +615,13 @@ int savage_driver_firstopen(struct drm_device *dev) ...@@ -613,13 +615,13 @@ int savage_driver_firstopen(struct drm_device *dev)
} else { } else {
DRM_ERROR("strange pci_resource_len %08llx\n", DRM_ERROR("strange pci_resource_len %08llx\n",
(unsigned long long) (unsigned long long)
pci_resource_len(dev->pdev, 1)); pci_resource_len(pdev, 1));
} }
} else { } else {
mmio_base = pci_resource_start(dev->pdev, 0); mmio_base = pci_resource_start(pdev, 0);
fb_base = pci_resource_start(dev->pdev, 1); fb_base = pci_resource_start(pdev, 1);
fb_size = pci_resource_len(dev->pdev, 1); fb_size = pci_resource_len(pdev, 1);
aperture_base = pci_resource_start(dev->pdev, 2); aperture_base = pci_resource_start(pdev, 2);
/* Automatic MTRR setup will do the right thing. */ /* Automatic MTRR setup will do the right thing. */
} }
......
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