drm: Implement and use Linux struct device
authorFrançois Tigeot <ftigeot@wolfpond.org>
Thu, 27 Oct 2016 18:43:18 +0000 (20:43 +0200)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Thu, 27 Oct 2016 18:57:05 +0000 (20:57 +0200)
39 files changed:
sys/dev/drm/drm_dragonfly.c
sys/dev/drm/drm_drv.c
sys/dev/drm/drm_fops.c
sys/dev/drm/drm_irq.c
sys/dev/drm/drm_pci.c
sys/dev/drm/drm_sysctl.c
sys/dev/drm/i915/i915_dma.c
sys/dev/drm/i915/i915_drv.c
sys/dev/drm/i915/i915_gem_gtt.c
sys/dev/drm/i915/intel_dp.c
sys/dev/drm/i915/intel_fbdev.c
sys/dev/drm/i915/intel_i2c.c
sys/dev/drm/i915/intel_opregion.c
sys/dev/drm/i915/intel_sdvo.c
sys/dev/drm/include/drm/drmP.h
sys/dev/drm/include/linux/device.h
sys/dev/drm/include/linux/i2c.h
sys/dev/drm/include/linux/pci.h
sys/dev/drm/include/linux/pwm.h
sys/dev/drm/radeon/cik.c
sys/dev/drm/radeon/evergreen.c
sys/dev/drm/radeon/ni.c
sys/dev/drm/radeon/r100.c
sys/dev/drm/radeon/r300.c
sys/dev/drm/radeon/r600.c
sys/dev/drm/radeon/radeon.h
sys/dev/drm/radeon/radeon_acpi.c
sys/dev/drm/radeon/radeon_bios.c
sys/dev/drm/radeon/radeon_device.c
sys/dev/drm/radeon/radeon_display.c
sys/dev/drm/radeon/radeon_fb.c
sys/dev/drm/radeon/radeon_gem.c
sys/dev/drm/radeon/radeon_i2c.c
sys/dev/drm/radeon/radeon_kms.c
sys/dev/drm/radeon/radeon_pm.c
sys/dev/drm/radeon/radeon_uvd.c
sys/dev/drm/radeon/radeon_vce.c
sys/dev/drm/radeon/rs600.c
sys/dev/drm/radeon/si.c

