<div dir="ltr"><div>i do it because it is part of the todo list</div><div>where the task is to remove load/unload callback</div><div>there are only 2 drm_driver that still uses thats why</div><div>i thought my amdgpu could test radeonsi but no, i still send it anyway</div><div><br></div><div>regards,</div><div>wu<br></div></div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 7, 2024 at 3:51 AM Christian König <<a href="mailto:christian.koenig@amd.com">christian.koenig@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am 07.06.24 um 03:14 schrieb wu hoi pok:<br>
> this patch is to remove the load callback from the kms_driver,<br>
> following closly to amdgpu, radeon_driver_load_kms and devm_drm_dev_alloc<br>
> are used, most of the changes here are rdev->ddev to rdev_to_drm,<br>
> which maps to adev_to_drm in amdgpu. however this patch is not tested on<br>
> hardware, so if you are free and have a gcn1 gcn2 card please do so.<br>
<br>
What is the motivation to do that?<br>
<br>
When the old interface is going to be removed the patch is probably <br>
justified, but in general we don't really accept any larger changes like <br>
this for radeon any more.<br>
<br>
Especially without some testing of it.<br>
<br>
Regards,<br>
Christian.<br>
<br>
><br>
> Signed-off-by: wu hoi pok <<a href="mailto:wuhoipok@gmail.com" target="_blank">wuhoipok@gmail.com</a>><br>
> ---<br>
>   drivers/gpu/drm/radeon/atombios_encoders.c |  2 +-<br>
>   drivers/gpu/drm/radeon/cik.c               | 14 ++--<br>
>   drivers/gpu/drm/radeon/dce6_afmt.c         |  2 +-<br>
>   drivers/gpu/drm/radeon/evergreen.c         | 12 ++--<br>
>   drivers/gpu/drm/radeon/ni.c                |  2 +-<br>
>   drivers/gpu/drm/radeon/r100.c              | 24 +++----<br>
>   drivers/gpu/drm/radeon/r300.c              |  6 +-<br>
>   drivers/gpu/drm/radeon/r420.c              |  6 +-<br>
>   drivers/gpu/drm/radeon/r520.c              |  2 +-<br>
>   drivers/gpu/drm/radeon/r600.c              | 12 ++--<br>
>   drivers/gpu/drm/radeon/r600_cs.c           |  2 +-<br>
>   drivers/gpu/drm/radeon/r600_dpm.c          |  4 +-<br>
>   drivers/gpu/drm/radeon/r600_hdmi.c         |  2 +-<br>
>   drivers/gpu/drm/radeon/radeon.h            | 11 +++-<br>
>   drivers/gpu/drm/radeon/radeon_acpi.c       | 10 +--<br>
>   drivers/gpu/drm/radeon/radeon_agp.c        |  2 +-<br>
>   drivers/gpu/drm/radeon/radeon_atombios.c   |  2 +-<br>
>   drivers/gpu/drm/radeon/radeon_audio.c      |  4 +-<br>
>   drivers/gpu/drm/radeon/radeon_combios.c    | 12 ++--<br>
>   drivers/gpu/drm/radeon/radeon_device.c     | 17 ++---<br>
>   drivers/gpu/drm/radeon/radeon_display.c    | 74 +++++++++++-----------<br>
>   drivers/gpu/drm/radeon/radeon_drv.c        | 27 +++++---<br>
>   drivers/gpu/drm/radeon/radeon_drv.h        |  1 -<br>
>   drivers/gpu/drm/radeon/radeon_fbdev.c      | 26 ++++----<br>
>   drivers/gpu/drm/radeon/radeon_fence.c      |  8 +--<br>
>   drivers/gpu/drm/radeon/radeon_gem.c        |  2 +-<br>
>   drivers/gpu/drm/radeon/radeon_i2c.c        |  2 +-<br>
>   drivers/gpu/drm/radeon/radeon_ib.c         |  2 +-<br>
>   drivers/gpu/drm/radeon/radeon_irq_kms.c    | 12 ++--<br>
>   drivers/gpu/drm/radeon/radeon_kms.c        | 16 ++---<br>
>   drivers/gpu/drm/radeon/radeon_object.c     |  2 +-<br>
>   drivers/gpu/drm/radeon/radeon_pm.c         | 20 +++---<br>
>   drivers/gpu/drm/radeon/radeon_ring.c       |  2 +-<br>
>   drivers/gpu/drm/radeon/radeon_ttm.c        |  6 +-<br>
>   drivers/gpu/drm/radeon/rs400.c             |  6 +-<br>
>   drivers/gpu/drm/radeon/rs600.c             | 14 ++--<br>
>   drivers/gpu/drm/radeon/rs690.c             |  2 +-<br>
>   drivers/gpu/drm/radeon/rv515.c             |  4 +-<br>
>   drivers/gpu/drm/radeon/rv770.c             |  2 +-<br>
>   drivers/gpu/drm/radeon/si.c                |  4 +-<br>
>   40 files changed, 192 insertions(+), 188 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c<br>
> index 7b11674f5d45..05f34efd7fd0 100644<br>
> --- a/drivers/gpu/drm/radeon/atombios_encoders.c<br>
> +++ b/drivers/gpu/drm/radeon/atombios_encoders.c<br>
> @@ -2179,7 +2179,7 @@ int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder, int fe_idx)<br>
>   void<br>
>   radeon_atom_encoder_init(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_encoder *encoder;<br>
>   <br>
>       list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {<br>
> diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c<br>
> index b5e96a8fc2c1..11a492f21157 100644<br>
> --- a/drivers/gpu/drm/radeon/cik.c<br>
> +++ b/drivers/gpu/drm/radeon/cik.c<br>
> @@ -7585,7 +7585,7 @@ int cik_irq_process(struct radeon_device *rdev)<br>
>                                       DRM_DEBUG("IH: IH event w/o asserted irq bit?\n");<br>
>   <br>
>                               if (rdev->irq.crtc_vblank_int[0]) {<br>
> -                                     drm_handle_vblank(rdev->ddev, 0);<br>
> +                                     drm_handle_vblank(rdev_to_drm(rdev), 0);<br>
>                                       rdev->pm.vblank_sync = true;<br>
>                                       wake_up(&rdev->irq.vblank_queue);<br>
>                               }<br>
> @@ -7615,7 +7615,7 @@ int cik_irq_process(struct radeon_device *rdev)<br>
>                                       DRM_DEBUG("IH: IH event w/o asserted irq bit?\n");<br>
>   <br>
>                               if (rdev->irq.crtc_vblank_int[1]) {<br>
> -                                     drm_handle_vblank(rdev->ddev, 1);<br>
> +                                     drm_handle_vblank(rdev_to_drm(rdev), 1);<br>
>                                       rdev->pm.vblank_sync = true;<br>
>                                       wake_up(&rdev->irq.vblank_queue);<br>
>                               }<br>
> @@ -7645,7 +7645,7 @@ int cik_irq_process(struct radeon_device *rdev)<br>
>                                       DRM_DEBUG("IH: IH event w/o asserted irq bit?\n");<br>
>   <br>
>                               if (rdev->irq.crtc_vblank_int[2]) {<br>
> -                                     drm_handle_vblank(rdev->ddev, 2);<br>
> +                                     drm_handle_vblank(rdev_to_drm(rdev), 2);<br>
>                                       rdev->pm.vblank_sync = true;<br>
>                                       wake_up(&rdev->irq.vblank_queue);<br>
>                               }<br>
> @@ -7675,7 +7675,7 @@ int cik_irq_process(struct radeon_device *rdev)<br>
>                                       DRM_DEBUG("IH: IH event w/o asserted irq bit?\n");<br>
>   <br>
>                               if (rdev->irq.crtc_vblank_int[3]) {<br>
> -                                     drm_handle_vblank(rdev->ddev, 3);<br>
> +                                     drm_handle_vblank(rdev_to_drm(rdev), 3);<br>
>                                       rdev->pm.vblank_sync = true;<br>
>                                       wake_up(&rdev->irq.vblank_queue);<br>
>                               }<br>
> @@ -7705,7 +7705,7 @@ int cik_irq_process(struct radeon_device *rdev)<br>
>                                       DRM_DEBUG("IH: IH event w/o asserted irq bit?\n");<br>
>   <br>
>                               if (rdev->irq.crtc_vblank_int[4]) {<br>
> -                                     drm_handle_vblank(rdev->ddev, 4);<br>
> +                                     drm_handle_vblank(rdev_to_drm(rdev), 4);<br>
>                                       rdev->pm.vblank_sync = true;<br>
>                                       wake_up(&rdev->irq.vblank_queue);<br>
>                               }<br>
> @@ -7735,7 +7735,7 @@ int cik_irq_process(struct radeon_device *rdev)<br>
>                                       DRM_DEBUG("IH: IH event w/o asserted irq bit?\n");<br>
>   <br>
>                               if (rdev->irq.crtc_vblank_int[5]) {<br>
> -                                     drm_handle_vblank(rdev->ddev, 5);<br>
> +                                     drm_handle_vblank(rdev_to_drm(rdev), 5);<br>
>                                       rdev->pm.vblank_sync = true;<br>
>                                       wake_up(&rdev->irq.vblank_queue);<br>
>                               }<br>
> @@ -8581,7 +8581,7 @@ int cik_init(struct radeon_device *rdev)<br>
>       /* Initialize surface registers */<br>
>       radeon_surface_init(rdev);<br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>   <br>
>       /* Fence driver */<br>
>       radeon_fence_driver_init(rdev);<br>
> diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c<br>
> index 4c06f47453fd..d6ab93ed9ec4 100644<br>
> --- a/drivers/gpu/drm/radeon/dce6_afmt.c<br>
> +++ b/drivers/gpu/drm/radeon/dce6_afmt.c<br>
> @@ -91,7 +91,7 @@ struct r600_audio_pin *dce6_audio_get_pin(struct radeon_device *rdev)<br>
>                       pin = &rdev->audio.pin[i];<br>
>                       pin_count = 0;<br>
>   <br>
> -                     list_for_each_entry(encoder, &rdev->ddev->mode_config.encoder_list, head) {<br>
> +                     list_for_each_entry(encoder, &rdev_to_drm(rdev)->mode_config.encoder_list, head) {<br>
>                               if (radeon_encoder_is_digital(encoder)) {<br>
>                                       radeon_encoder = to_radeon_encoder(encoder);<br>
>                                       dig = radeon_encoder->enc_priv;<br>
> diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c<br>
> index c634dc28e6c3..bc4ab71613a5 100644<br>
> --- a/drivers/gpu/drm/radeon/evergreen.c<br>
> +++ b/drivers/gpu/drm/radeon/evergreen.c<br>
> @@ -1673,7 +1673,7 @@ void evergreen_pm_misc(struct radeon_device *rdev)<br>
>    */<br>
>   void evergreen_pm_prepare(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       struct drm_crtc *crtc;<br>
>       struct radeon_crtc *radeon_crtc;<br>
>       u32 tmp;<br>
> @@ -1698,7 +1698,7 @@ void evergreen_pm_prepare(struct radeon_device *rdev)<br>
>    */<br>
>   void evergreen_pm_finish(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       struct drm_crtc *crtc;<br>
>       struct radeon_crtc *radeon_crtc;<br>
>       u32 tmp;<br>
> @@ -1763,7 +1763,7 @@ void evergreen_hpd_set_polarity(struct radeon_device *rdev,<br>
>    */<br>
>   void evergreen_hpd_init(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_connector *connector;<br>
>       unsigned enabled = 0;<br>
>       u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) |<br>
> @@ -1804,7 +1804,7 @@ void evergreen_hpd_init(struct radeon_device *rdev)<br>
>    */<br>
>   void evergreen_hpd_fini(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_connector *connector;<br>
>       unsigned disabled = 0;<br>
>   <br>
> @@ -4753,7 +4753,7 @@ int evergreen_irq_process(struct radeon_device *rdev)<br>
>                               event_name = "vblank";<br>
>   <br>
>                               if (rdev->irq.crtc_vblank_int[crtc_idx]) {<br>
> -                                     drm_handle_vblank(rdev->ddev, crtc_idx);<br>
> +                                     drm_handle_vblank(rdev_to_drm(rdev), crtc_idx);<br>
>                                       rdev->pm.vblank_sync = true;<br>
>                                       wake_up(&rdev->irq.vblank_queue);<br>
>                               }<br>
> @@ -5211,7 +5211,7 @@ int evergreen_init(struct radeon_device *rdev)<br>
>       /* Initialize surface registers */<br>
>       radeon_surface_init(rdev);<br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* Fence driver */<br>
>       radeon_fence_driver_init(rdev);<br>
>       /* initialize AGP */<br>
> diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c<br>
> index 77aee99e473a..3890911fe693 100644<br>
> --- a/drivers/gpu/drm/radeon/ni.c<br>
> +++ b/drivers/gpu/drm/radeon/ni.c<br>
> @@ -2360,7 +2360,7 @@ int cayman_init(struct radeon_device *rdev)<br>
>       /* Initialize surface registers */<br>
>       radeon_surface_init(rdev);<br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* Fence driver */<br>
>       radeon_fence_driver_init(rdev);<br>
>       /* initialize memory controller */<br>
> diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c<br>
> index 0b1e19345f43..d7d7d23bf9a1 100644<br>
> --- a/drivers/gpu/drm/radeon/r100.c<br>
> +++ b/drivers/gpu/drm/radeon/r100.c<br>
> @@ -459,7 +459,7 @@ void r100_pm_misc(struct radeon_device *rdev)<br>
>    */<br>
>   void r100_pm_prepare(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       struct drm_crtc *crtc;<br>
>       struct radeon_crtc *radeon_crtc;<br>
>       u32 tmp;<br>
> @@ -490,7 +490,7 @@ void r100_pm_prepare(struct radeon_device *rdev)<br>
>    */<br>
>   void r100_pm_finish(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       struct drm_crtc *crtc;<br>
>       struct radeon_crtc *radeon_crtc;<br>
>       u32 tmp;<br>
> @@ -603,7 +603,7 @@ void r100_hpd_set_polarity(struct radeon_device *rdev,<br>
>    */<br>
>   void r100_hpd_init(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_connector *connector;<br>
>       unsigned enable = 0;<br>
>   <br>
> @@ -626,7 +626,7 @@ void r100_hpd_init(struct radeon_device *rdev)<br>
>    */<br>
>   void r100_hpd_fini(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_connector *connector;<br>
>       unsigned disable = 0;<br>
>   <br>
> @@ -798,7 +798,7 @@ int r100_irq_process(struct radeon_device *rdev)<br>
>               /* Vertical blank interrupts */<br>
>               if (status & RADEON_CRTC_VBLANK_STAT) {<br>
>                       if (rdev->irq.crtc_vblank_int[0]) {<br>
> -                             drm_handle_vblank(rdev->ddev, 0);<br>
> +                             drm_handle_vblank(rdev_to_drm(rdev), 0);<br>
>                               rdev->pm.vblank_sync = true;<br>
>                               wake_up(&rdev->irq.vblank_queue);<br>
>                       }<br>
> @@ -807,7 +807,7 @@ int r100_irq_process(struct radeon_device *rdev)<br>
>               }<br>
>               if (status & RADEON_CRTC2_VBLANK_STAT) {<br>
>                       if (rdev->irq.crtc_vblank_int[1]) {<br>
> -                             drm_handle_vblank(rdev->ddev, 1);<br>
> +                             drm_handle_vblank(rdev_to_drm(rdev), 1);<br>
>                               rdev->pm.vblank_sync = true;<br>
>                               wake_up(&rdev->irq.vblank_queue);<br>
>                       }<br>
> @@ -1471,7 +1471,7 @@ int r100_cs_packet_parse_vline(struct radeon_cs_parser *p)<br>
>       header = radeon_get_ib_value(p, h_idx);<br>
>       crtc_id = radeon_get_ib_value(p, h_idx + 5);<br>
>       reg = R100_CP_PACKET0_GET_REG(header);<br>
> -     crtc = drm_crtc_find(p->rdev->ddev, p->filp, crtc_id);<br>
> +     crtc = drm_crtc_find(rdev_to_drm(p->rdev), p->filp, crtc_id);<br>
>       if (!crtc) {<br>
>               DRM_ERROR("cannot find crtc %d\n", crtc_id);<br>
>               return -ENOENT;<br>
> @@ -3059,7 +3059,7 @@ DEFINE_SHOW_ATTRIBUTE(r100_debugfs_mc_info);<br>
>   void  r100_debugfs_rbbm_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("r100_rbbm_info", 0444, root, rdev,<br>
>                           &r100_debugfs_rbbm_info_fops);<br>
> @@ -3069,7 +3069,7 @@ void  r100_debugfs_rbbm_init(struct radeon_device *rdev)<br>
>   void r100_debugfs_cp_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("r100_cp_ring_info", 0444, root, rdev,<br>
>                           &r100_debugfs_cp_ring_info_fops);<br>
> @@ -3081,7 +3081,7 @@ void r100_debugfs_cp_init(struct radeon_device *rdev)<br>
>   void  r100_debugfs_mc_info_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("r100_mc_info", 0444, root, rdev,<br>
>                           &r100_debugfs_mc_info_fops);<br>
> @@ -3947,7 +3947,7 @@ int r100_resume(struct radeon_device *rdev)<br>
>                       RREG32(R_0007C0_CP_STAT));<br>
>       }<br>
>       /* post */<br>
> -     radeon_combios_asic_init(rdev->ddev);<br>
> +     radeon_combios_asic_init(rdev_to_drm(rdev));<br>
>       /* Resume clock after posting */<br>
>       r100_clock_startup(rdev);<br>
>       /* Initialize surface registers */<br>
> @@ -4056,7 +4056,7 @@ int r100_init(struct radeon_device *rdev)<br>
>       /* Set asic errata */<br>
>       r100_errata(rdev);<br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* initialize AGP */<br>
>       if (rdev->flags & RADEON_IS_AGP) {<br>
>               r = radeon_agp_init(rdev);<br>
> diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c<br>
> index 1620f534f55f..05c13102a8cb 100644<br>
> --- a/drivers/gpu/drm/radeon/r300.c<br>
> +++ b/drivers/gpu/drm/radeon/r300.c<br>
> @@ -616,7 +616,7 @@ DEFINE_SHOW_ATTRIBUTE(rv370_debugfs_pcie_gart_info);<br>
>   static void rv370_debugfs_pcie_gart_info_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("rv370_pcie_gart_info", 0444, root, rdev,<br>
>                           &rv370_debugfs_pcie_gart_info_fops);<br>
> @@ -1452,7 +1452,7 @@ int r300_resume(struct radeon_device *rdev)<br>
>                       RREG32(R_0007C0_CP_STAT));<br>
>       }<br>
>       /* post */<br>
> -     radeon_combios_asic_init(rdev->ddev);<br>
> +     radeon_combios_asic_init(rdev_to_drm(rdev));<br>
>       /* Resume clock after posting */<br>
>       r300_clock_startup(rdev);<br>
>       /* Initialize surface registers */<br>
> @@ -1538,7 +1538,7 @@ int r300_init(struct radeon_device *rdev)<br>
>       /* Set asic errata */<br>
>       r300_errata(rdev);<br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* initialize AGP */<br>
>       if (rdev->flags & RADEON_IS_AGP) {<br>
>               r = radeon_agp_init(rdev);<br>
> diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c<br>
> index a979662eaa73..9a31cdec6415 100644<br>
> --- a/drivers/gpu/drm/radeon/r420.c<br>
> +++ b/drivers/gpu/drm/radeon/r420.c<br>
> @@ -322,7 +322,7 @@ int r420_resume(struct radeon_device *rdev)<br>
>       if (rdev->is_atom_bios) {<br>
>               atom_asic_init(rdev->mode_info.atom_context);<br>
>       } else {<br>
> -             radeon_combios_asic_init(rdev->ddev);<br>
> +             radeon_combios_asic_init(rdev_to_drm(rdev));<br>
>       }<br>
>       /* Resume clock after posting */<br>
>       r420_clock_resume(rdev);<br>
> @@ -414,7 +414,7 @@ int r420_init(struct radeon_device *rdev)<br>
>               return -EINVAL;<br>
>   <br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* initialize AGP */<br>
>       if (rdev->flags & RADEON_IS_AGP) {<br>
>               r = radeon_agp_init(rdev);<br>
> @@ -493,7 +493,7 @@ DEFINE_SHOW_ATTRIBUTE(r420_debugfs_pipes_info);<br>
>   void r420_debugfs_pipes_info_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("r420_pipes_info", 0444, root, rdev,<br>
>                           &r420_debugfs_pipes_info_fops);<br>
> diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c<br>
> index 6cbcaa845192..08e127b3249a 100644<br>
> --- a/drivers/gpu/drm/radeon/r520.c<br>
> +++ b/drivers/gpu/drm/radeon/r520.c<br>
> @@ -287,7 +287,7 @@ int r520_init(struct radeon_device *rdev)<br>
>               atom_asic_init(rdev->mode_info.atom_context);<br>
>       }<br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* initialize AGP */<br>
>       if (rdev->flags & RADEON_IS_AGP) {<br>
>               r = radeon_agp_init(rdev);<br>
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c<br>
> index 087d41e370fd..8b62f7faa5b9 100644<br>
> --- a/drivers/gpu/drm/radeon/r600.c<br>
> +++ b/drivers/gpu/drm/radeon/r600.c<br>
> @@ -950,7 +950,7 @@ void r600_hpd_set_polarity(struct radeon_device *rdev,<br>
>   <br>
>   void r600_hpd_init(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_connector *connector;<br>
>       unsigned enable = 0;<br>
>   <br>
> @@ -1017,7 +1017,7 @@ void r600_hpd_init(struct radeon_device *rdev)<br>
>   <br>
>   void r600_hpd_fini(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_connector *connector;<br>
>       unsigned disable = 0;<br>
>   <br>
> @@ -3280,7 +3280,7 @@ int r600_init(struct radeon_device *rdev)<br>
>       /* Initialize surface registers */<br>
>       radeon_surface_init(rdev);<br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* Fence driver */<br>
>       radeon_fence_driver_init(rdev);<br>
>       if (rdev->flags & RADEON_IS_AGP) {<br>
> @@ -4136,7 +4136,7 @@ int r600_irq_process(struct radeon_device *rdev)<br>
>                                       DRM_DEBUG("IH: D1 vblank - IH event w/o asserted irq bit?\n");<br>
>   <br>
>                               if (rdev->irq.crtc_vblank_int[0]) {<br>
> -                                     drm_handle_vblank(rdev->ddev, 0);<br>
> +                                     drm_handle_vblank(rdev_to_drm(rdev), 0);<br>
>                                       rdev->pm.vblank_sync = true;<br>
>                                       wake_up(&rdev->irq.vblank_queue);<br>
>                               }<br>
> @@ -4166,7 +4166,7 @@ int r600_irq_process(struct radeon_device *rdev)<br>
>                                       DRM_DEBUG("IH: D2 vblank - IH event w/o asserted irq bit?\n");<br>
>   <br>
>                               if (rdev->irq.crtc_vblank_int[1]) {<br>
> -                                     drm_handle_vblank(rdev->ddev, 1);<br>
> +                                     drm_handle_vblank(rdev_to_drm(rdev), 1);<br>
>                                       rdev->pm.vblank_sync = true;<br>
>                                       wake_up(&rdev->irq.vblank_queue);<br>
>                               }<br>
> @@ -4358,7 +4358,7 @@ DEFINE_SHOW_ATTRIBUTE(r600_debugfs_mc_info);<br>
>   static void r600_debugfs_mc_info_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("r600_mc_info", 0444, root, rdev,<br>
>                           &r600_debugfs_mc_info_fops);<br>
> diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c<br>
> index 6cf54a747749..1b2d31c4d77c 100644<br>
> --- a/drivers/gpu/drm/radeon/r600_cs.c<br>
> +++ b/drivers/gpu/drm/radeon/r600_cs.c<br>
> @@ -884,7 +884,7 @@ int r600_cs_common_vline_parse(struct radeon_cs_parser *p,<br>
>       crtc_id = radeon_get_ib_value(p, h_idx + 2 + 7 + 1);<br>
>       reg = R600_CP_PACKET0_GET_REG(header);<br>
>   <br>
> -     crtc = drm_crtc_find(p->rdev->ddev, p->filp, crtc_id);<br>
> +     crtc = drm_crtc_find(rdev_to_drm(p->rdev), p->filp, crtc_id);<br>
>       if (!crtc) {<br>
>               DRM_ERROR("cannot find crtc %d\n", crtc_id);<br>
>               return -ENOENT;<br>
> diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c<br>
> index 64980a61d38a..81d58ef667dd 100644<br>
> --- a/drivers/gpu/drm/radeon/r600_dpm.c<br>
> +++ b/drivers/gpu/drm/radeon/r600_dpm.c<br>
> @@ -153,7 +153,7 @@ void r600_dpm_print_ps_status(struct radeon_device *rdev,<br>
>   <br>
>   u32 r600_dpm_get_vblank_time(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_crtc *crtc;<br>
>       struct radeon_crtc *radeon_crtc;<br>
>       u32 vblank_in_pixels;<br>
> @@ -180,7 +180,7 @@ u32 r600_dpm_get_vblank_time(struct radeon_device *rdev)<br>
>   <br>
>   u32 r600_dpm_get_vrefresh(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_crtc *crtc;<br>
>       struct radeon_crtc *radeon_crtc;<br>
>       u32 vrefresh = 0;<br>
> diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c<br>
> index f3551ebaa2f0..661f374f5f27 100644<br>
> --- a/drivers/gpu/drm/radeon/r600_hdmi.c<br>
> +++ b/drivers/gpu/drm/radeon/r600_hdmi.c<br>
> @@ -116,7 +116,7 @@ void r600_audio_update_hdmi(struct work_struct *work)<br>
>   {<br>
>       struct radeon_device *rdev = container_of(work, struct radeon_device,<br>
>                                                 audio_work);<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct r600_audio_pin audio_status = r600_audio_status(rdev);<br>
>       struct drm_encoder *encoder;<br>
>       bool changed = false;<br>
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h<br>
> index 0999c8eaae94..69bb30ced189 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon.h<br>
> +++ b/drivers/gpu/drm/radeon/radeon.h<br>
> @@ -2297,7 +2297,7 @@ typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t);<br>
>   <br>
>   struct radeon_device {<br>
>       struct device                   *dev;<br>
> -     struct drm_device               *ddev;<br>
> +     struct drm_device               ddev;<br>
>       struct pci_dev                  *pdev;<br>
>   #ifdef __alpha__<br>
>       struct pci_controller           *hose;<br>
> @@ -2440,10 +2440,13 @@ struct radeon_device {<br>
>       u64 gart_pin_size;<br>
>   };<br>
>   <br>
> +static inline struct drm_device *rdev_to_drm(struct radeon_device *rdev)<br>
> +{<br>
> +     return &rdev->ddev;<br>
> +}<br>
> +<br>
>   bool radeon_is_px(struct drm_device *dev);<br>
>   int radeon_device_init(struct radeon_device *rdev,<br>
> -                    struct drm_device *ddev,<br>
> -                    struct pci_dev *pdev,<br>
>                      uint32_t flags);<br>
>   void radeon_device_fini(struct radeon_device *rdev);<br>
>   int radeon_gpu_wait_for_idle(struct radeon_device *rdev);<br>
> @@ -2818,6 +2821,8 @@ struct radeon_device *radeon_get_rdev(struct ttm_device *bdev);<br>
>   <br>
>   /* KMS */<br>
>   <br>
> +int radeon_driver_load_kms(struct radeon_device *dev, unsigned long flags);<br>
> +<br>
>   u32 radeon_get_vblank_counter_kms(struct drm_crtc *crtc);<br>
>   int radeon_enable_vblank_kms(struct drm_crtc *crtc);<br>
>   void radeon_disable_vblank_kms(struct drm_crtc *crtc);<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c<br>
> index 603a78e41ba5..22ce61bdfc06 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_acpi.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_acpi.c<br>
> @@ -405,11 +405,11 @@ static int radeon_atif_handler(struct radeon_device *rdev,<br>
>       if (req.pending & ATIF_DGPU_DISPLAY_EVENT) {<br>
>               if ((rdev->flags & RADEON_IS_PX) &&<br>
>                   radeon_atpx_dgpu_req_power_for_displays()) {<br>
> -                     pm_runtime_get_sync(rdev->ddev->dev);<br>
> +                     pm_runtime_get_sync(rdev_to_drm(rdev)->dev);<br>
>                       /* Just fire off a uevent and let userspace tell us what to do */<br>
> -                     drm_helper_hpd_irq_event(rdev->ddev);<br>
> -                     pm_runtime_mark_last_busy(rdev->ddev->dev);<br>
> -                     pm_runtime_put_autosuspend(rdev->ddev->dev);<br>
> +                     drm_helper_hpd_irq_event(rdev_to_drm(rdev));<br>
> +                     pm_runtime_mark_last_busy(rdev_to_drm(rdev)->dev);<br>
> +                     pm_runtime_put_autosuspend(rdev_to_drm(rdev)->dev);<br>
>               }<br>
>       }<br>
>       /* TODO: check other events */<br>
> @@ -736,7 +736,7 @@ int radeon_acpi_init(struct radeon_device *rdev)<br>
>               struct radeon_encoder *target = NULL;<br>
>   <br>
>               /* Find the encoder controlling the brightness */<br>
> -             list_for_each_entry(tmp, &rdev->ddev->mode_config.encoder_list,<br>
> +             list_for_each_entry(tmp, &rdev_to_drm(rdev)->mode_config.encoder_list,<br>
>                               head) {<br>
>                       struct radeon_encoder *enc = to_radeon_encoder(tmp);<br>
>   <br>
> diff --git a/drivers/gpu/drm/radeon/radeon_agp.c b/drivers/gpu/drm/radeon/radeon_agp.c<br>
> index a3d749e350f9..89d7b0e9e79f 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_agp.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_agp.c<br>
> @@ -161,7 +161,7 @@ struct radeon_agp_head *radeon_agp_head_init(struct drm_device *dev)<br>
>   <br>
>   static int radeon_agp_head_acquire(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct pci_dev *pdev = to_pci_dev(dev->dev);<br>
>   <br>
>       if (!rdev->agp)<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c<br>
> index 10793a433bf5..97c4e10d0550 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_atombios.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_atombios.c<br>
> @@ -187,7 +187,7 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev)<br>
>   <br>
>                       if (i2c.valid) {<br>
>                               sprintf(stmp, "0x%x", i2c.i2c_id);<br>
> -                             rdev->i2c_bus[i] = radeon_i2c_create(rdev->ddev, &i2c, stmp);<br>
> +                             rdev->i2c_bus[i] = radeon_i2c_create(rdev_to_drm(rdev), &i2c, stmp);<br>
>                       }<br>
>                       gpio = (ATOM_GPIO_I2C_ASSIGMENT *)<br>
>                               ((u8 *)gpio + sizeof(ATOM_GPIO_I2C_ASSIGMENT));<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c<br>
> index 74753bb26d33..31f032295497 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_audio.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_audio.c<br>
> @@ -196,7 +196,7 @@ static void radeon_audio_enable(struct radeon_device *rdev,<br>
>               return;<br>
>   <br>
>       if (rdev->mode_info.mode_config_initialized) {<br>
> -             list_for_each_entry(encoder, &rdev->ddev->mode_config.encoder_list, head) {<br>
> +             list_for_each_entry(encoder, &rdev_to_drm(rdev)->mode_config.encoder_list, head) {<br>
>                       if (radeon_encoder_is_digital(encoder)) {<br>
>                               radeon_encoder = to_radeon_encoder(encoder);<br>
>                               dig = radeon_encoder->enc_priv;<br>
> @@ -759,7 +759,7 @@ static int radeon_audio_component_get_eld(struct device *kdev, int port,<br>
>       if (!rdev->audio.enabled || !rdev->mode_info.mode_config_initialized)<br>
>               return 0;<br>
>   <br>
> -     list_for_each_entry(encoder, &rdev->ddev->mode_config.encoder_list, head) {<br>
> +     list_for_each_entry(encoder, &rdev_to_drm(rdev)->mode_config.encoder_list, head) {<br>
>               if (!radeon_encoder_is_digital(encoder))<br>
>                       continue;<br>
>               radeon_encoder = to_radeon_encoder(encoder);<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c<br>
> index 6952b1273b0f..41ddc576f8f8 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_combios.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_combios.c<br>
> @@ -372,7 +372,7 @@ bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev)<br>
>       int edid_info, size;<br>
>       struct edid *edid;<br>
>       unsigned char *raw;<br>
> -     edid_info = combios_get_table_offset(rdev->ddev, COMBIOS_HARDCODED_EDID_TABLE);<br>
> +     edid_info = combios_get_table_offset(rdev_to_drm(rdev), COMBIOS_HARDCODED_EDID_TABLE);<br>
>       if (!edid_info)<br>
>               return false;<br>
>   <br>
> @@ -642,7 +642,7 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde<br>
>   <br>
>   static struct radeon_i2c_bus_rec radeon_combios_get_i2c_info_from_table(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct radeon_i2c_bus_rec i2c;<br>
>       u16 offset;<br>
>       u8 id, blocks, clk, data;<br>
> @@ -670,7 +670,7 @@ static struct radeon_i2c_bus_rec radeon_combios_get_i2c_info_from_table(struct r<br>
>   <br>
>   void radeon_combios_i2c_init(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct radeon_i2c_bus_rec i2c;<br>
>   <br>
>       /* actual hw pads<br>
> @@ -812,7 +812,7 @@ bool radeon_combios_get_clock_info(struct drm_device *dev)<br>
>   <br>
>   bool radeon_combios_sideport_present(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       u16 igp_info;<br>
>   <br>
>       /* sideport is AMD only */<br>
> @@ -915,7 +915,7 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct<br>
>   enum radeon_tv_std<br>
>   radeon_combios_get_tv_info(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       uint16_t tv_info;<br>
>       enum radeon_tv_std tv_std = TV_STD_NTSC;<br>
>   <br>
> @@ -2637,7 +2637,7 @@ static const char *thermal_controller_names[] = {<br>
>   <br>
>   void radeon_combios_get_power_modes(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       u16 offset, misc, misc2 = 0;<br>
>       u8 rev, tmp;<br>
>       int state_index = 0;<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c<br>
> index afbb3a80c0c6..36444d739b41 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_device.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_device.c<br>
> @@ -760,7 +760,7 @@ bool radeon_boot_test_post_card(struct radeon_device *rdev)<br>
>               if (rdev->is_atom_bios)<br>
>                       atom_asic_init(rdev->mode_info.atom_context);<br>
>               else<br>
> -                     radeon_combios_asic_init(rdev->ddev);<br>
> +                     radeon_combios_asic_init(rdev_to_drm(rdev));<br>
>               return true;<br>
>       } else {<br>
>               dev_err(rdev->dev, "Card not posted and no BIOS - ignoring\n");<br>
> @@ -980,7 +980,7 @@ int radeon_atombios_init(struct radeon_device *rdev)<br>
>               return -ENOMEM;<br>
>   <br>
>       rdev->mode_info.atom_card_info = atom_card_info;<br>
> -     atom_card_info->dev = rdev->ddev;<br>
> +     atom_card_info->dev = rdev_to_drm(rdev);<br>
>       atom_card_info->reg_read = cail_reg_read;<br>
>       atom_card_info->reg_write = cail_reg_write;<br>
>       /* needed for iio ops */<br>
> @@ -1005,7 +1005,7 @@ int radeon_atombios_init(struct radeon_device *rdev)<br>
>   <br>
>       mutex_init(&rdev->mode_info.atom_context->mutex);<br>
>       mutex_init(&rdev->mode_info.atom_context->scratch_mutex);<br>
> -     radeon_atom_initialize_bios_scratch_regs(rdev->ddev);<br>
> +     radeon_atom_initialize_bios_scratch_regs(rdev_to_drm(rdev));<br>
>       atom_allocate_fb_scratch(rdev->mode_info.atom_context);<br>
>       return 0;<br>
>   }<br>
> @@ -1049,7 +1049,7 @@ void radeon_atombios_fini(struct radeon_device *rdev)<br>
>    */<br>
>   int radeon_combios_init(struct radeon_device *rdev)<br>
>   {<br>
> -     radeon_combios_initialize_bios_scratch_regs(rdev->ddev);<br>
> +     radeon_combios_initialize_bios_scratch_regs(rdev_to_drm(rdev));<br>
>       return 0;<br>
>   }<br>
>   <br>
> @@ -1276,18 +1276,15 @@ static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = {<br>
>    * Called at driver startup.<br>
>    */<br>
>   int radeon_device_init(struct radeon_device *rdev,<br>
> -                    struct drm_device *ddev,<br>
> -                    struct pci_dev *pdev,<br>
>                      uint32_t flags)<br>
>   {<br>
> +     struct pci_dev *pdev = rdev->pdev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       int r, i;<br>
>       int dma_bits;<br>
>       bool runtime = false;<br>
>   <br>
>       rdev->shutdown = false;<br>
> -     rdev->dev = &pdev->dev;<br>
> -     rdev->ddev = ddev;<br>
> -     rdev->pdev = pdev;<br>
>       rdev->flags = flags;<br>
>       rdev->family = flags & RADEON_FAMILY_MASK;<br>
>       rdev->is_atom_bios = false;<br>
> @@ -1847,7 +1844,7 @@ int radeon_gpu_reset(struct radeon_device *rdev)<br>
>   <br>
>       downgrade_write(&rdev->exclusive_lock);<br>
>   <br>
> -     drm_helper_resume_force_mode(rdev->ddev);<br>
> +     drm_helper_resume_force_mode(rdev_to_drm(rdev));<br>
>   <br>
>       /* set the power state here in case we are a PX system or headless */<br>
>       if ((rdev->pm.pm_method == PM_METHOD_DPM) && rdev->pm.dpm_enabled)<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c<br>
> index 5f1d24d3120c..4b9473852c1f 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_display.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_display.c<br>
> @@ -302,13 +302,13 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id)<br>
>       if ((radeon_use_pflipirq == 2) && ASIC_IS_DCE4(rdev))<br>
>               return;<br>
>   <br>
> -     spin_lock_irqsave(&rdev->ddev->event_lock, flags);<br>
> +     spin_lock_irqsave(&rdev_to_drm(rdev)->event_lock, flags);<br>
>       if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) {<br>
>               DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != "<br>
>                                "RADEON_FLIP_SUBMITTED(%d)\n",<br>
>                                radeon_crtc->flip_status,<br>
>                                RADEON_FLIP_SUBMITTED);<br>
> -             spin_unlock_irqrestore(&rdev->ddev->event_lock, flags);<br>
> +             spin_unlock_irqrestore(&rdev_to_drm(rdev)->event_lock, flags);<br>
>               return;<br>
>       }<br>
>   <br>
> @@ -334,7 +334,7 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id)<br>
>        */<br>
>       if (update_pending &&<br>
>           (DRM_SCANOUTPOS_VALID &<br>
> -          radeon_get_crtc_scanoutpos(rdev->ddev, crtc_id,<br>
> +          radeon_get_crtc_scanoutpos(rdev_to_drm(rdev), crtc_id,<br>
>                                       GET_DISTANCE_TO_VBLANKSTART,<br>
>                                       &vpos, &hpos, NULL, NULL,<br>
>                                       &rdev->mode_info.crtcs[crtc_id]->base.hwmode)) &&<br>
> @@ -347,7 +347,7 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id)<br>
>                */<br>
>               update_pending = 0;<br>
>       }<br>
> -     spin_unlock_irqrestore(&rdev->ddev->event_lock, flags);<br>
> +     spin_unlock_irqrestore(&rdev_to_drm(rdev)->event_lock, flags);<br>
>       if (!update_pending)<br>
>               radeon_crtc_handle_flip(rdev, crtc_id);<br>
>   }<br>
> @@ -370,14 +370,14 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)<br>
>       if (radeon_crtc == NULL)<br>
>               return;<br>
>   <br>
> -     spin_lock_irqsave(&rdev->ddev->event_lock, flags);<br>
> +     spin_lock_irqsave(&rdev_to_drm(rdev)->event_lock, flags);<br>
>       work = radeon_crtc->flip_work;<br>
>       if (radeon_crtc->flip_status != RADEON_FLIP_SUBMITTED) {<br>
>               DRM_DEBUG_DRIVER("radeon_crtc->flip_status = %d != "<br>
>                                "RADEON_FLIP_SUBMITTED(%d)\n",<br>
>                                radeon_crtc->flip_status,<br>
>                                RADEON_FLIP_SUBMITTED);<br>
> -             spin_unlock_irqrestore(&rdev->ddev->event_lock, flags);<br>
> +             spin_unlock_irqrestore(&rdev_to_drm(rdev)->event_lock, flags);<br>
>               return;<br>
>       }<br>
>   <br>
> @@ -389,7 +389,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)<br>
>       if (work->event)<br>
>               drm_crtc_send_vblank_event(&radeon_crtc->base, work->event);<br>
>   <br>
> -     spin_unlock_irqrestore(&rdev->ddev->event_lock, flags);<br>
> +     spin_unlock_irqrestore(&rdev_to_drm(rdev)->event_lock, flags);<br>
>   <br>
>       drm_crtc_vblank_put(&radeon_crtc->base);<br>
>       radeon_irq_kms_pflip_irq_put(rdev, work->crtc_id);<br>
> @@ -408,7 +408,7 @@ static void radeon_flip_work_func(struct work_struct *__work)<br>
>       struct radeon_flip_work *work =<br>
>               container_of(__work, struct radeon_flip_work, flip_work);<br>
>       struct radeon_device *rdev = work->rdev;<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[work->crtc_id];<br>
>   <br>
>       struct drm_crtc *crtc = &radeon_crtc->base;<br>
> @@ -1401,7 +1401,7 @@ static int radeon_modeset_create_props(struct radeon_device *rdev)<br>
>   <br>
>       if (rdev->is_atom_bios) {<br>
>               rdev->mode_info.coherent_mode_property =<br>
> -                     drm_property_create_range(rdev->ddev, 0 , "coherent", 0, 1);<br>
> +                     drm_property_create_range(rdev_to_drm(rdev), 0, "coherent", 0, 1);<br>
>               if (!rdev->mode_info.coherent_mode_property)<br>
>                       return -ENOMEM;<br>
>       }<br>
> @@ -1409,57 +1409,57 @@ static int radeon_modeset_create_props(struct radeon_device *rdev)<br>
>       if (!ASIC_IS_AVIVO(rdev)) {<br>
>               sz = ARRAY_SIZE(radeon_tmds_pll_enum_list);<br>
>               rdev->mode_info.tmds_pll_property =<br>
> -                     drm_property_create_enum(rdev->ddev, 0,<br>
> +                     drm_property_create_enum(rdev_to_drm(rdev), 0,<br>
>                                           "tmds_pll",<br>
>                                           radeon_tmds_pll_enum_list, sz);<br>
>       }<br>
>   <br>
>       rdev->mode_info.load_detect_property =<br>
> -             drm_property_create_range(rdev->ddev, 0, "load detection", 0, 1);<br>
> +             drm_property_create_range(rdev_to_drm(rdev), 0, "load detection", 0, 1);<br>
>       if (!rdev->mode_info.load_detect_property)<br>
>               return -ENOMEM;<br>
>   <br>
> -     drm_mode_create_scaling_mode_property(rdev->ddev);<br>
> +     drm_mode_create_scaling_mode_property(rdev_to_drm(rdev));<br>
>   <br>
>       sz = ARRAY_SIZE(radeon_tv_std_enum_list);<br>
>       rdev->mode_info.tv_std_property =<br>
> -             drm_property_create_enum(rdev->ddev, 0,<br>
> +             drm_property_create_enum(rdev_to_drm(rdev), 0,<br>
>                                   "tv standard",<br>
>                                   radeon_tv_std_enum_list, sz);<br>
>   <br>
>       sz = ARRAY_SIZE(radeon_underscan_enum_list);<br>
>       rdev->mode_info.underscan_property =<br>
> -             drm_property_create_enum(rdev->ddev, 0,<br>
> +             drm_property_create_enum(rdev_to_drm(rdev), 0,<br>
>                                   "underscan",<br>
>                                   radeon_underscan_enum_list, sz);<br>
>   <br>
>       rdev->mode_info.underscan_hborder_property =<br>
> -             drm_property_create_range(rdev->ddev, 0,<br>
> +             drm_property_create_range(rdev_to_drm(rdev), 0,<br>
>                                       "underscan hborder", 0, 128);<br>
>       if (!rdev->mode_info.underscan_hborder_property)<br>
>               return -ENOMEM;<br>
>   <br>
>       rdev->mode_info.underscan_vborder_property =<br>
> -             drm_property_create_range(rdev->ddev, 0,<br>
> +             drm_property_create_range(rdev_to_drm(rdev), 0,<br>
>                                       "underscan vborder", 0, 128);<br>
>       if (!rdev->mode_info.underscan_vborder_property)<br>
>               return -ENOMEM;<br>
>   <br>
>       sz = ARRAY_SIZE(radeon_audio_enum_list);<br>
>       rdev->mode_info.audio_property =<br>
> -             drm_property_create_enum(rdev->ddev, 0,<br>
> +             drm_property_create_enum(rdev_to_drm(rdev), 0,<br>
>                                        "audio",<br>
>                                        radeon_audio_enum_list, sz);<br>
>   <br>
>       sz = ARRAY_SIZE(radeon_dither_enum_list);<br>
>       rdev->mode_info.dither_property =<br>
> -             drm_property_create_enum(rdev->ddev, 0,<br>
> +             drm_property_create_enum(rdev_to_drm(rdev), 0,<br>
>                                        "dither",<br>
>                                        radeon_dither_enum_list, sz);<br>
>   <br>
>       sz = ARRAY_SIZE(radeon_output_csc_enum_list);<br>
>       rdev->mode_info.output_csc_property =<br>
> -             drm_property_create_enum(rdev->ddev, 0,<br>
> +             drm_property_create_enum(rdev_to_drm(rdev), 0,<br>
>                                        "output_csc",<br>
>                                        radeon_output_csc_enum_list, sz);<br>
>   <br>
> @@ -1578,29 +1578,29 @@ int radeon_modeset_init(struct radeon_device *rdev)<br>
>       int i;<br>
>       int ret;<br>
>   <br>
> -     drm_mode_config_init(rdev->ddev);<br>
> +     drm_mode_config_init(rdev_to_drm(rdev));<br>
>       rdev->mode_info.mode_config_initialized = true;<br>
>   <br>
> -     rdev->ddev->mode_config.funcs = &radeon_mode_funcs;<br>
> +     rdev_to_drm(rdev)->mode_config.funcs = &radeon_mode_funcs;<br>
>   <br>
>       if (radeon_use_pflipirq == 2 && rdev->family >= CHIP_R600)<br>
> -             rdev->ddev->mode_config.async_page_flip = true;<br>
> +             rdev_to_drm(rdev)->mode_config.async_page_flip = true;<br>
>   <br>
>       if (ASIC_IS_DCE5(rdev)) {<br>
> -             rdev->ddev->mode_config.max_width = 16384;<br>
> -             rdev->ddev->mode_config.max_height = 16384;<br>
> +             rdev_to_drm(rdev)->mode_config.max_width = 16384;<br>
> +             rdev_to_drm(rdev)->mode_config.max_height = 16384;<br>
>       } else if (ASIC_IS_AVIVO(rdev)) {<br>
> -             rdev->ddev->mode_config.max_width = 8192;<br>
> -             rdev->ddev->mode_config.max_height = 8192;<br>
> +             rdev_to_drm(rdev)->mode_config.max_width = 8192;<br>
> +             rdev_to_drm(rdev)->mode_config.max_height = 8192;<br>
>       } else {<br>
> -             rdev->ddev->mode_config.max_width = 4096;<br>
> -             rdev->ddev->mode_config.max_height = 4096;<br>
> +             rdev_to_drm(rdev)->mode_config.max_width = 4096;<br>
> +             rdev_to_drm(rdev)->mode_config.max_height = 4096;<br>
>       }<br>
>   <br>
> -     rdev->ddev->mode_config.preferred_depth = 24;<br>
> -     rdev->ddev->mode_config.prefer_shadow = 1;<br>
> +     rdev_to_drm(rdev)->mode_config.preferred_depth = 24;<br>
> +     rdev_to_drm(rdev)->mode_config.prefer_shadow = 1;<br>
>   <br>
> -     rdev->ddev->mode_config.fb_modifiers_not_supported = true;<br>
> +     rdev_to_drm(rdev)->mode_config.fb_modifiers_not_supported = true;<br>
>   <br>
>       ret = radeon_modeset_create_props(rdev);<br>
>       if (ret) {<br>
> @@ -1618,11 +1618,11 @@ int radeon_modeset_init(struct radeon_device *rdev)<br>
>   <br>
>       /* allocate crtcs */<br>
>       for (i = 0; i < rdev->num_crtc; i++) {<br>
> -             radeon_crtc_init(rdev->ddev, i);<br>
> +             radeon_crtc_init(rdev_to_drm(rdev), i);<br>
>       }<br>
>   <br>
>       /* okay we should have all the bios connectors */<br>
> -     ret = radeon_setup_enc_conn(rdev->ddev);<br>
> +     ret = radeon_setup_enc_conn(rdev_to_drm(rdev));<br>
>       if (!ret) {<br>
>               return ret;<br>
>       }<br>
> @@ -1639,7 +1639,7 @@ int radeon_modeset_init(struct radeon_device *rdev)<br>
>       /* setup afmt */<br>
>       radeon_afmt_init(rdev);<br>
>   <br>
> -     drm_kms_helper_poll_init(rdev->ddev);<br>
> +     drm_kms_helper_poll_init(rdev_to_drm(rdev));<br>
>   <br>
>       /* do pm late init */<br>
>       ret = radeon_pm_late_init(rdev);<br>
> @@ -1650,11 +1650,11 @@ int radeon_modeset_init(struct radeon_device *rdev)<br>
>   void radeon_modeset_fini(struct radeon_device *rdev)<br>
>   {<br>
>       if (rdev->mode_info.mode_config_initialized) {<br>
> -             drm_kms_helper_poll_fini(rdev->ddev);<br>
> +             drm_kms_helper_poll_fini(rdev_to_drm(rdev));<br>
>               radeon_hpd_fini(rdev);<br>
> -             drm_helper_force_disable_all(rdev->ddev);<br>
> +             drm_helper_force_disable_all(rdev_to_drm(rdev));<br>
>               radeon_afmt_fini(rdev);<br>
> -             drm_mode_config_cleanup(rdev->ddev);<br>
> +             drm_mode_config_cleanup(rdev_to_drm(rdev));<br>
>               rdev->mode_info.mode_config_initialized = false;<br>
>       }<br>
>   <br>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c<br>
> index 7bf08164140e..89941a90e17f 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_drv.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c<br>
> @@ -259,7 +259,8 @@ static int radeon_pci_probe(struct pci_dev *pdev,<br>
>                           const struct pci_device_id *ent)<br>
>   {<br>
>       unsigned long flags = 0;<br>
> -     struct drm_device *dev;<br>
> +     struct drm_device *ddev;<br>
> +     struct radeon_device *rdev;<br>
>       int ret;<br>
>   <br>
>       if (!ent)<br>
> @@ -300,28 +301,36 @@ static int radeon_pci_probe(struct pci_dev *pdev,<br>
>       if (ret)<br>
>               return ret;<br>
>   <br>
> -     dev = drm_dev_alloc(&kms_driver, &pdev->dev);<br>
> -     if (IS_ERR(dev))<br>
> -             return PTR_ERR(dev);<br>
> +     rdev = devm_drm_dev_alloc(&pdev->dev, &kms_driver, typeof(*rdev), ddev);<br>
> +     if (IS_ERR(rdev))<br>
> +             return PTR_ERR(rdev);<br>
> +<br>
> +     rdev->dev  = &pdev->dev;<br>
> +     rdev->pdev = pdev;<br>
> +     ddev = rdev_to_drm(rdev);<br>
>   <br>
>       ret = pci_enable_device(pdev);<br>
>       if (ret)<br>
>               goto err_free;<br>
>   <br>
> -     pci_set_drvdata(pdev, dev);<br>
> +     pci_set_drvdata(pdev, ddev);<br>
> +<br>
> +     ret = radeon_driver_load_kms(rdev, flags);<br>
> +     if (ret)<br>
> +             goto err_agp;<br>
>   <br>
> -     ret = drm_dev_register(dev, ent->driver_data);<br>
> +     ret = drm_dev_register(ddev, flags);<br>
>       if (ret)<br>
>               goto err_agp;<br>
>   <br>
> -     radeon_fbdev_setup(dev->dev_private);<br>
> +     radeon_fbdev_setup(ddev->dev_private);<br>
>   <br>
>       return 0;<br>
>   <br>
>   err_agp:<br>
>       pci_disable_device(pdev);<br>
>   err_free:<br>
> -     drm_dev_put(dev);<br>
> +     drm_dev_put(ddev);<br>
>       return ret;<br>
>   }<br>
>   <br>
> @@ -569,7 +578,7 @@ static const struct drm_ioctl_desc radeon_ioctls_kms[] = {<br>
>   static const struct drm_driver kms_driver = {<br>
>       .driver_features =<br>
>           DRIVER_GEM | DRIVER_RENDER | DRIVER_MODESET,<br>
> -     .load = radeon_driver_load_kms,<br>
> +     // .load = radeon_driver_load_kms,<br>
>       .open = radeon_driver_open_kms,<br>
>       .postclose = radeon_driver_postclose_kms,<br>
>       .unload = radeon_driver_unload_kms,<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h<br>
> index 02a65971d140..6c1eb75a951b 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_drv.h<br>
> +++ b/drivers/gpu/drm/radeon/radeon_drv.h<br>
> @@ -117,7 +117,6 @@<br>
>   long radeon_drm_ioctl(struct file *filp,<br>
>                     unsigned int cmd, unsigned long arg);<br>
>   <br>
> -int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);<br>
>   void radeon_driver_unload_kms(struct drm_device *dev);<br>
>   int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv);<br>
>   void radeon_driver_postclose_kms(struct drm_device *dev,<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_fbdev.c b/drivers/gpu/drm/radeon/radeon_fbdev.c<br>
> index 02bf25759059..fb70de29545c 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_fbdev.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_fbdev.c<br>
> @@ -67,7 +67,7 @@ static int radeon_fbdev_create_pinned_object(struct drm_fb_helper *fb_helper,<br>
>       int height = mode_cmd->height;<br>
>       u32 cpp;<br>
>   <br>
> -     info = drm_get_format_info(rdev->ddev, mode_cmd);<br>
> +     info = drm_get_format_info(rdev_to_drm(rdev), mode_cmd);<br>
>       cpp = info->cpp[0];<br>
>   <br>
>       /* need to align pitch with crtc limits */<br>
> @@ -148,15 +148,15 @@ static int radeon_fbdev_fb_open(struct fb_info *info, int user)<br>
>       struct radeon_device *rdev = fb_helper->dev->dev_private;<br>
>       int ret;<br>
>   <br>
> -     ret = pm_runtime_get_sync(rdev->ddev->dev);<br>
> +     ret = pm_runtime_get_sync(rdev_to_drm(rdev)->dev);<br>
>       if (ret < 0 && ret != -EACCES)<br>
>               goto err_pm_runtime_mark_last_busy;<br>
>   <br>
>       return 0;<br>
>   <br>
>   err_pm_runtime_mark_last_busy:<br>
> -     pm_runtime_mark_last_busy(rdev->ddev->dev);<br>
> -     pm_runtime_put_autosuspend(rdev->ddev->dev);<br>
> +     pm_runtime_mark_last_busy(rdev_to_drm(rdev)->dev);<br>
> +     pm_runtime_put_autosuspend(rdev_to_drm(rdev)->dev);<br>
>       return ret;<br>
>   }<br>
>   <br>
> @@ -165,8 +165,8 @@ static int radeon_fbdev_fb_release(struct fb_info *info, int user)<br>
>       struct drm_fb_helper *fb_helper = info->par;<br>
>       struct radeon_device *rdev = fb_helper->dev->dev_private;<br>
>   <br>
> -     pm_runtime_mark_last_busy(rdev->ddev->dev);<br>
> -     pm_runtime_put_autosuspend(rdev->ddev->dev);<br>
> +     pm_runtime_mark_last_busy(rdev_to_drm(rdev)->dev);<br>
> +     pm_runtime_put_autosuspend(rdev_to_drm(rdev)->dev);<br>
>   <br>
>       return 0;<br>
>   }<br>
> @@ -236,7 +236,7 @@ static int radeon_fbdev_fb_helper_fb_probe(struct drm_fb_helper *fb_helper,<br>
>               ret = -ENOMEM;<br>
>               goto err_radeon_fbdev_destroy_pinned_object;<br>
>       }<br>
> -     ret = radeon_framebuffer_init(rdev->ddev, fb, &mode_cmd, gobj);<br>
> +     ret = radeon_framebuffer_init(rdev_to_drm(rdev), fb, &mode_cmd, gobj);<br>
>       if (ret) {<br>
>               DRM_ERROR("failed to initialize framebuffer %d\n", ret);<br>
>               goto err_kfree;<br>
> @@ -374,12 +374,12 @@ void radeon_fbdev_setup(struct radeon_device *rdev)<br>
>       fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);<br>
>       if (!fb_helper)<br>
>               return;<br>
> -     drm_fb_helper_prepare(rdev->ddev, fb_helper, bpp_sel, &radeon_fbdev_fb_helper_funcs);<br>
> +     drm_fb_helper_prepare(rdev_to_drm(rdev), fb_helper, bpp_sel, &radeon_fbdev_fb_helper_funcs);<br>
>   <br>
> -     ret = drm_client_init(rdev->ddev, &fb_helper->client, "radeon-fbdev",<br>
> +     ret = drm_client_init(rdev_to_drm(rdev), &fb_helper->client, "radeon-fbdev",<br>
>                             &radeon_fbdev_client_funcs);<br>
>       if (ret) {<br>
> -             drm_err(rdev->ddev, "Failed to register client: %d\n", ret);<br>
> +             drm_err(rdev_to_drm(rdev), "Failed to register client: %d\n", ret);<br>
>               goto err_drm_client_init;<br>
>       }<br>
>   <br>
> @@ -394,13 +394,13 @@ void radeon_fbdev_setup(struct radeon_device *rdev)<br>
>   <br>
>   void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state)<br>
>   {<br>
> -     if (rdev->ddev->fb_helper)<br>
> -             drm_fb_helper_set_suspend(rdev->ddev->fb_helper, state);<br>
> +     if (rdev_to_drm(rdev)->fb_helper)<br>
> +             drm_fb_helper_set_suspend(rdev_to_drm(rdev)->fb_helper, state);<br>
>   }<br>
>   <br>
>   bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)<br>
>   {<br>
> -     struct drm_fb_helper *fb_helper = rdev->ddev->fb_helper;<br>
> +     struct drm_fb_helper *fb_helper = rdev_to_drm(rdev)->fb_helper;<br>
>       struct drm_gem_object *gobj;<br>
>   <br>
>       if (!fb_helper)<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c<br>
> index 4fb780d96f32..daff61586be5 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_fence.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_fence.c<br>
> @@ -150,7 +150,7 @@ int radeon_fence_emit(struct radeon_device *rdev,<br>
>                      rdev->fence_context + ring,<br>
>                      seq);<br>
>       radeon_fence_ring_emit(rdev, ring, *fence);<br>
> -     trace_radeon_fence_emit(rdev->ddev, ring, (*fence)->seq);<br>
> +     trace_radeon_fence_emit(rdev_to_drm(rdev), ring, (*fence)->seq);<br>
>       radeon_fence_schedule_check(rdev, ring);<br>
>       return 0;<br>
>   }<br>
> @@ -489,7 +489,7 @@ static long radeon_fence_wait_seq_timeout(struct radeon_device *rdev,<br>
>               if (!target_seq[i])<br>
>                       continue;<br>
>   <br>
> -             trace_radeon_fence_wait_begin(rdev->ddev, i, target_seq[i]);<br>
> +             trace_radeon_fence_wait_begin(rdev_to_drm(rdev), i, target_seq[i]);<br>
>               radeon_irq_kms_sw_irq_get(rdev, i);<br>
>       }<br>
>   <br>
> @@ -511,7 +511,7 @@ static long radeon_fence_wait_seq_timeout(struct radeon_device *rdev,<br>
>                       continue;<br>
>   <br>
>               radeon_irq_kms_sw_irq_put(rdev, i);<br>
> -             trace_radeon_fence_wait_end(rdev->ddev, i, target_seq[i]);<br>
> +             trace_radeon_fence_wait_end(rdev_to_drm(rdev), i, target_seq[i]);<br>
>       }<br>
>   <br>
>       return r;<br>
> @@ -995,7 +995,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(radeon_debugfs_gpu_reset_fops,<br>
>   void radeon_debugfs_fence_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("radeon_gpu_reset", 0444, root, rdev,<br>
>                           &radeon_debugfs_gpu_reset_fops);<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c<br>
> index 2ef201a072f1..9dd4ff09d562 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_gem.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_gem.c<br>
> @@ -899,7 +899,7 @@ DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_gem_info);<br>
>   void radeon_gem_debugfs_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("radeon_gem_info", 0444, root, rdev,<br>
>                           &radeon_debugfs_gem_info_fops);<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c<br>
> index 3d174390a8af..1f16619ed06e 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_i2c.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_i2c.c<br>
> @@ -1011,7 +1011,7 @@ void radeon_i2c_add(struct radeon_device *rdev,<br>
>                   struct radeon_i2c_bus_rec *rec,<br>
>                   const char *name)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       int i;<br>
>   <br>
>       for (i = 0; i < RADEON_MAX_I2C_BUS; i++) {<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_ib.c b/drivers/gpu/drm/radeon/radeon_ib.c<br>
> index 63d914f3414d..1aa41cc3f991 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_ib.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_ib.c<br>
> @@ -309,7 +309,7 @@ DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_sa_info);<br>
>   static void radeon_debugfs_sa_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("radeon_sa_info", 0444, root, rdev,<br>
>                           &radeon_debugfs_sa_info_fops);<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c<br>
> index c4dda908666c..9961251b44ba 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c<br>
> @@ -80,7 +80,7 @@ static void radeon_hotplug_work_func(struct work_struct *work)<br>
>   {<br>
>       struct radeon_device *rdev = container_of(work, struct radeon_device,<br>
>                                                 <a href="http://hotplug_work.work" rel="noreferrer" target="_blank">hotplug_work.work</a>);<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_mode_config *mode_config = &dev->mode_config;<br>
>       struct drm_connector *connector;<br>
>   <br>
> @@ -101,7 +101,7 @@ static void radeon_dp_work_func(struct work_struct *work)<br>
>   {<br>
>       struct radeon_device *rdev = container_of(work, struct radeon_device,<br>
>                                                 dp_work);<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_mode_config *mode_config = &dev->mode_config;<br>
>       struct drm_connector *connector;<br>
>   <br>
> @@ -197,7 +197,7 @@ static void radeon_driver_irq_uninstall_kms(struct drm_device *dev)<br>
>   <br>
>   static int radeon_irq_install(struct radeon_device *rdev, int irq)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       int ret;<br>
>   <br>
>       if (irq == IRQ_NOTCONNECTED)<br>
> @@ -218,7 +218,7 @@ static int radeon_irq_install(struct radeon_device *rdev, int irq)<br>
>   <br>
>   static void radeon_irq_uninstall(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct pci_dev *pdev = to_pci_dev(dev->dev);<br>
>   <br>
>       radeon_driver_irq_uninstall_kms(dev);<br>
> @@ -322,9 +322,9 @@ int radeon_irq_kms_init(struct radeon_device *rdev)<br>
>       spin_lock_init(&rdev->irq.lock);<br>
>   <br>
>       /* Disable vblank irqs aggressively for power-saving */<br>
> -     rdev->ddev->vblank_disable_immediate = true;<br>
> +     rdev_to_drm(rdev)->vblank_disable_immediate = true;<br>
>   <br>
> -     r = drm_vblank_init(rdev->ddev, rdev->num_crtc);<br>
> +     r = drm_vblank_init(rdev_to_drm(rdev), rdev->num_crtc);<br>
>       if (r) {<br>
>               return r;<br>
>       }<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c<br>
> index a16590c6247f..171f8e9fce88 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_kms.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c<br>
> @@ -101,24 +101,18 @@ void radeon_driver_unload_kms(struct drm_device *dev)<br>
>    * (crtcs, encoders, hotplug detect, etc.).<br>
>    * Returns 0 on success, error on failure.<br>
>    */<br>
> -int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)<br>
> +int radeon_driver_load_kms(struct radeon_device *rdev, unsigned long flags)<br>
>   {<br>
> -     struct pci_dev *pdev = to_pci_dev(dev->dev);<br>
> -     struct radeon_device *rdev;<br>
> +     struct pci_dev *pdev = rdev->pdev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       int r, acpi_status;<br>
>   <br>
> -     rdev = kzalloc(sizeof(struct radeon_device), GFP_KERNEL);<br>
> -     if (rdev == NULL) {<br>
> -             return -ENOMEM;<br>
> -     }<br>
> -     dev->dev_private = (void *)rdev;<br>
> -<br>
>   #ifdef __alpha__<br>
>       rdev->hose = pdev->sysdata;<br>
>   #endif<br>
>   <br>
>       if (pci_find_capability(pdev, PCI_CAP_ID_AGP))<br>
> -             rdev->agp = radeon_agp_head_init(dev);<br>
> +             rdev->agp = radeon_agp_head_init(rdev_to_drm(rdev));<br>
>       if (rdev->agp) {<br>
>               rdev->agp->agp_mtrr = arch_phys_wc_add(<br>
>                       rdev->agp->agp_info.aper_base,<br>
> @@ -147,7 +141,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)<br>
>        * properly initialize the GPU MC controller and permit<br>
>        * VRAM allocation<br>
>        */<br>
> -     r = radeon_device_init(rdev, dev, pdev, flags);<br>
> +     r = radeon_device_init(rdev, flags);<br>
>       if (r) {<br>
>               dev_err(dev->dev, "Fatal error during GPU init\n");<br>
>               goto out;<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c<br>
> index a955f8a2f7fe..450ff7daa46c 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_object.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_object.c<br>
> @@ -150,7 +150,7 @@ int radeon_bo_create(struct radeon_device *rdev,<br>
>       bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL);<br>
>       if (bo == NULL)<br>
>               return -ENOMEM;<br>
> -     drm_gem_private_object_init(rdev->ddev, &bo->tbo.base, size);<br>
> +     drm_gem_private_object_init(rdev_to_drm(rdev), &bo->tbo.base, size);<br>
>       bo->rdev = rdev;<br>
>       bo->surface_reg = -1;<br>
>       INIT_LIST_HEAD(&bo->list);<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c<br>
> index 2d9d9f46f243..b4fb7e70320b 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_pm.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_pm.c<br>
> @@ -282,7 +282,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)<br>
>   <br>
>       if (rdev->irq.installed) {<br>
>               i = 0;<br>
> -             drm_for_each_crtc(crtc, rdev->ddev) {<br>
> +             drm_for_each_crtc(crtc, rdev_to_drm(rdev)) {<br>
>                       if (rdev->pm.active_crtcs & (1 << i)) {<br>
>                               /* This can fail if a modeset is in progress */<br>
>                               if (drm_crtc_vblank_get(crtc) == 0)<br>
> @@ -299,7 +299,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)<br>
>   <br>
>       if (rdev->irq.installed) {<br>
>               i = 0;<br>
> -             drm_for_each_crtc(crtc, rdev->ddev) {<br>
> +             drm_for_each_crtc(crtc, rdev_to_drm(rdev)) {<br>
>                       if (rdev->pm.req_vblank & (1 << i)) {<br>
>                               rdev->pm.req_vblank &= ~(1 << i);<br>
>                               drm_crtc_vblank_put(crtc);<br>
> @@ -671,7 +671,7 @@ static ssize_t radeon_hwmon_show_temp(struct device *dev,<br>
>                                     char *buf)<br>
>   {<br>
>       struct radeon_device *rdev = dev_get_drvdata(dev);<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       int temp;<br>
>   <br>
>       /* Can't get temperature when the card is off */<br>
> @@ -715,7 +715,7 @@ static ssize_t radeon_hwmon_show_sclk(struct device *dev,<br>
>                                     struct device_attribute *attr, char *buf)<br>
>   {<br>
>       struct radeon_device *rdev = dev_get_drvdata(dev);<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       u32 sclk = 0;<br>
>   <br>
>       /* Can't get clock frequency when the card is off */<br>
> @@ -740,7 +740,7 @@ static ssize_t radeon_hwmon_show_vddc(struct device *dev,<br>
>                                     struct device_attribute *attr, char *buf)<br>
>   {<br>
>       struct radeon_device *rdev = dev_get_drvdata(dev);<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       u16 vddc = 0;<br>
>   <br>
>       /* Can't get vddc when the card is off */<br>
> @@ -1692,7 +1692,7 @@ void radeon_pm_fini(struct radeon_device *rdev)<br>
>   <br>
>   static void radeon_pm_compute_clocks_old(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       struct drm_crtc *crtc;<br>
>       struct radeon_crtc *radeon_crtc;<br>
>   <br>
> @@ -1765,7 +1765,7 @@ static void radeon_pm_compute_clocks_old(struct radeon_device *rdev)<br>
>   <br>
>   static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       struct drm_crtc *crtc;<br>
>       struct radeon_crtc *radeon_crtc;<br>
>       struct radeon_connector *radeon_connector;<br>
> @@ -1826,7 +1826,7 @@ static bool radeon_pm_in_vbl(struct radeon_device *rdev)<br>
>        */<br>
>       for (crtc = 0; (crtc < rdev->num_crtc) && in_vbl; crtc++) {<br>
>               if (rdev->pm.active_crtcs & (1 << crtc)) {<br>
> -                     vbl_status = radeon_get_crtc_scanoutpos(rdev->ddev,<br>
> +                     vbl_status = radeon_get_crtc_scanoutpos(rdev_to_drm(rdev),<br>
>                                                               crtc,<br>
>                                                               USE_REAL_VBLANKSTART,<br>
>                                                               &vpos, &hpos, NULL, NULL,<br>
> @@ -1918,7 +1918,7 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)<br>
>   static int radeon_debugfs_pm_info_show(struct seq_file *m, void *unused)<br>
>   {<br>
>       struct radeon_device *rdev = m->private;<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>   <br>
>       if  ((rdev->flags & RADEON_IS_PX) &&<br>
>            (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) {<br>
> @@ -1955,7 +1955,7 @@ DEFINE_SHOW_ATTRIBUTE(radeon_debugfs_pm_info);<br>
>   static void radeon_debugfs_pm_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("radeon_pm_info", 0444, root, rdev,<br>
>                           &radeon_debugfs_pm_info_fops);<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c<br>
> index 8d1d458286a8..581ae20c46e4 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_ring.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_ring.c<br>
> @@ -550,7 +550,7 @@ static void radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_r<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
>       const char *ring_name = radeon_debugfs_ring_idx_to_name(ring->idx);<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       if (ring_name)<br>
>               debugfs_create_file(ring_name, 0444, root, ring,<br>
> diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c<br>
> index 5c65b6dfb99a..69d0c12fa419 100644<br>
> --- a/drivers/gpu/drm/radeon/radeon_ttm.c<br>
> +++ b/drivers/gpu/drm/radeon/radeon_ttm.c<br>
> @@ -682,8 +682,8 @@ int radeon_ttm_init(struct radeon_device *rdev)<br>
>   <br>
>       /* No others user of address space so set it to 0 */<br>
>       r = ttm_device_init(&rdev->mman.bdev, &radeon_bo_driver, rdev->dev,<br>
> -                            rdev->ddev->anon_inode->i_mapping,<br>
> -                            rdev->ddev->vma_offset_manager,<br>
> +                            rdev_to_drm(rdev)->anon_inode->i_mapping,<br>
> +                            rdev_to_drm(rdev)->vma_offset_manager,<br>
>                              rdev->need_swiotlb,<br>
>                              dma_addressing_limited(&rdev->pdev->dev));<br>
>       if (r) {<br>
> @@ -890,7 +890,7 @@ static const struct file_operations radeon_ttm_gtt_fops = {<br>
>   static void radeon_ttm_debugfs_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct drm_minor *minor = rdev->ddev->primary;<br>
> +     struct drm_minor *minor = rdev_to_drm(rdev)->primary;<br>
>       struct dentry *root = minor->debugfs_root;<br>
>   <br>
>       debugfs_create_file("radeon_vram", 0444, root, rdev,<br>
> diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c<br>
> index d4d1501e6576..d6c18fd740ec 100644<br>
> --- a/drivers/gpu/drm/radeon/rs400.c<br>
> +++ b/drivers/gpu/drm/radeon/rs400.c<br>
> @@ -379,7 +379,7 @@ DEFINE_SHOW_ATTRIBUTE(rs400_debugfs_gart_info);<br>
>   static void rs400_debugfs_pcie_gart_info_init(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("rs400_gart_info", 0444, root, rdev,<br>
>                           &rs400_debugfs_gart_info_fops);<br>
> @@ -474,7 +474,7 @@ int rs400_resume(struct radeon_device *rdev)<br>
>                       RREG32(R_0007C0_CP_STAT));<br>
>       }<br>
>       /* post */<br>
> -     radeon_combios_asic_init(rdev->ddev);<br>
> +     radeon_combios_asic_init(rdev_to_drm(rdev));<br>
>       /* Resume clock after posting */<br>
>       r300_clock_startup(rdev);<br>
>       /* Initialize surface registers */<br>
> @@ -552,7 +552,7 @@ int rs400_init(struct radeon_device *rdev)<br>
>               return -EINVAL;<br>
>   <br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* initialize memory controller */<br>
>       rs400_mc_init(rdev);<br>
>       /* Fence driver */<br>
> diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c<br>
> index 5c162778899b..88c8e91ea651 100644<br>
> --- a/drivers/gpu/drm/radeon/rs600.c<br>
> +++ b/drivers/gpu/drm/radeon/rs600.c<br>
> @@ -321,7 +321,7 @@ void rs600_pm_misc(struct radeon_device *rdev)<br>
>   <br>
>   void rs600_pm_prepare(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       struct drm_crtc *crtc;<br>
>       struct radeon_crtc *radeon_crtc;<br>
>       u32 tmp;<br>
> @@ -339,7 +339,7 @@ void rs600_pm_prepare(struct radeon_device *rdev)<br>
>   <br>
>   void rs600_pm_finish(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *ddev = rdev->ddev;<br>
> +     struct drm_device *ddev = rdev_to_drm(rdev);<br>
>       struct drm_crtc *crtc;<br>
>       struct radeon_crtc *radeon_crtc;<br>
>       u32 tmp;<br>
> @@ -408,7 +408,7 @@ void rs600_hpd_set_polarity(struct radeon_device *rdev,<br>
>   <br>
>   void rs600_hpd_init(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_connector *connector;<br>
>       unsigned enable = 0;<br>
>   <br>
> @@ -435,7 +435,7 @@ void rs600_hpd_init(struct radeon_device *rdev)<br>
>   <br>
>   void rs600_hpd_fini(struct radeon_device *rdev)<br>
>   {<br>
> -     struct drm_device *dev = rdev->ddev;<br>
> +     struct drm_device *dev = rdev_to_drm(rdev);<br>
>       struct drm_connector *connector;<br>
>       unsigned disable = 0;<br>
>   <br>
> @@ -797,7 +797,7 @@ int rs600_irq_process(struct radeon_device *rdev)<br>
>               /* Vertical blank interrupts */<br>
>               if (G_007EDC_LB_D1_VBLANK_INTERRUPT(rdev->irq.stat_regs.r500.disp_int)) {<br>
>                       if (rdev->irq.crtc_vblank_int[0]) {<br>
> -                             drm_handle_vblank(rdev->ddev, 0);<br>
> +                             drm_handle_vblank(rdev_to_drm(rdev), 0);<br>
>                               rdev->pm.vblank_sync = true;<br>
>                               wake_up(&rdev->irq.vblank_queue);<br>
>                       }<br>
> @@ -806,7 +806,7 @@ int rs600_irq_process(struct radeon_device *rdev)<br>
>               }<br>
>               if (G_007EDC_LB_D2_VBLANK_INTERRUPT(rdev->irq.stat_regs.r500.disp_int)) {<br>
>                       if (rdev->irq.crtc_vblank_int[1]) {<br>
> -                             drm_handle_vblank(rdev->ddev, 1);<br>
> +                             drm_handle_vblank(rdev_to_drm(rdev), 1);<br>
>                               rdev->pm.vblank_sync = true;<br>
>                               wake_up(&rdev->irq.vblank_queue);<br>
>                       }<br>
> @@ -1133,7 +1133,7 @@ int rs600_init(struct radeon_device *rdev)<br>
>               return -EINVAL;<br>
>   <br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* initialize memory controller */<br>
>       rs600_mc_init(rdev);<br>
>       r100_debugfs_rbbm_init(rdev);<br>
> diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c<br>
> index 14fb0819b8c1..016eb4992803 100644<br>
> --- a/drivers/gpu/drm/radeon/rs690.c<br>
> +++ b/drivers/gpu/drm/radeon/rs690.c<br>
> @@ -845,7 +845,7 @@ int rs690_init(struct radeon_device *rdev)<br>
>               return -EINVAL;<br>
>   <br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* initialize memory controller */<br>
>       rs690_mc_init(rdev);<br>
>       rv515_debugfs(rdev);<br>
> diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c<br>
> index bbc6ccabf788..1b4dfb645585 100644<br>
> --- a/drivers/gpu/drm/radeon/rv515.c<br>
> +++ b/drivers/gpu/drm/radeon/rv515.c<br>
> @@ -255,7 +255,7 @@ DEFINE_SHOW_ATTRIBUTE(rv515_debugfs_ga_info);<br>
>   void rv515_debugfs(struct radeon_device *rdev)<br>
>   {<br>
>   #if defined(CONFIG_DEBUG_FS)<br>
> -     struct dentry *root = rdev->ddev->primary->debugfs_root;<br>
> +     struct dentry *root = rdev_to_drm(rdev)->primary->debugfs_root;<br>
>   <br>
>       debugfs_create_file("rv515_pipes_info", 0444, root, rdev,<br>
>                           &rv515_debugfs_pipes_info_fops);<br>
> @@ -636,7 +636,7 @@ int rv515_init(struct radeon_device *rdev)<br>
>       if (radeon_boot_test_post_card(rdev) == false)<br>
>               return -EINVAL;<br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* initialize AGP */<br>
>       if (rdev->flags & RADEON_IS_AGP) {<br>
>               r = radeon_agp_init(rdev);<br>
> diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c<br>
> index 9ce12fa3c356..7d4b0bf59109 100644<br>
> --- a/drivers/gpu/drm/radeon/rv770.c<br>
> +++ b/drivers/gpu/drm/radeon/rv770.c<br>
> @@ -1935,7 +1935,7 @@ int rv770_init(struct radeon_device *rdev)<br>
>       /* Initialize surface registers */<br>
>       radeon_surface_init(rdev);<br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>       /* Fence driver */<br>
>       radeon_fence_driver_init(rdev);<br>
>       /* initialize AGP */<br>
> diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c<br>
> index 15759c8ca5b7..6c95575ce109 100644<br>
> --- a/drivers/gpu/drm/radeon/si.c<br>
> +++ b/drivers/gpu/drm/radeon/si.c<br>
> @@ -6277,7 +6277,7 @@ int si_irq_process(struct radeon_device *rdev)<br>
>                               event_name = "vblank";<br>
>   <br>
>                               if (rdev->irq.crtc_vblank_int[crtc_idx]) {<br>
> -                                     drm_handle_vblank(rdev->ddev, crtc_idx);<br>
> +                                     drm_handle_vblank(rdev_to_drm(rdev), crtc_idx);<br>
>                                       rdev->pm.vblank_sync = true;<br>
>                                       wake_up(&rdev->irq.vblank_queue);<br>
>                               }<br>
> @@ -6839,7 +6839,7 @@ int si_init(struct radeon_device *rdev)<br>
>       /* Initialize surface registers */<br>
>       radeon_surface_init(rdev);<br>
>       /* Initialize clocks */<br>
> -     radeon_get_clock_info(rdev->ddev);<br>
> +     radeon_get_clock_info(rdev_to_drm(rdev));<br>
>   <br>
>       /* Fence driver */<br>
>       radeon_fence_driver_init(rdev);<br>
<br>
</blockquote></div>