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 | eeeb40c6398c7a9d2b194038193d98e3d6068a2f (patch) | |
tree | 77336796ea85c47522c6c660878413f6095d59a5 /drm/nouveau/nvkm/engine/device/base.c | |
parent | 3429f5fd3a2e989f7c93e86ab7c6d8381162c011 (diff) | |
download | nouveau-eeeb40c6398c7a9d2b194038193d98e3d6068a2f.tar.gz |
device: cleaner abstraction for device resource functions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drm/nouveau/nvkm/engine/device/base.c')
-rw-r--r-- | drm/nouveau/nvkm/engine/device/base.c | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/drm/nouveau/nvkm/engine/device/base.c b/drm/nouveau/nvkm/engine/device/base.c index 5fab8384d..b8d46144e 100644 --- a/drm/nouveau/nvkm/engine/device/base.c +++ b/drm/nouveau/nvkm/engine/device/base.c @@ -2262,36 +2262,6 @@ fail: return ret; } -resource_size_t -nv_device_resource_start(struct nvkm_device *device, unsigned int bar) -{ - if (nv_device_is_pci(device)) { - return pci_resource_start(device->pdev, bar); - } else { - struct resource *res; - res = platform_get_resource(device->platformdev, - IORESOURCE_MEM, bar); - if (!res) - return 0; - return res->start; - } -} - -resource_size_t -nv_device_resource_len(struct nvkm_device *device, unsigned int bar) -{ - if (nv_device_is_pci(device)) { - return pci_resource_len(device->pdev, bar); - } else { - struct resource *res; - res = platform_get_resource(device->platformdev, - IORESOURCE_MEM, bar); - if (!res) - return 0; - return resource_size(res); - } -} - void nvkm_device_del(struct nvkm_device **pdevice) { @@ -2363,8 +2333,8 @@ nvkm_device_ctor(const struct nvkm_device_func *func, if (ret) goto done; - mmio_base = nv_device_resource_start(device, 0); - mmio_size = nv_device_resource_len(device, 0); + mmio_base = device->func->resource_addr(device, 0); + mmio_size = device->func->resource_size(device, 0); /* identify the chipset, and determine classes of subdev/engines */ if (detect) { |