drm/nouveau/device: add direct pointer to struct device
authorBen Skeggs <bskeggs@redhat.com>
Thu, 20 Aug 2015 04:54:06 +0000 (14:54 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 28 Aug 2015 02:40:06 +0000 (12:40 +1000)
A future commit will hide the platform/pci specifics from nvkm_device,
but it's still very useful in a lot of places to have access to the
Linux device struct.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c

index a3037f7d128d5ee8df2bd25d3894cc9f17e63a6d..d5811a0212bea734979318d5b6d0bbaffc6fad22 100644 (file)
@@ -9,6 +9,7 @@ struct nvkm_device {
 
        struct pci_dev *pdev;
        struct platform_device *platformdev;
+       struct device *dev;
        u64 handle;
 
        struct nvkm_event event;
index 2bceecc9c1e012f6b4f233cf7daf86a9bc409a10..28ebe06e87b937d617f6b2191118629d9e535b0d 100644 (file)
@@ -764,9 +764,11 @@ nvkm_device_create_(void *dev, enum nv_bus_type type, u64 name,
        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->handle = name;