diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 14:54:23 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-28 12:37:44 +1000 |
commit | e7c0675537839f171106a865f33861a27c9c00d7 (patch) | |
tree | 9feae1d0b418aae00a7e1f82e2eb4edc389b978d /drm/nouveau/nvkm/engine/device | |
parent | 8277f203aed51c802e1d580cb31c423e3b644265 (diff) | |
download | nouveau-e7c0675537839f171106a865f33861a27c9c00d7.tar.gz |
device: remove pci/platform_device from common struct
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drm/nouveau/nvkm/engine/device')
-rw-r--r-- | drm/nouveau/nvkm/engine/device/base.c | 14 | ||||
-rw-r--r-- | drm/nouveau/nvkm/engine/device/pci.c | 7 | ||||
-rw-r--r-- | drm/nouveau/nvkm/engine/device/priv.h | 2 | ||||
-rw-r--r-- | drm/nouveau/nvkm/engine/device/tegra.c | 5 | ||||
-rw-r--r-- | drm/nouveau/nvkm/engine/device/user.c | 24 |
5 files changed, 27 insertions, 25 deletions
diff --git a/drm/nouveau/nvkm/engine/device/base.c b/drm/nouveau/nvkm/engine/device/base.c index b8d46144e..94a906b8c 100644 --- a/drm/nouveau/nvkm/engine/device/base.c +++ b/drm/nouveau/nvkm/engine/device/base.c @@ -2294,7 +2294,7 @@ nvkm_device_del(struct nvkm_device **pdevice) int nvkm_device_ctor(const struct nvkm_device_func *func, const struct nvkm_device_quirk *quirk, - void *dev, enum nv_bus_type type, u64 handle, + struct device *dev, enum nvkm_device_type type, u64 handle, const char *name, const char *cfg, const char *dbg, bool detect, bool mmio, u64 subdev_mask, struct nvkm_device *device) @@ -2312,16 +2312,8 @@ nvkm_device_ctor(const struct nvkm_device_func *func, device->func = func; device->quirk = quirk; - switch (type) { - case NVKM_BUS_PCI: - device->pdev = dev; - device->dev = &device->pdev->dev; - break; - case NVKM_BUS_PLATFORM: - device->platformdev = dev; - device->dev = &device->platformdev->dev; - break; - } + device->dev = dev; + device->type = type; device->handle = handle; device->cfgopt = cfg; device->dbgopt = dbg; diff --git a/drm/nouveau/nvkm/engine/device/pci.c b/drm/nouveau/nvkm/engine/device/pci.c index 8702a9efc..9dd1cac81 100644 --- a/drm/nouveau/nvkm/engine/device/pci.c +++ b/drm/nouveau/nvkm/engine/device/pci.c @@ -1621,6 +1621,7 @@ nvkm_device_pci_func = { .fini = nvkm_device_pci_fini, .resource_addr = nvkm_device_pci_resource_addr, .resource_size = nvkm_device_pci_resource_size, + .cpu_coherent = !IS_ENABLED(CONFIG_ARM), }; int @@ -1671,8 +1672,10 @@ nvkm_device_pci_new(struct pci_dev *pci_dev, const char *cfg, const char *dbg, *pdevice = &pdev->device; pdev->pdev = pci_dev; - return nvkm_device_ctor(&nvkm_device_pci_func, quirk, - pci_dev, NVKM_BUS_PCI, + return nvkm_device_ctor(&nvkm_device_pci_func, quirk, &pci_dev->dev, + pci_is_pcie(pci_dev) ? NVKM_DEVICE_PCIE : + pci_find_capability(pci_dev, PCI_CAP_ID_AGP) ? + NVKM_DEVICE_AGP : NVKM_DEVICE_PCI, (u64)pci_domain_nr(pci_dev->bus) << 32 | pci_dev->bus->number << 16 | PCI_SLOT(pci_dev->devfn) << 8 | diff --git a/drm/nouveau/nvkm/engine/device/priv.h b/drm/nouveau/nvkm/engine/device/priv.h index 6dea6e8fc..ed3ad2c30 100644 --- a/drm/nouveau/nvkm/engine/device/priv.h +++ b/drm/nouveau/nvkm/engine/device/priv.h @@ -41,7 +41,7 @@ int nvkm_device_ctor(const struct nvkm_device_func *, const struct nvkm_device_quirk *, - void *, enum nv_bus_type type, u64 handle, + struct device *, enum nvkm_device_type, u64 handle, const char *name, const char *cfg, const char *dbg, bool detect, bool mmio, u64 subdev_mask, struct nvkm_device *); diff --git a/drm/nouveau/nvkm/engine/device/tegra.c b/drm/nouveau/nvkm/engine/device/tegra.c index f4bc11c16..ada73e13d 100644 --- a/drm/nouveau/nvkm/engine/device/tegra.c +++ b/drm/nouveau/nvkm/engine/device/tegra.c @@ -102,6 +102,7 @@ nvkm_device_tegra_func = { .fini = nvkm_device_tegra_fini, .resource_addr = nvkm_device_tegra_resource_addr, .resource_size = nvkm_device_tegra_resource_size, + .cpu_coherent = false, }; int @@ -118,8 +119,8 @@ nvkm_device_tegra_new(struct platform_device *pdev, tdev->pdev = pdev; tdev->irq = -1; - return nvkm_device_ctor(&nvkm_device_tegra_func, NULL, pdev, - NVKM_BUS_PLATFORM, pdev->id, NULL, + return nvkm_device_ctor(&nvkm_device_tegra_func, NULL, &pdev->dev, + NVKM_DEVICE_TEGRA, pdev->id, NULL, cfg, dbg, detect, mmio, subdev_mask, &tdev->device); } diff --git a/drm/nouveau/nvkm/engine/device/user.c b/drm/nouveau/nvkm/engine/device/user.c index eddf9b1d3..1ae48f270 100644 --- a/drm/nouveau/nvkm/engine/device/user.c +++ b/drm/nouveau/nvkm/engine/device/user.c @@ -70,16 +70,22 @@ nvkm_udevice_info(struct nvkm_udevice *udev, void *data, u32 size) args->v0.platform = NV_DEVICE_INFO_V0_IGP; break; default: - if (device->pdev) { - if (pci_find_capability(device->pdev, PCI_CAP_ID_AGP)) - args->v0.platform = NV_DEVICE_INFO_V0_AGP; - else - if (pci_is_pcie(device->pdev)) - args->v0.platform = NV_DEVICE_INFO_V0_PCIE; - else - args->v0.platform = NV_DEVICE_INFO_V0_PCI; - } else { + switch (device->type) { + case NVKM_DEVICE_PCI: + args->v0.platform = NV_DEVICE_INFO_V0_PCI; + break; + case NVKM_DEVICE_AGP: + args->v0.platform = NV_DEVICE_INFO_V0_AGP; + break; + case NVKM_DEVICE_PCIE: + args->v0.platform = NV_DEVICE_INFO_V0_PCIE; + break; + case NVKM_DEVICE_TEGRA: args->v0.platform = NV_DEVICE_INFO_V0_SOC; + break; + default: + WARN_ON(1); + break; } break; } |