index ba7c61e..542e02e 100644 (file)
@@ -104,7 +104,7 @@ char *drm_asprintf(int flags, const char *format, ...)
 
 static void drm_fill_pdev(device_t dev, struct pci_dev *pdev)
 {
-       pdev->dev = dev;
+       pdev->dev.bsddev = dev;
        pdev->vendor = pci_get_vendor(dev);
        pdev->device = pci_get_device(dev);
        pdev->subsystem_vendor = pci_get_subvendor(dev);
@@ -170,7 +170,7 @@ static int drm_alloc_resource(struct drm_device *dev, int resource)
 
        DRM_UNLOCK(dev);
        rid = PCIR_BAR(resource);
-       res = bus_alloc_resource_any(dev->dev, SYS_RES_MEMORY, &rid,
+       res = bus_alloc_resource_any(dev->dev->bsddev, SYS_RES_MEMORY, &rid,
            RF_SHAREABLE);
        DRM_LOCK(dev);
        if (res == NULL) {
index b002f0f..bf5c909 100644 (file)
@@ -1000,16 +1000,19 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
        unit = device_get_unit(kdev);
        dev = device_get_softc(kdev);
 
+       /* Initialize Linux struct device */
+       dev->dev = kzalloc(sizeof(struct device), GFP_KERNEL);
+
        if (!strcmp(device_get_name(kdev), "drmsub"))
-               dev->dev = device_get_parent(kdev);
+               dev->dev->bsddev = device_get_parent(kdev);
        else
-               dev->dev = kdev;
+               dev->dev->bsddev = kdev;
 
-       dev->pci_domain = pci_get_domain(dev->dev);
-       dev->pci_bus = pci_get_bus(dev->dev);
-       dev->pci_slot = pci_get_slot(dev->dev);
-       dev->pci_func = pci_get_function(dev->dev);
-       drm_init_pdev(dev->dev, &dev->pdev);
+       dev->pci_domain = pci_get_domain(dev->dev->bsddev);
+       dev->pci_bus = pci_get_bus(dev->dev->bsddev);
+       dev->pci_slot = pci_get_slot(dev->dev->bsddev);
+       dev->pci_func = pci_get_function(dev->dev->bsddev);
+       drm_init_pdev(dev->dev->bsddev, &dev->pdev);
 
        id_entry = drm_find_description(dev->pdev->vendor,
            dev->pdev->device, idlist);
@@ -1018,10 +1021,10 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
        if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) {
                msi_enable = 1;
 
-               dev->irq_type = pci_alloc_1intr(dev->dev, msi_enable,
+               dev->irq_type = pci_alloc_1intr(dev->dev->bsddev, msi_enable,
                    &dev->irqrid, &irq_flags);
 
-               dev->irqr = bus_alloc_resource_any(dev->dev, SYS_RES_IRQ,
+               dev->irqr = bus_alloc_resource_any(dev->dev->bsddev, SYS_RES_IRQ,
                    &dev->irqrid, irq_flags);
 
                if (!dev->irqr) {
@@ -1051,11 +1054,11 @@ int drm_attach(device_t kdev, drm_pci_id_list_t *idlist)
        return (error);
 error:
        if (dev->irqr) {
-               bus_release_resource(dev->dev, SYS_RES_IRQ,
+               bus_release_resource(dev->dev->bsddev, SYS_RES_IRQ,
                    dev->irqrid, dev->irqr);
        }
        if (dev->irq_type == PCI_INTR_TYPE_MSI) {
-               pci_release_msi(dev->dev);
+               pci_release_msi(dev->dev->bsddev);
        }
        return (error);
 }
@@ -1141,7 +1144,7 @@ static int drm_load(struct drm_device *dev)
                /* Shared code returns -errno. */
                retcode = -dev->driver->load(dev,
                    dev->id_entry->driver_private);
-               if (pci_enable_busmaster(dev->dev))
+               if (pci_enable_busmaster(dev->dev->bsddev))
                        DRM_ERROR("Request to enable bus-master failed.\n");
                DRM_UNLOCK(dev);
                if (retcode != 0)
@@ -1221,7 +1224,7 @@ void drm_cdevpriv_dtor(void *cd)
         */
 
        atomic_inc(&dev->counts[_DRM_STAT_CLOSES]);
-       device_unbusy(dev->dev);
+       device_unbusy(dev->dev->bsddev);
        if (--dev->open_count == 0) {
                retcode = drm_lastclose(dev);
        }
index b13a946..8ea4927 100644 (file)
@@ -116,7 +116,7 @@ drm_open(struct dev_open_args *ap)
        if (retcode == 0) {
                atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
                DRM_LOCK(dev);
-               device_busy(dev->dev);
+               device_busy(dev->dev->bsddev);
                if (!dev->open_count++)
                        retcode = drm_setup(dev);
                DRM_UNLOCK(dev);
@@ -287,7 +287,7 @@ int drm_release(device_t kdev)
        for (i = 0; i < DRM_MAX_PCI_RESOURCE; i++) {
                if (dev->pcir[i] == NULL)
                        continue;
-               bus_release_resource(dev->dev, SYS_RES_MEMORY,
+               bus_release_resource(dev->dev->bsddev, SYS_RES_MEMORY,
                    dev->pcirid[i], dev->pcir[i]);
                dev->pcir[i] = NULL;
        }
@@ -303,7 +303,7 @@ int drm_release(device_t kdev)
                DRM_UNLOCK(dev);
        }
 
-       if (pci_disable_busmaster(dev->dev))
+       if (pci_disable_busmaster(dev->dev->bsddev))
                DRM_ERROR("Request to disable bus-master failed.\n");
 
        lockuninit(&dev->vbl_lock);
@@ -316,10 +316,10 @@ int drm_release(device_t kdev)
         */
 
        if (dev->irqr) {
-               bus_release_resource(dev->dev, SYS_RES_IRQ, dev->irqrid,
+               bus_release_resource(dev->dev->bsddev, SYS_RES_IRQ, dev->irqrid,
                    dev->irqr);
                if (dev->irq_type == PCI_INTR_TYPE_MSI) {
-                       pci_release_msi(dev->dev);
+                       pci_release_msi(dev->dev->bsddev);
                        DRM_INFO("MSI released\n");
                }
        }
index e3e564d..988e84d 100644 (file)
@@ -451,7 +451,7 @@ int drm_irq_install(struct drm_device *dev, int irq)
                dev->driver->irq_preinstall(dev);
 
        /* Install handler */
-       ret = -bus_setup_intr(dev->dev, dev->irqr, INTR_MPSAFE,
+       ret = -bus_setup_intr(dev->dev->bsddev, dev->irqr, INTR_MPSAFE,
            dev->driver->irq_handler, dev, &dev->irqh, &dev->irq_lock);
 
        if (ret != 0) {
@@ -465,7 +465,7 @@ int drm_irq_install(struct drm_device *dev, int irq)
 
        if (ret < 0) {
                dev->irq_enabled = false;
-               bus_teardown_intr(dev->dev, dev->irqr, dev->irqh);
+               bus_teardown_intr(dev->dev->bsddev, dev->irqr, dev->irqh);
        } else {
                dev->irq = irq;
        }
@@ -532,7 +532,7 @@ int drm_irq_uninstall(struct drm_device *dev)
        if (dev->driver->irq_uninstall)
                dev->driver->irq_uninstall(dev);
 
-       bus_teardown_intr(dev->dev, dev->irqr, dev->irqh);
+       bus_teardown_intr(dev->dev->bsddev, dev->irqr, dev->irqh);
 
        return 0;
 }
index 0756f00..6408f3d 100644 (file)
@@ -137,7 +137,7 @@ int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask)
 
        *mask = 0;
 
-       root = device_get_parent(dev->dev);
+       root = device_get_parent(dev->dev->bsddev);
 
        /* we've been informed via and serverworks don't make the cut */
        if (pci_get_vendor(root) == PCI_VENDOR_ID_VIA ||
index 97ce87e..98ee347 100644 (file)
@@ -71,7 +71,7 @@ int drm_sysctl_init(struct drm_device *dev)
                return 1;
        dev->sysctl = info;
 
-       unit = device_get_unit(dev->dev);
+       unit = device_get_unit(dev->dev->bsddev);
        if (unit > 9)
                return 1;
 
index ad46862..a7db681 100644 (file)
@@ -164,8 +164,8 @@ static int i915_get_bridge_dev(struct drm_device *dev)
        struct drm_i915_private *dev_priv = dev->dev_private;
        static struct pci_dev i915_bridge_dev;
 
-       i915_bridge_dev.dev = pci_find_dbsf(0, 0, 0, 0);
-       if (!i915_bridge_dev.dev) {
+       i915_bridge_dev.dev.bsddev = pci_find_dbsf(0, 0, 0, 0);
+       if (!i915_bridge_dev.dev.bsddev) {
                DRM_ERROR("bridge device not found\n");
                return -1;
        }
@@ -204,10 +204,10 @@ intel_alloc_mchbar_resource(struct drm_device *dev)
 #endif
 
        /* Get some space for it */
-       vga = device_get_parent(dev->dev);
+       vga = device_get_parent(dev->dev->bsddev);
        dev_priv->mch_res_rid = 0x100;
        dev_priv->mch_res = BUS_ALLOC_RESOURCE(device_get_parent(vga),
-           dev->dev, SYS_RES_MEMORY, &dev_priv->mch_res_rid, 0, ~0UL,
+           dev->dev->bsddev, SYS_RES_MEMORY, &dev_priv->mch_res_rid, 0, ~0UL,
            MCHBAR_SIZE, RF_ACTIVE | RF_SHAREABLE, -1);
        if (dev_priv->mch_res == NULL) {
                DRM_ERROR("failed mchbar resource alloc\n");
@@ -285,10 +285,10 @@ intel_teardown_mchbar(struct drm_device *dev)
        }
 
        if (dev_priv->mch_res != NULL) {
-               vga = device_get_parent(dev->dev);
-               BUS_DEACTIVATE_RESOURCE(device_get_parent(vga), dev->dev,
+               vga = device_get_parent(dev->dev->bsddev);
+               BUS_DEACTIVATE_RESOURCE(device_get_parent(vga), dev->dev->bsddev,
                    SYS_RES_MEMORY, dev_priv->mch_res_rid, dev_priv->mch_res);
-               BUS_RELEASE_RESOURCE(device_get_parent(vga), dev->dev,
+               BUS_RELEASE_RESOURCE(device_get_parent(vga), dev->dev->bsddev,
                    SYS_RES_MEMORY, dev_priv->mch_res_rid, dev_priv->mch_res);
                dev_priv->mch_res = NULL;
        }
index d155792..aababf8 100644 (file)
@@ -643,7 +643,7 @@ static int i915_drm_suspend(struct drm_device *dev)
 
        error = i915_gem_suspend(dev);
        if (error) {
-               dev_err(dev->pdev->dev,
+               dev_err(dev->dev,
                        "GEM idle failed, resume might fail\n");
                return error;
        }
index a29aa5d..3cf26df 100644 (file)
@@ -308,7 +308,7 @@ static gen6_pte_t iris_pte_encode(dma_addr_t addr,
 static int __setup_page_dma(struct drm_device *dev,
                            struct i915_page_dma *p, gfp_t flags)
 {
-       struct device *device = dev->pdev->dev;
+       struct device *device = dev->dev;
 
        p->page = alloc_page(flags);
        if (!p->page)
@@ -335,7 +335,7 @@ static void cleanup_page_dma(struct drm_device *dev, struct i915_page_dma *p)
        if (WARN_ON(!p->page))
                return;
 
-       dma_unmap_page(dev->pdev->dev, p->daddr, 4096, PCI_DMA_BIDIRECTIONAL);
+       dma_unmap_page(&dev->pdev->dev, p->daddr, 4096, PCI_DMA_BIDIRECTIONAL);
        __free_page(p->page);
        memset(p, 0, sizeof(*p));
 }
@@ -2340,7 +2340,7 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
 
 int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj)
 {
-       if (!dma_map_sg(obj->base.dev->pdev->dev,
+       if (!dma_map_sg(&obj->base.dev->pdev->dev,
                        obj->pages->sgl, obj->pages->nents,
                        PCI_DMA_BIDIRECTIONAL))
                return -ENOSPC;
@@ -2617,7 +2617,7 @@ void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj)
 
        interruptible = do_idling(dev_priv);
 
-       dma_unmap_sg(dev->pdev->dev, obj->pages->sgl, obj->pages->nents,
+       dma_unmap_sg(&dev->pdev->dev, obj->pages->sgl, obj->pages->nents,
                     PCI_DMA_BIDIRECTIONAL);
 
        undo_idling(dev_priv, interruptible);
@@ -2710,7 +2710,7 @@ static int i915_gem_setup_global_gtt(struct drm_device *dev,
        }
 
 #ifdef __DragonFly__
-       device_printf(dev->dev,
+       device_printf(dev->dev->bsddev,
            "taking over the fictitious range 0x%lx-0x%lx\n",
            dev_priv->gtt.mappable_base + start, dev_priv->gtt.mappable_base + start + mappable);
        error = -vm_phys_fictitious_reg_range(dev_priv->gtt.mappable_base + start,
index e80fe31..11effb7 100644 (file)
@@ -1208,7 +1208,7 @@ intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector)
 
        DRM_DEBUG_KMS("i2c_init %s\n", name);
 
-       ret = iic_dp_aux_add_bus(connector->base.dev->dev, name,
+       ret = iic_dp_aux_add_bus(connector->base.dev->dev->bsddev, name,
            intel_dp_i2c_aux_ch, intel_dp, &intel_dp->dp_iic_bus,
            &intel_dp->aux.ddc);
        WARN(ret, "intel_dp_i2c_init failed with error %d for port %c\n",
index e63fa7a..cb9cfe5 100644 (file)
@@ -235,7 +235,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
        ifbdev->helper.fb = fb;
 
 #ifdef __DragonFly__
-       vga_dev = device_get_parent(dev->dev);
+       vga_dev = device_get_parent(dev->dev->bsddev);
        info->width = sizes->fb_width;
        info->height = sizes->fb_height;
        info->stride = fb->pitches[0];
index a383643..ae4916b 100644 (file)
@@ -895,7 +895,7 @@ int intel_setup_gmbus(struct drm_device *dev)
                 * gmbus may decide to force quirk transfer in the
                 * attachment code.
                 */
-               dev_priv->bbbus_bridge[pin] = device_add_child(dev->dev,
+               dev_priv->bbbus_bridge[pin] = device_add_child(dev->dev->bsddev,
                    "intel_iicbb", pin);
                if (dev_priv->bbbus_bridge[pin] == NULL) {
                        DRM_ERROR("bbbus bridge %d creation failed\n", pin);
@@ -924,7 +924,7 @@ int intel_setup_gmbus(struct drm_device *dev)
 
                dev_priv->bbbus[pin] = iic_dev;
 
-               dev_priv->gmbus_bridge[pin] = device_add_child(dev->dev,
+               dev_priv->gmbus_bridge[pin] = device_add_child(dev->dev->bsddev,
                    "intel_gmbus", pin);
                if (dev_priv->gmbus_bridge[pin] == NULL) {
                        DRM_ERROR("gmbus bridge %d creation failed\n", pin);
index 07d1363..0050bc9 100644 (file)
@@ -679,7 +679,7 @@ static void intel_didl_outputs(struct drm_device *dev)
        u32 temp, max_outputs;
        int i = 0;
 
-       handle = acpi_get_handle(dev->dev);
+       handle = acpi_get_handle(dev->dev->bsddev);
        if (!handle)
                return;
 
index f7c9c5c..dab73a9 100644 (file)
@@ -2199,7 +2199,7 @@ static void intel_sdvo_enc_destroy(struct drm_encoder *encoder)
                drm_mode_destroy(encoder->dev,
                                 intel_sdvo->sdvo_lvds_fixed_mode);
 
-       device_delete_child(intel_sdvo->base.base.dev->dev,
+       device_delete_child(intel_sdvo->base.base.dev->dev->bsddev,
            intel_sdvo->ddc_iic_bus);
        intel_encoder_destroy(encoder);
 }
@@ -2985,7 +2985,7 @@ intel_sdvo_init_ddc_proxy(struct intel_sdvo *sdvo, struct drm_device *dev,
        struct intel_sdvo_ddc_proxy_sc *sc;
        int ret;
 
-       sdvo->ddc_iic_bus = device_add_child(dev->dev,
+       sdvo->ddc_iic_bus = device_add_child(dev->dev->bsddev,
            "intel_sdvo_ddc_proxy", sdvo_reg);
        if (sdvo->ddc_iic_bus == NULL) {
                DRM_ERROR("cannot create ddc proxy bus %d\n", sdvo_reg);
@@ -2996,7 +2996,7 @@ intel_sdvo_init_ddc_proxy(struct intel_sdvo *sdvo, struct drm_device *dev,
        if (ret != 0) {
                DRM_ERROR("cannot attach proxy bus %d error %d\n",
                    sdvo_reg, ret);
-               device_delete_child(dev->dev, sdvo->ddc_iic_bus);
+               device_delete_child(dev->dev->bsddev, sdvo->ddc_iic_bus);
                return (false);
        }
        sc = device_get_softc(sdvo->ddc_iic_bus);
index 85f1216..93bf2c9 100644 (file)
@@ -97,6 +97,7 @@
 #include <linux/mm.h>
 #include <linux/moduleparam.h>
 #include <linux/mutex.h>
+#include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/scatterlist.h>
 #include <linux/timer.h>
@@ -1239,7 +1240,7 @@ static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
                }
        }
 
-       return (pci_find_extcap(dev->dev, PCIY_AGP, NULL) == 0);
+       return (pci_find_extcap(dev->pdev->dev.bsddev, PCIY_AGP, NULL) == 0);
 }
 
 #define DRM_PCIE_SPEED_25 1
index 2588ce8..8edd08d 100644 (file)
 #ifndef        _LINUX_DEVICE_H_
 #define        _LINUX_DEVICE_H_
 
+#include <linux/list.h>
 #include <linux/lockdep.h>
+#include <linux/compiler.h>
+#include <linux/types.h>
+#include <linux/mutex.h>
+#include <linux/atomic.h>
+#include <linux/gfp.h>
+
+#include <sys/bus.h>
+
+struct device {
+       device_t        bsddev;
+};
 
 #define        dev_dbg(dev, fmt, ...)                                          \
-       device_printf((dev), "debug: " fmt, ## __VA_ARGS__)
+       device_printf((dev)->bsddev, "debug: " fmt, ## __VA_ARGS__)
 #define        dev_err(dev, fmt, ...)                                          \
-       device_printf((dev), "error: " fmt, ## __VA_ARGS__)
+       device_printf((dev)->bsddev, "error: " fmt, ## __VA_ARGS__)
 #define        dev_warn(dev, fmt, ...)                                         \
-       device_printf((dev), "warning: " fmt, ## __VA_ARGS__)
+       device_printf((dev)->bsddev, "warning: " fmt, ## __VA_ARGS__)
 #define        dev_info(dev, fmt, ...)                                         \
-       device_printf((dev), "info: " fmt, ## __VA_ARGS__)
+       device_printf((dev)->bsddev, "info: " fmt, ## __VA_ARGS__)
 #define        dev_printk(level, dev, fmt, ...)                                \
-       device_printf((dev), "%s: " fmt, level, ## __VA_ARGS__)
+       device_printf((dev)->bsddev, "%s: " fmt, level, ## __VA_ARGS__)
 
 #endif /* _LINUX_DEVICE_H_ */
index 61f8089..931ae81 100644 (file)
 #ifndef _LINUX_I2C_H_
 #define _LINUX_I2C_H_
 
-#include <sys/bus.h>
-#include <sys/bus_private.h>
-
-#include <linux/sched.h>
+#include <linux/mod_devicetable.h>
+#include <linux/device.h>      /* for struct device */
+#include <linux/sched.h>       /* for completion */
+#include <linux/mutex.h>
 
 #include <bus/iicbus/iic.h>
 #include <bus/iicbus/iiconf.h>
index fbfe5aa..0dd62cf 100644 (file)
@@ -60,7 +60,7 @@ struct pci_device_id {
 
 struct pci_dev {
        struct pci_bus *bus;            /* bus device is nailed to */
-       struct device *dev;             /* NOTE the star */
+       struct device dev;
 
        uint16_t vendor;                /* vendor ID */
        uint16_t device;                /* device ID */
@@ -94,42 +94,42 @@ struct pci_bus {
 static inline int
 pci_read_config_byte(struct pci_dev *pdev, int where, u8 *val)
 {
-       *val = (u16)pci_read_config(pdev->dev, where, 1);
+       *val = (u8)pci_read_config(pdev->dev.bsddev, where, 1);
        return 0;
 }
 
 static inline int
 pci_read_config_word(struct pci_dev *pdev, int where, u16 *val)
 {
-       *val = (u16)pci_read_config(pdev->dev, where, 2);
+       *val = (u16)pci_read_config(pdev->dev.bsddev, where, 2);
        return 0;
 }
 
 static inline int
 pci_read_config_dword(struct pci_dev *pdev, int where, u32 *val)
 {
-       *val = (u32)pci_read_config(pdev->dev, where, 4);
+       *val = (u32)pci_read_config(pdev->dev.bsddev, where, 4);
        return 0;
 }
 
 static inline int
 pci_write_config_byte(struct pci_dev *pdev, int where, u8 val)
 {
-       pci_write_config(pdev->dev, where, val, 1);
+       pci_write_config(pdev->dev.bsddev, where, val, 1);
        return 0;
 }
 
 static inline int
 pci_write_config_word(struct pci_dev *pdev, int where, u16 val)
 {
-       pci_write_config(pdev->dev, where, val, 2);
+       pci_write_config(pdev->dev.bsddev, where, val, 2);
        return 0;
 }
 
 static inline int
 pci_write_config_dword(struct pci_dev *pdev, int where, u32 val)
 {
-       pci_write_config(pdev->dev, where, val, 4);
+       pci_write_config(pdev->dev.bsddev, where, val, 4);
        return 0;
 }
 
@@ -140,11 +140,11 @@ pcie_get_readrq(struct pci_dev *pdev)
        u16 ctl;
        int err, cap;
 
-       err = pci_find_extcap(pdev->dev, PCIY_EXPRESS, &cap);
+       err = pci_find_extcap(pdev->dev.bsddev, PCIY_EXPRESS, &cap);
 
        cap += PCIER_DEVCTRL;
 
-       ctl = pci_read_config(pdev->dev, cap, 2);
+       ctl = pci_read_config(pdev->dev.bsddev, cap, 2);
 
        return 128 << ((ctl & PCIEM_DEVCTL_MAX_READRQ_MASK) >> 12);
 }
@@ -159,16 +159,16 @@ pcie_set_readrq(struct pci_dev *pdev, int rq)
        if (rq < 128 || rq > 4096 || !is_power_of_2(rq))
                return -EINVAL;
 
-       err = pci_find_extcap(pdev->dev, PCIY_EXPRESS, &cap);
+       err = pci_find_extcap(pdev->dev.bsddev, PCIY_EXPRESS, &cap);
        if (err)
                return (-1);
 
        cap += PCIER_DEVCTRL;
 
-       ctl = pci_read_config(pdev->dev, cap, 2);
+       ctl = pci_read_config(pdev->dev.bsddev, cap, 2);
        ctl &= ~PCIEM_DEVCTL_MAX_READRQ_MASK;
        ctl |= ((ffs(rq) - 8) << 12);
-       pci_write_config(pdev->dev, cap, ctl, 2);
+       pci_write_config(pdev->dev.bsddev, cap, ctl, 2);
        return 0;
 }
 
@@ -213,7 +213,7 @@ static inline struct resource_list_entry*
 _pci_get_rle(struct pci_dev *pdev, int bar)
 {
        struct pci_devinfo *dinfo;
-       struct device *dev = pdev->dev;
+       device_t dev = pdev->dev.bsddev;
        struct resource_list_entry *rle;
 
        dinfo = device_get_ivars(dev);
@@ -250,10 +250,9 @@ pci_resource_start(struct pci_dev *pdev, int bar)
        int rid;
 
        rid = PCIR_BAR(bar);
-       res = bus_alloc_resource_any(pdev->dev, SYS_RES_MEMORY, &rid, RF_SHAREABLE);
+       res = bus_alloc_resource_any(pdev->dev.bsddev, SYS_RES_MEMORY, &rid, RF_SHAREABLE);
        if (res == NULL) {
-               kprintf("pci_resource_start(0x%x, 0x%x) failed\n",
-                       pdev->device, PCIR_BAR(bar));
+               kprintf("pci_resource_start(0x%p, 0x%x) failed\n", pdev, PCIR_BAR(bar));
                return -1;
        }
 
index f2ccaba..a44aebb 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef _LINUX_PWM_H_
 #define _LINUX_PWM_H_
 
-#include <sys/bus.h>
+#include <linux/device.h>
 
 struct pwm_device;
 
index 6ad26a6..00dc512 100644 (file)
@@ -1971,10 +1971,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        DRM_INFO("Loading %s Microcode\n", new_chip_name);
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", new_chip_name);
-       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", chip_name);
-               err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->pfp_fw->datasize != pfp_req_size) {
@@ -1997,10 +1997,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", new_chip_name);
-       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", chip_name);
-               err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->me_fw->datasize != me_req_size) {
@@ -2022,10 +2022,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_ce", new_chip_name);
-       err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_ce", chip_name);
-               err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->ce_fw->datasize != ce_req_size) {
@@ -2047,10 +2047,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mec", new_chip_name);
-       err = request_firmware(&rdev->mec_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->mec_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mec", chip_name);
-               err = request_firmware(&rdev->mec_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->mec_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->mec_fw->datasize != mec_req_size) {
@@ -2073,7 +2073,7 @@ static int cik_init_microcode(struct radeon_device *rdev)
 
        if (rdev->family == CHIP_KAVERI) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mec2", new_chip_name);
-               err = request_firmware(&rdev->mec2_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->mec2_fw, fw_name, rdev->dev->bsddev);
                if (err) {
                        goto out;
                } else {
@@ -2087,10 +2087,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc", new_chip_name);
-       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc", chip_name);
-               err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->rlc_fw->datasize != rlc_req_size) {
@@ -2112,10 +2112,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_sdma", new_chip_name);
-       err = request_firmware(&rdev->sdma_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->sdma_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_sdma", chip_name);
-               err = request_firmware(&rdev->sdma_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->sdma_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->sdma_fw->datasize != sdma_req_size) {
@@ -2139,13 +2139,13 @@ static int cik_init_microcode(struct radeon_device *rdev)
        /* No SMC, MC ucode on APUs */
        if (!(rdev->flags & RADEON_IS_IGP)) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc", new_chip_name);
-               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
                if (err) {
                        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc2", chip_name);
-                       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
+                       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
                        if (err) {
                                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc", chip_name);
-                               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
+                               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
                                if (err)
                                        goto out;
                        }
@@ -2170,10 +2170,10 @@ static int cik_init_microcode(struct radeon_device *rdev)
                }
 
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", new_chip_name);
-               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
                if (err) {
                        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", chip_name);
-                       err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
+                       err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
                        if (err) {
                                printk(KERN_ERR
                                       "smc: error loading firmware \"%s\"\n",
@@ -5482,7 +5482,7 @@ static void cik_gpu_pci_config_reset(struct radeon_device *rdev)
                kv_save_regs_for_reset(rdev, &kv_save);
 
        /* disable BM */
-       pci_disable_busmaster(rdev->pdev->dev);
+       pci_disable_busmaster(rdev->pdev->dev.bsddev);
        /* reset */
        radeon_pci_config_reset(rdev);
 
@@ -7279,7 +7279,7 @@ static int cik_irq_init(struct radeon_device *rdev)
        /* force the active interrupt state to all disabled */
        cik_disable_interrupt_state(rdev);
 
-       pci_enable_busmaster(rdev->pdev->dev);
+       pci_enable_busmaster(rdev->pdev->dev.bsddev);
 
        /* enable irqs */
        cik_enable_interrupts(rdev);
@@ -9611,11 +9611,11 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev)
                DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n");
        }
 
-       bridge_pos = pci_get_pciecap_ptr(root->dev);
+       bridge_pos = pci_get_pciecap_ptr(root->dev.bsddev);
        if (!bridge_pos)
                return;
 
-       gpu_pos = pci_get_pciecap_ptr(rdev->pdev->dev);
+       gpu_pos = pci_get_pciecap_ptr(rdev->pdev->dev.bsddev);
        if (!gpu_pos)
                return;
 
index be749e4..298cc6a 100644 (file)
@@ -3875,7 +3875,7 @@ void evergreen_gpu_pci_config_reset(struct radeon_device *rdev)
        /* set mclk/sclk to bypass */
        rv770_set_clk_bypass_mode(rdev);
        /* disable BM */
-       pci_disable_busmaster(rdev->pdev->dev);
+       pci_disable_busmaster(rdev->pdev->dev.bsddev);
        /* disable mem access */
        evergreen_mc_stop(rdev, &save);
        if (evergreen_mc_wait_for_idle(rdev)) {
index 8cac7eb..e2e4148 100644 (file)
@@ -728,7 +728,7 @@ int ni_init_microcode(struct radeon_device *rdev)
        DRM_INFO("Loading %s Microcode\n", chip_name);
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", chip_name);
-       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
        if (err)
                goto out;
        if (rdev->pfp_fw->datasize != pfp_req_size) {
@@ -740,7 +740,7 @@ int ni_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", chip_name);
-       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
        if (err)
                goto out;
        if (rdev->me_fw->datasize != me_req_size) {
@@ -752,7 +752,7 @@ int ni_init_microcode(struct radeon_device *rdev)
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc",
                  rlc_chip_name);
-       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
        if (err)
                goto out;
        if (rdev->rlc_fw->datasize != rlc_req_size) {
@@ -765,7 +765,7 @@ int ni_init_microcode(struct radeon_device *rdev)
        /* no MC ucode on TN */
        if (!(rdev->flags & RADEON_IS_IGP)) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc", chip_name);
-               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->mc_fw->datasize != mc_req_size) {
@@ -778,7 +778,7 @@ int ni_init_microcode(struct radeon_device *rdev)
 
        if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", chip_name);
-               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
                if (err) {
                        printk(KERN_ERR
                               "smc: error loading firmware \"%s\"\n",
index 816c162..86a1990 100644 (file)
@@ -1025,7 +1025,7 @@ static int r100_cp_init_microcode(struct radeon_device *rdev)
                fw_name = FIRMWARE_R520;
        }
 
-       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                printk(KERN_ERR "radeon_cp: Failed to load firmware \"%s\"\n",
                       fw_name);
@@ -1206,7 +1206,7 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size)
        WREG32(RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIBM_INDBM);
 
        /* at this point everything should be setup correctly to enable master */
-       pci_enable_busmaster(rdev->dev);
+       pci_enable_busmaster(rdev->dev->bsddev);
 
        radeon_ring_start(rdev, RADEON_RING_TYPE_GFX_INDEX, &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]);
        r = radeon_ring_test(rdev, RADEON_RING_TYPE_GFX_INDEX, ring);
@@ -2561,7 +2561,7 @@ void r100_bm_disable(struct radeon_device *rdev)
        WREG32(R_000030_BUS_CNTL, (tmp & 0xFFFFFFFF) | 0x00000040);
        tmp = RREG32(RADEON_BUS_CNTL);
        mdelay(1);
-       pci_disable_busmaster(rdev->dev);
+       pci_disable_busmaster(rdev->dev->bsddev);
        mdelay(1);
 }
 
@@ -2586,7 +2586,7 @@ int r100_asic_reset(struct radeon_device *rdev)
        WREG32(RADEON_CP_RB_WPTR, 0);
        WREG32(RADEON_CP_RB_CNTL, tmp);
        /* save PCI state */
-       pci_save_state(device_get_parent(rdev->dev));
+       pci_save_state(device_get_parent(rdev->dev->bsddev));
        /* disable bus mastering */
        r100_bm_disable(rdev);
        WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_SE(1) |
@@ -2608,7 +2608,7 @@ int r100_asic_reset(struct radeon_device *rdev)
        status = RREG32(R_000E40_RBBM_STATUS);
        dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status);
        /* restore PCI & busmastering */
-       pci_restore_state(device_get_parent(rdev->dev));
+       pci_restore_state(device_get_parent(rdev->dev->bsddev));
        r100_enable_bm(rdev);
        /* Check if GPU is idle */
        if (G_000E40_SE_BUSY(status) || G_000E40_RE_BUSY(status) ||
@@ -2765,7 +2765,7 @@ static u32 r100_get_accessible_vram(struct radeon_device *rdev)
         * check if it's a multifunction card by reading the PCI config
         * header type... Limit those to one aperture size
         */
-       byte = pci_read_config(rdev->dev, 0xe, 1);
+       byte = pci_read_config(rdev->dev->bsddev, 0xe, 1);
        if (byte & 0x80) {
                DRM_INFO("Generation 1 PCI interface in multifunction mode\n");
                DRM_INFO("Limiting VRAM to one aperture\n");
index dea69d2..c591aaf 100644 (file)
@@ -399,7 +399,7 @@ int r300_asic_reset(struct radeon_device *rdev)
        WREG32(RADEON_CP_RB_WPTR, 0);
        WREG32(RADEON_CP_RB_CNTL, tmp);
        /* save PCI state */
-       pci_save_state(device_get_parent(rdev->dev));
+       pci_save_state(device_get_parent(rdev->dev->bsddev));
        /* disable bus mastering */
        r100_bm_disable(rdev);
        WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_VAP(1) |
@@ -423,7 +423,7 @@ int r300_asic_reset(struct radeon_device *rdev)
        status = RREG32(R_000E40_RBBM_STATUS);
        dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status);
        /* restore PCI & busmastering */
-       pci_restore_state(device_get_parent(rdev->dev));
+       pci_restore_state(device_get_parent(rdev->dev->bsddev));
        r100_enable_bm(rdev);
        /* Check if GPU is idle */
        if (G_000E40_GA_BUSY(status) || G_000E40_VAP_BUSY(status)) {
index 426de86..df528a1 100644 (file)
@@ -1769,7 +1769,7 @@ static void r600_gpu_pci_config_reset(struct radeon_device *rdev)
        if (rdev->family >= CHIP_RV770)
                rv770_set_clk_bypass_mode(rdev);
        /* disable BM */
-       pci_disable_busmaster(rdev->pdev->dev);
+       pci_disable_busmaster(rdev->pdev->dev.bsddev);
        /* disable mem access */
        rv515_mc_stop(rdev, &save);
        if (r600_mc_wait_for_idle(rdev)) {
@@ -2466,7 +2466,7 @@ int r600_init_microcode(struct radeon_device *rdev)
        DRM_INFO("Loading %s Microcode\n", chip_name);
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", chip_name);
-       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
        if (err)
                goto out;
        if (rdev->pfp_fw->datasize != pfp_req_size) {
@@ -2478,7 +2478,7 @@ int r600_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", chip_name);
-       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
        if (err)
                goto out;
        if (rdev->me_fw->datasize != me_req_size) {
@@ -2489,7 +2489,7 @@ int r600_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc", rlc_chip_name);
-       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
        if (err)
                goto out;
        if (rdev->rlc_fw->datasize != rlc_req_size) {
@@ -2501,7 +2501,7 @@ int r600_init_microcode(struct radeon_device *rdev)
 
        if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", smc_chip_name);
-               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
                if (err) {
                        printk(KERN_ERR
                               "smc: error loading firmware \"%s\"\n",
@@ -3651,7 +3651,7 @@ int r600_irq_init(struct radeon_device *rdev)
                r600_disable_interrupt_state(rdev);
 
        /* at this point everything should be setup correctly to enable master */
-       pci_enable_busmaster(rdev->dev);
+       pci_enable_busmaster(rdev->dev->bsddev);
 
        /* enable irqs */
        r600_enable_interrupts(rdev);
index 2a4e5af..e3a4a94 100644 (file)
@@ -1044,7 +1044,7 @@ struct radeon_cs_chunk {
 };
 
 struct radeon_cs_parser {
-       device_t                dev;
+       struct device           *dev;
        struct radeon_device    *rdev;
        struct drm_file         *filp;
        /* chunks */
@@ -2253,7 +2253,7 @@ typedef uint32_t (*radeon_rreg_t)(struct radeon_device*, uint32_t);
 typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t);
 
 struct radeon_device {
-       device_t                        dev;
+       struct device                   *dev;
        struct drm_device               *ddev;
        struct pci_dev                  *pdev;
        struct lock                     exclusive_lock;
index fc5cc15..f8b6b57 100644 (file)
@@ -692,7 +692,7 @@ int radeon_acpi_init(struct radeon_device *rdev)
        int ret;
 
        /* Get the device handle */
-       handle = acpi_get_handle(rdev->dev);
+       handle = acpi_get_handle(rdev->dev->bsddev);
 
        /* No need to proceed if we're sure that ATIF is not supported */
        if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle)
index 0665cec..64cac56 100644 (file)
@@ -83,7 +83,7 @@ static bool radeon_read_bios(struct radeon_device *rdev)
 
        DRM_INFO("%s: ===> Try PCI Expansion ROM...\n", __func__);
 
-       vga_dev = device_get_parent(rdev->dev);
+       vga_dev = device_get_parent(rdev->dev->bsddev);
        rdev->bios = NULL;
        /* XXX: some cards may return 0 for rom size? ddx has a workaround */
        bios = vga_pci_map_bios(vga_dev, &size);
index 8cda5a5..7fd3d4e 100644 (file)
@@ -1253,7 +1253,7 @@ int radeon_device_init(struct radeon_device *rdev,
 #endif
 
        rdev->shutdown = false;
-       rdev->dev = pdev->dev;
+       rdev->dev = &pdev->dev;
        rdev->ddev = ddev;
        rdev->pdev = pdev;
        rdev->flags = flags;
@@ -1374,7 +1374,7 @@ int radeon_device_init(struct radeon_device *rdev,
        } else {
                rdev->rmmio_rid = PCIR_BAR(2);
        }
-       rdev->rmmio = bus_alloc_resource_any(rdev->dev, SYS_RES_MEMORY,
+       rdev->rmmio = bus_alloc_resource_any(rdev->dev->bsddev, SYS_RES_MEMORY,
            &rdev->rmmio_rid, RF_ACTIVE | RF_SHAREABLE);
        if (rdev->rmmio == NULL) {
                return -ENOMEM;
@@ -1392,10 +1392,10 @@ int radeon_device_init(struct radeon_device *rdev,
        for (i = 0; i < DRM_MAX_PCI_RESOURCE; i++) {
                uint32_t data;
 
-               data = pci_read_config(rdev->dev, PCIR_BAR(i), 4);
+               data = pci_read_config(rdev->dev->bsddev, PCIR_BAR(i), 4);
                if (PCI_BAR_IO(data)) {
                        rdev->rio_rid = PCIR_BAR(i);
-                       rdev->rio_mem = bus_alloc_resource_any(rdev->dev,
+                       rdev->rio_mem = bus_alloc_resource_any(rdev->dev->bsddev,
                            SYS_RES_IOPORT, &rdev->rio_rid,
                            RF_ACTIVE | RF_SHAREABLE);
                        break;
@@ -1422,7 +1422,7 @@ int radeon_device_init(struct radeon_device *rdev,
                runtime = true;
        vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime);
        if (runtime)
-               vga_switcheroo_init_domain_pm_ops(rdev->dev, &rdev->vga_pm_domain);
+               vga_switcheroo_init_domain_pm_ops(rdev->dev->bsddev, &rdev->vga_pm_domain);
 #endif
 #endif /* DUMBBELL_WIP */
 
@@ -1533,10 +1533,10 @@ void radeon_device_fini(struct radeon_device *rdev)
        }
 
        if (rdev->rio_mem)
-               bus_release_resource(rdev->dev, SYS_RES_IOPORT, rdev->rio_rid,
+               bus_release_resource(rdev->dev->bsddev, SYS_RES_IOPORT, rdev->rio_rid,
                    rdev->rio_mem);
        rdev->rio_mem = NULL;
-       bus_release_resource(rdev->dev, SYS_RES_MEMORY, rdev->rmmio_rid,
+       bus_release_resource(rdev->dev->bsddev, SYS_RES_MEMORY, rdev->rmmio_rid,
            rdev->rmmio);
        rdev->rmmio = NULL;
        if (rdev->family >= CHIP_BONAIRE)
@@ -1622,13 +1622,13 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon)
 
        radeon_agp_suspend(rdev);
 
-       pci_save_state(device_get_parent(rdev->dev));
+       pci_save_state(device_get_parent(rdev->dev->bsddev));
 #ifdef DUMBBELL_WIP
        if (suspend) {
                /* Shut down the device */
                pci_disable_device(dev->pdev);
 #endif /* DUMBBELL_WIP */
-               pci_set_powerstate(dev->dev, PCI_POWERSTATE_D3);
+               pci_set_powerstate(dev->dev->bsddev, PCI_POWERSTATE_D3);
 #ifdef DUMBBELL_WIP
        }
 #endif
@@ -1668,8 +1668,8 @@ int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon)
        }
 #endif /* DUMBBELL_WIP */
        if (resume) {
-               pci_set_powerstate(dev->dev, PCI_POWERSTATE_D0);
-               pci_restore_state(device_get_parent(rdev->dev));
+               pci_set_powerstate(dev->dev->bsddev, PCI_POWERSTATE_D0);
+               pci_restore_state(device_get_parent(rdev->dev->bsddev));
 #ifdef DUMBBELL_WIP
                if (pci_enable_device(dev->pdev)) {
                        if (fbcon)
index 0896117..938a76c 100644 (file)
@@ -1320,7 +1320,7 @@ radeon_user_framebuffer_create(struct drm_device *dev,
 
        obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handles[0]);
        if (obj ==  NULL) {
-               dev_err(dev->pdev->dev, "No GEM object associated to handle 0x%08X, "
+               dev_err(&dev->pdev->dev, "No GEM object associated to handle 0x%08X, "
                        "can't create framebuffer\n", mode_cmd->handles[0]);
                return ERR_PTR(-ENOENT);
        }
index 8a9d23c..d4ba1d7 100644 (file)
@@ -199,7 +199,7 @@ static int radeonfb_create(struct drm_fb_helper *helper,
 #ifdef DUMBBELL_WIP
        device_t device = rdev->dev;
 #endif /* DUMBBELL_WIP */
-       device_t vga_dev = device_get_parent(rdev->dev);
+       device_t vga_dev = device_get_parent(rdev->dev->bsddev);
        int ret;
        unsigned long tmp;
 
index a127775..a3c934e 100644 (file)
@@ -455,7 +455,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
        }
 
        if (args->offset < RADEON_VA_RESERVED_SIZE) {
-               dev_err(dev->pdev->dev,
+               dev_err(&dev->pdev->dev,
                        "offset 0x%lX is in reserved area 0x%X\n",
                        (unsigned long)args->offset,
                        RADEON_VA_RESERVED_SIZE);
@@ -469,7 +469,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
         */
        invalid_flags = RADEON_VM_PAGE_VALID | RADEON_VM_PAGE_SYSTEM;
        if ((args->flags & invalid_flags)) {
-               dev_err(dev->pdev->dev, "invalid flags 0x%08X vs 0x%08X\n",
+               dev_err(&dev->pdev->dev, "invalid flags 0x%08X vs 0x%08X\n",
                        args->flags, invalid_flags);
                args->operation = RADEON_VA_RESULT_ERROR;
                return -EINVAL;
@@ -480,7 +480,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
        case RADEON_VA_UNMAP:
                break;
        default:
-               dev_err(dev->pdev->dev, "unsupported operation %d\n",
+               dev_err(&dev->pdev->dev, "unsupported operation %d\n",
                        args->operation);
                args->operation = RADEON_VA_RESULT_ERROR;
                return -EINVAL;
index 1c78658..a068e8c 100644 (file)
@@ -1071,7 +1071,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
                /* set the radeon hw i2c adapter */
                ksnprintf(i2c->name, sizeof(i2c->name),
                          "Radeon i2c hw bus %s", name);
-               iicbus_dev = device_add_child(dev->dev, "radeon_hw_i2c", -1);
+               iicbus_dev = device_add_child(dev->dev->bsddev, "radeon_hw_i2c", -1);
                if (iicbus_dev == NULL) {
                        DRM_ERROR("Failed to create bridge for hw i2c %s\n",
                            name);
@@ -1084,14 +1084,14 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
                if (ret != 0) {
                        DRM_ERROR("Attach failed for bridge for hw i2c %s\n",
                            name);
-                       device_delete_child(dev->dev, iicbus_dev);
+                       device_delete_child(dev->dev->bsddev, iicbus_dev);
                        goto out_free;
                }
 
                i2c->adapter = device_find_child(iicbus_dev, "iicbus", -1);
                if (i2c->adapter == NULL) {
                        DRM_ERROR("hw i2c bridge doesn't have iicbus child\n");
-                       device_delete_child(dev->dev, iicbus_dev);
+                       device_delete_child(dev->dev->bsddev, iicbus_dev);
                        goto out_free;
                }
        } else if (rec->hw_capable &&
@@ -1100,7 +1100,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
                /* hw i2c using atom */
                ksnprintf(i2c->name, sizeof(i2c->name),
                          "Radeon i2c hw bus %s", name);
-               iicbus_dev = device_add_child(dev->dev, "radeon_atom_hw_i2c", -1);
+               iicbus_dev = device_add_child(dev->dev->bsddev, "radeon_atom_hw_i2c", -1);
                if (iicbus_dev == NULL) {
                        DRM_ERROR("Failed to create bridge for hw i2c %s\n",
                            name);
@@ -1113,14 +1113,14 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
                if (ret != 0) {
                        DRM_ERROR("Attach failed for bridge for hw i2c %s\n",
                            name);
-                       device_delete_child(dev->dev, iicbus_dev);
+                       device_delete_child(dev->dev->bsddev, iicbus_dev);
                        goto out_free;
                }
 
                i2c->adapter = device_find_child(iicbus_dev, "iicbus", -1);
                if (i2c->adapter == NULL) {
                        DRM_ERROR("hw i2c bridge doesn't have iicbus child\n");
-                       device_delete_child(dev->dev, iicbus_dev);
+                       device_delete_child(dev->dev->bsddev, iicbus_dev);
                        goto out_free;
                }
        } else {
@@ -1129,7 +1129,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
                /* set the radeon bit adapter */
                ksnprintf(i2c->name, sizeof(i2c->name),
                          "Radeon i2c bit bus %s", name);
-               iicbus_dev = device_add_child(dev->dev, "radeon_iicbb", -1);
+               iicbus_dev = device_add_child(dev->dev->bsddev, "radeon_iicbb", -1);
                if (iicbus_dev == NULL) {
                        DRM_ERROR("Failed to create bridge for bb i2c %s\n",
                            name);
@@ -1142,14 +1142,14 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
                if (ret != 0) {
                        DRM_ERROR("Attach failed for bridge for bb i2c %s\n",
                            name);
-                       device_delete_child(dev->dev, iicbus_dev);
+                       device_delete_child(dev->dev->bsddev, iicbus_dev);
                        goto out_free;
                }
 
                iicbb_dev = device_find_child(iicbus_dev, "iicbb", -1);
                if (iicbb_dev == NULL) {
                        DRM_ERROR("bb i2c bridge doesn't have iicbb child\n");
-                       device_delete_child(dev->dev, iicbus_dev);
+                       device_delete_child(dev->dev->bsddev, iicbus_dev);
                        goto out_free;
                }
 
@@ -1157,7 +1157,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
                if (i2c->adapter == NULL) {
                        DRM_ERROR(
                            "bbbus bridge doesn't have iicbus grandchild\n");
-                       device_delete_child(dev->dev, iicbus_dev);
+                       device_delete_child(dev->dev->bsddev, iicbus_dev);
                        goto out_free;
                }
        }
@@ -1188,7 +1188,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
        i2c->rec = *rec;
        i2c->dev = dev;
        ksnprintf(i2c->name, sizeof(i2c->name), "Radeon aux bus %s", name);
-       ret = iic_dp_aux_add_bus(dev->dev, i2c->name,
+       ret = iic_dp_aux_add_bus(dev->dev->bsddev, i2c->name,
            radeon_dp_i2c_aux_ch, i2c, &i2c->iic_bus,
            &i2c->adapter);
        if (ret) {
@@ -1211,7 +1211,7 @@ void radeon_i2c_destroy(struct radeon_i2c_chan *i2c)
                int ret;
 
                get_mplock();
-               ret = device_delete_child(i2c->dev->dev, i2c->iic_bus);
+               ret = device_delete_child(i2c->dev->dev->bsddev, i2c->iic_bus);
                rel_mplock();
                KASSERT(ret == 0, ("unable to detach iic bus %s: %d",
                    i2c->name, ret));
index 56c1217..b7bc607 100644 (file)
@@ -109,7 +109,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
        if (drm_pci_device_is_agp(dev)) {
                DRM_INFO("RADEON_IS_AGP\n");
                flags |= RADEON_IS_AGP;
-       } else if (pci_is_pcie(dev->dev)) {
+       } else if (pci_is_pcie(dev->dev->bsddev)) {
                DRM_INFO("RADEON_IS_PCIE\n");
                flags |= RADEON_IS_PCIE;
        } else {
@@ -131,7 +131,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
         */
        r = radeon_device_init(rdev, dev, dev->pdev, flags);
        if (r) {
-               dev_err(dev->pdev->dev, "Fatal error during GPU init\n");
+               dev_err(&dev->pdev->dev, "Fatal error during GPU init\n");
                goto out;
        }
 
@@ -141,7 +141,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
         */
        r = radeon_modeset_init(rdev);
        if (r)
-               dev_err(dev->pdev->dev, "Fatal error during modeset init\n");
+               dev_err(&dev->pdev->dev, "Fatal error during modeset init\n");
 
        /* Call ACPI methods: require modeset init
         * but failure is not fatal
@@ -149,7 +149,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
        if (!r) {
                acpi_status = radeon_acpi_init(rdev);
                if (acpi_status)
-               dev_dbg(dev->pdev->dev,
+               dev_dbg(&dev->pdev->dev,
                                "Error during ACPI methods call\n");
        }
 
index 2ceac83..6b8bf49 100644 (file)
@@ -702,7 +702,7 @@ static int radeon_hwmon_init(struct radeon_device *rdev)
                    sizeof(*rdev->pm.int_sensordev), M_DRM,
                    M_ZERO | M_WAITOK);
                strlcpy(rdev->pm.int_sensordev->xname,
-                   device_get_nameunit(rdev->dev),
+                   device_get_nameunit(rdev->dev->bsddev),
                    sizeof(rdev->pm.int_sensordev->xname));
                rdev->pm.int_sensor->type = SENSOR_TEMP;
                rdev->pm.int_sensor->flags |= SENSOR_FINVALID;
index 096420f..d882b3f 100644 (file)
@@ -129,7 +129,7 @@ int radeon_uvd_init(struct radeon_device *rdev)
                return -EINVAL;
        }
 
-       r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev);
+       r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev->bsddev);
        if (r) {
                dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n",
                        fw_name);
index 026d6ed..d47c49e 100644 (file)
@@ -74,7 +74,7 @@ int radeon_vce_init(struct radeon_device *rdev)
                return -EINVAL;
        }
 
-       r = request_firmware(&rdev->vce_fw, fw_name, rdev->dev);
+       r = request_firmware(&rdev->vce_fw, fw_name, rdev->dev->bsddev);
        if (r) {
                dev_err(rdev->dev, "radeon_vce: Can't load firmware \"%s\"\n",
                        fw_name);
index 94a1e85..90e84f5 100644 (file)
@@ -463,9 +463,9 @@ int rs600_asic_reset(struct radeon_device *rdev)
        WREG32(RADEON_CP_RB_RPTR_WR, 0);
        WREG32(RADEON_CP_RB_WPTR, 0);
        WREG32(RADEON_CP_RB_CNTL, tmp);
-       pci_save_state(device_get_parent(rdev->dev));
+       pci_save_state(device_get_parent(rdev->dev->bsddev));
        /* disable bus mastering */
-       pci_disable_busmaster(rdev->dev);
+       pci_disable_busmaster(rdev->dev->bsddev);
        mdelay(1);
        /* reset GA+VAP */
        WREG32(R_0000F0_RBBM_SOFT_RESET, S_0000F0_SOFT_RESET_VAP(1) |
@@ -493,7 +493,7 @@ int rs600_asic_reset(struct radeon_device *rdev)
        status = RREG32(R_000E40_RBBM_STATUS);
        dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status);
        /* restore PCI & busmastering */
-       pci_restore_state(device_get_parent(rdev->dev));
+       pci_restore_state(device_get_parent(rdev->dev->bsddev));
        /* Check if GPU is idle */
        if (G_000E40_GA_BUSY(status) || G_000E40_VAP_BUSY(status)) {
                dev_err(rdev->dev, "failed to reset GPU\n");
index c260df5..4d06f75 100644 (file)
@@ -1674,10 +1674,10 @@ static int si_init_microcode(struct radeon_device *rdev)
        DRM_INFO("Loading %s Microcode\n", new_chip_name);
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", new_chip_name);
-       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_pfp", chip_name);
-               err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->pfp_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->pfp_fw->datasize != pfp_req_size) {
@@ -1700,10 +1700,10 @@ static int si_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", new_chip_name);
-       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_me", chip_name);
-               err = request_firmware(&rdev->me_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->me_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->me_fw->datasize != me_req_size) {
@@ -1725,10 +1725,10 @@ static int si_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_ce", new_chip_name);
-       err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_ce", chip_name);
-               err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->ce_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->ce_fw->datasize != ce_req_size) {
@@ -1750,10 +1750,10 @@ static int si_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc", new_chip_name);
-       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_rlc", chip_name);
-               err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->rlc_fw, fw_name, rdev->dev->bsddev);
                if (err)
                        goto out;
                if (rdev->rlc_fw->datasize != rlc_req_size) {
@@ -1775,13 +1775,13 @@ static int si_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc", new_chip_name);
-       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc2", chip_name);
-               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
                if (err) {
                        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_mc", chip_name);
-                       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev);
+                       err = request_firmware(&rdev->mc_fw, fw_name, rdev->dev->bsddev);
                        if (err)
                                goto out;
                }
@@ -1806,10 +1806,10 @@ static int si_init_microcode(struct radeon_device *rdev)
        }
 
        ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", new_chip_name);
-       err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
+       err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
        if (err) {
                ksnprintf(fw_name, sizeof(fw_name), "radeonkmsfw_%s_smc", chip_name);
-               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev);
+               err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev->bsddev);
                if (err) {
                        printk(KERN_ERR
                               "smc: error loading firmware \"%s\"\n",
@@ -4047,7 +4047,7 @@ static void si_gpu_pci_config_reset(struct radeon_device *rdev)
        /* powerdown spll */
        si_spll_powerdown(rdev);
        /* disable BM */
-       pci_disable_busmaster(rdev->pdev->dev);
+       pci_disable_busmaster(rdev->pdev->dev.bsddev);
        /* reset */
        radeon_pci_config_reset(rdev);
        /* wait for asic to come out of reset */
@@ -6023,7 +6023,7 @@ static int si_irq_init(struct radeon_device *rdev)
        /* force the active interrupt state to all disabled */
        si_disable_interrupt_state(rdev);
 
-       pci_enable_busmaster(rdev->dev);
+       pci_enable_busmaster(rdev->dev->bsddev);
 
        /* enable irqs */
        si_enable_interrupts(rdev);
@@ -7244,11 +7244,11 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev)
                DRM_INFO("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n");
        }
 
-       bridge_pos = pci_get_pciecap_ptr(root->dev);
+       bridge_pos = pci_get_pciecap_ptr(root->dev.bsddev);
        if (!bridge_pos)
                return;
 
-       gpu_pos = pci_get_pciecap_ptr(rdev->pdev->dev);
+       gpu_pos = pci_get_pciecap_ptr(rdev->pdev->dev.bsddev);
        if (!gpu_pos)
                return;