diff options
author | Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> | 2015-04-10 03:59:10 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-04-13 05:23:25 -0400 |
commit | 9bdbd0b911086d03a27e1fe9531b41f5411ccfac (patch) | |
tree | 795287ca6336bec619d704984771e137b70521c8 /drivers/gpu/drm/i915/intel_sdvo.c | |
parent | a6631bc8d60d4c3159bc3dd0897664096f9e9ccd (diff) |
drm/i915: Allocate connector state together with the connectors
Connector states were being allocated in intel_setup_outputs() in loop
over all connectors. That meant hot-added connectors would have a NULL
state. Since the change to use a struct drm_atomic_state for the legacy
modeset, connector states are necessary for the i915 driver to function
properly, so that would lead to oopses.
v2: Fix test for intel_connector_init() success in lvds and sdvo (PRTS)
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reported-and-tested-by: Nicolas Kalkhof <nkalkhof@web.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sdvo.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index b121796c86aa..10cd33252838 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -2427,6 +2427,22 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo *intel_sdvo, | |||
2427 | } | 2427 | } |
2428 | } | 2428 | } |
2429 | 2429 | ||
2430 | static struct intel_sdvo_connector *intel_sdvo_connector_alloc(void) | ||
2431 | { | ||
2432 | struct intel_sdvo_connector *sdvo_connector; | ||
2433 | |||
2434 | sdvo_connector = kzalloc(sizeof(*sdvo_connector), GFP_KERNEL); | ||
2435 | if (!sdvo_connector) | ||
2436 | return NULL; | ||
2437 | |||
2438 | if (intel_connector_init(&sdvo_connector->base) < 0) { | ||
2439 | kfree(sdvo_connector); | ||
2440 | return NULL; | ||
2441 | } | ||
2442 | |||
2443 | return sdvo_connector; | ||
2444 | } | ||
2445 | |||
2430 | static bool | 2446 | static bool |
2431 | intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device) | 2447 | intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device) |
2432 | { | 2448 | { |
@@ -2438,7 +2454,7 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device) | |||
2438 | 2454 | ||
2439 | DRM_DEBUG_KMS("initialising DVI device %d\n", device); | 2455 | DRM_DEBUG_KMS("initialising DVI device %d\n", device); |
2440 | 2456 | ||
2441 | intel_sdvo_connector = kzalloc(sizeof(*intel_sdvo_connector), GFP_KERNEL); | 2457 | intel_sdvo_connector = intel_sdvo_connector_alloc(); |
2442 | if (!intel_sdvo_connector) | 2458 | if (!intel_sdvo_connector) |
2443 | return false; | 2459 | return false; |
2444 | 2460 | ||
@@ -2492,7 +2508,7 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type) | |||
2492 | 2508 | ||
2493 | DRM_DEBUG_KMS("initialising TV type %d\n", type); | 2509 | DRM_DEBUG_KMS("initialising TV type %d\n", type); |
2494 | 2510 | ||
2495 | intel_sdvo_connector = kzalloc(sizeof(*intel_sdvo_connector), GFP_KERNEL); | 2511 | intel_sdvo_connector = intel_sdvo_connector_alloc(); |
2496 | if (!intel_sdvo_connector) | 2512 | if (!intel_sdvo_connector) |
2497 | return false; | 2513 | return false; |
2498 | 2514 | ||
@@ -2571,7 +2587,7 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device) | |||
2571 | 2587 | ||
2572 | DRM_DEBUG_KMS("initialising LVDS device %d\n", device); | 2588 | DRM_DEBUG_KMS("initialising LVDS device %d\n", device); |
2573 | 2589 | ||
2574 | intel_sdvo_connector = kzalloc(sizeof(*intel_sdvo_connector), GFP_KERNEL); | 2590 | intel_sdvo_connector = intel_sdvo_connector_alloc(); |
2575 | if (!intel_sdvo_connector) | 2591 | if (!intel_sdvo_connector) |
2576 | return false; | 2592 | return false; |
2577 | 2593 | ||