diff options
Diffstat (limited to 'drivers/gpu/drm/drm_fb_helper.c')
| -rw-r--r-- | drivers/gpu/drm/drm_fb_helper.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index cf775a4449c1..dc386ebe5193 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
| @@ -145,6 +145,31 @@ int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_ | |||
| 145 | } | 145 | } |
| 146 | EXPORT_SYMBOL(drm_fb_helper_add_one_connector); | 146 | EXPORT_SYMBOL(drm_fb_helper_add_one_connector); |
| 147 | 147 | ||
| 148 | static void remove_from_modeset(struct drm_mode_set *set, | ||
| 149 | struct drm_connector *connector) | ||
| 150 | { | ||
| 151 | int i, j; | ||
| 152 | |||
| 153 | for (i = 0; i < set->num_connectors; i++) { | ||
| 154 | if (set->connectors[i] == connector) | ||
| 155 | break; | ||
| 156 | } | ||
| 157 | |||
| 158 | if (i == set->num_connectors) | ||
| 159 | return; | ||
| 160 | |||
| 161 | for (j = i + 1; j < set->num_connectors; j++) { | ||
| 162 | set->connectors[j - 1] = set->connectors[j]; | ||
| 163 | } | ||
| 164 | set->num_connectors--; | ||
| 165 | |||
| 166 | /* because i915 is pissy about this.. | ||
| 167 | * TODO maybe need to makes sure we set it back to !=NULL somewhere? | ||
| 168 | */ | ||
| 169 | if (set->num_connectors == 0) | ||
| 170 | set->fb = NULL; | ||
| 171 | } | ||
| 172 | |||
| 148 | int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | 173 | int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, |
| 149 | struct drm_connector *connector) | 174 | struct drm_connector *connector) |
| 150 | { | 175 | { |
| @@ -167,6 +192,11 @@ int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper, | |||
| 167 | } | 192 | } |
| 168 | fb_helper->connector_count--; | 193 | fb_helper->connector_count--; |
| 169 | kfree(fb_helper_connector); | 194 | kfree(fb_helper_connector); |
| 195 | |||
| 196 | /* also cleanup dangling references to the connector: */ | ||
| 197 | for (i = 0; i < fb_helper->crtc_count; i++) | ||
| 198 | remove_from_modeset(&fb_helper->crtc_info[i].mode_set, connector); | ||
| 199 | |||
| 170 | return 0; | 200 | return 0; |
| 171 | } | 201 | } |
| 172 | EXPORT_SYMBOL(drm_fb_helper_remove_one_connector); | 202 | EXPORT_SYMBOL(drm_fb_helper_remove_one_connector); |
