diff options
author | Alan Cox <alan@linux.intel.com> | 2012-05-14 07:04:00 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-05-17 06:05:30 -0400 |
commit | 4ab2c7f15423f313187b310a48ee0ac631c414f1 (patch) | |
tree | 41844429f95ed794a8b513beee8cf3a7d442d656 /drivers/gpu/drm/gma500 | |
parent | 6607e024014e4920e8d3e43bcfeec0436d43d980 (diff) |
gma500: unload fixes
Debugging the lid problem tested various error paths which were found
wanting so start fixing them up.
There is a ton of improvement work could be done here so that every bit
of functionality agrees if its _fini, _uninit, etc, and they agree who
is responsible for deciding if the clean up is needed.
That can come later.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/gma500')
-rw-r--r-- | drivers/gpu/drm/gma500/framebuffer.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/gma500/intel_bios.c | 24 | ||||
-rw-r--r-- | drivers/gpu/drm/gma500/psb_drv.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/gma500/psb_drv.h | 1 |
4 files changed, 20 insertions, 40 deletions
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c index 659ed3933b5b..8d77224afc34 100644 --- a/drivers/gpu/drm/gma500/framebuffer.c +++ b/drivers/gpu/drm/gma500/framebuffer.c | |||
@@ -800,15 +800,20 @@ void psb_modeset_init(struct drm_device *dev) | |||
800 | 800 | ||
801 | if (dev_priv->ops->errata) | 801 | if (dev_priv->ops->errata) |
802 | dev_priv->ops->errata(dev); | 802 | dev_priv->ops->errata(dev); |
803 | |||
804 | dev_priv->modeset = true; | ||
803 | } | 805 | } |
804 | 806 | ||
805 | void psb_modeset_cleanup(struct drm_device *dev) | 807 | void psb_modeset_cleanup(struct drm_device *dev) |
806 | { | 808 | { |
807 | mutex_lock(&dev->struct_mutex); | 809 | struct drm_psb_private *dev_priv = dev->dev_private; |
810 | if (dev_priv->modeset) { | ||
811 | mutex_lock(&dev->struct_mutex); | ||
808 | 812 | ||
809 | drm_kms_helper_poll_fini(dev); | 813 | drm_kms_helper_poll_fini(dev); |
810 | psb_fbdev_fini(dev); | 814 | psb_fbdev_fini(dev); |
811 | drm_mode_config_cleanup(dev); | 815 | drm_mode_config_cleanup(dev); |
812 | 816 | ||
813 | mutex_unlock(&dev->struct_mutex); | 817 | mutex_unlock(&dev->struct_mutex); |
818 | } | ||
814 | } | 819 | } |
diff --git a/drivers/gpu/drm/gma500/intel_bios.c b/drivers/gpu/drm/gma500/intel_bios.c index 479e4497d26c..973d7f6d66b7 100644 --- a/drivers/gpu/drm/gma500/intel_bios.c +++ b/drivers/gpu/drm/gma500/intel_bios.c | |||
@@ -490,26 +490,8 @@ bool psb_intel_init_bios(struct drm_device *dev) | |||
490 | void psb_intel_destroy_bios(struct drm_device *dev) | 490 | void psb_intel_destroy_bios(struct drm_device *dev) |
491 | { | 491 | { |
492 | struct drm_psb_private *dev_priv = dev->dev_private; | 492 | struct drm_psb_private *dev_priv = dev->dev_private; |
493 | struct drm_display_mode *sdvo_lvds_vbt_mode = | ||
494 | dev_priv->sdvo_lvds_vbt_mode; | ||
495 | struct drm_display_mode *lfp_lvds_vbt_mode = | ||
496 | dev_priv->lfp_lvds_vbt_mode; | ||
497 | struct bdb_lvds_backlight *lvds_bl = | ||
498 | dev_priv->lvds_bl; | ||
499 | |||
500 | /*free sdvo panel mode*/ | ||
501 | if (sdvo_lvds_vbt_mode) { | ||
502 | dev_priv->sdvo_lvds_vbt_mode = NULL; | ||
503 | kfree(sdvo_lvds_vbt_mode); | ||
504 | } | ||
505 | |||
506 | if (lfp_lvds_vbt_mode) { | ||
507 | dev_priv->lfp_lvds_vbt_mode = NULL; | ||
508 | kfree(lfp_lvds_vbt_mode); | ||
509 | } | ||
510 | 493 | ||
511 | if (lvds_bl) { | 494 | kfree(dev_priv->sdvo_lvds_vbt_mode); |
512 | dev_priv->lvds_bl = NULL; | 495 | kfree(dev_priv->lfp_lvds_vbt_mode); |
513 | kfree(lvds_bl); | 496 | kfree(dev_priv->lvds_bl); |
514 | } | ||
515 | } | 497 | } |
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index c4c6c8ea129a..0c995ba0f2ec 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c | |||
@@ -152,10 +152,6 @@ static void psb_lastclose(struct drm_device *dev) | |||
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | 154 | ||
155 | static void psb_do_takedown(struct drm_device *dev) | ||
156 | { | ||
157 | } | ||
158 | |||
159 | static int psb_do_init(struct drm_device *dev) | 155 | static int psb_do_init(struct drm_device *dev) |
160 | { | 156 | { |
161 | struct drm_psb_private *dev_priv = dev->dev_private; | 157 | struct drm_psb_private *dev_priv = dev->dev_private; |
@@ -194,7 +190,6 @@ static int psb_do_init(struct drm_device *dev) | |||
194 | PSB_WSGX32(pg->gatt_start, PSB_CR_BIF_TWOD_REQ_BASE); | 190 | PSB_WSGX32(pg->gatt_start, PSB_CR_BIF_TWOD_REQ_BASE); |
195 | return 0; | 191 | return 0; |
196 | out_err: | 192 | out_err: |
197 | psb_do_takedown(dev); | ||
198 | return ret; | 193 | return ret; |
199 | } | 194 | } |
200 | 195 | ||
@@ -204,17 +199,16 @@ static int psb_driver_unload(struct drm_device *dev) | |||
204 | 199 | ||
205 | /* Kill vblank etc here */ | 200 | /* Kill vblank etc here */ |
206 | 201 | ||
207 | gma_backlight_exit(dev); | ||
208 | psb_modeset_cleanup(dev); | ||
209 | 202 | ||
210 | if (dev_priv) { | 203 | if (dev_priv) { |
204 | if (dev_priv->backlight_device) | ||
205 | gma_backlight_exit(dev); | ||
206 | psb_modeset_cleanup(dev); | ||
211 | 207 | ||
212 | if (dev_priv->ops->chip_teardown) | 208 | if (dev_priv->ops->chip_teardown) |
213 | dev_priv->ops->chip_teardown(dev); | 209 | dev_priv->ops->chip_teardown(dev); |
214 | 210 | ||
215 | psb_intel_opregion_fini(dev); | 211 | psb_intel_opregion_fini(dev); |
216 | psb_do_takedown(dev); | ||
217 | |||
218 | 212 | ||
219 | if (dev_priv->pf_pd) { | 213 | if (dev_priv->pf_pd) { |
220 | psb_mmu_free_pagedir(dev_priv->pf_pd); | 214 | psb_mmu_free_pagedir(dev_priv->pf_pd); |
@@ -248,15 +242,13 @@ static int psb_driver_unload(struct drm_device *dev) | |||
248 | dev_priv->sgx_reg = NULL; | 242 | dev_priv->sgx_reg = NULL; |
249 | } | 243 | } |
250 | 244 | ||
245 | /* Destroy VBT data */ | ||
246 | psb_intel_destroy_bios(dev); | ||
247 | |||
251 | kfree(dev_priv); | 248 | kfree(dev_priv); |
252 | dev->dev_private = NULL; | 249 | dev->dev_private = NULL; |
253 | |||
254 | /*destroy VBT data*/ | ||
255 | psb_intel_destroy_bios(dev); | ||
256 | } | 250 | } |
257 | |||
258 | gma_power_uninit(dev); | 251 | gma_power_uninit(dev); |
259 | |||
260 | return 0; | 252 | return 0; |
261 | } | 253 | } |
262 | 254 | ||
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h index fd1bc8f6bf97..a1b0c0bce972 100644 --- a/drivers/gpu/drm/gma500/psb_drv.h +++ b/drivers/gpu/drm/gma500/psb_drv.h | |||
@@ -507,6 +507,7 @@ struct drm_psb_private { | |||
507 | * Modesetting | 507 | * Modesetting |
508 | */ | 508 | */ |
509 | struct psb_intel_mode_device mode_dev; | 509 | struct psb_intel_mode_device mode_dev; |
510 | bool modeset; /* true if we have done the mode_device setup */ | ||
510 | 511 | ||
511 | struct drm_crtc *plane_to_crtc_mapping[PSB_NUM_PIPE]; | 512 | struct drm_crtc *plane_to_crtc_mapping[PSB_NUM_PIPE]; |
512 | struct drm_crtc *pipe_to_crtc_mapping[PSB_NUM_PIPE]; | 513 | struct drm_crtc *pipe_to_crtc_mapping[PSB_NUM_PIPE]; |