diff options
author | Daniel Kurtz <djkurtz@chromium.org> | 2012-03-27 14:36:14 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-03-28 08:40:44 -0400 |
commit | 3bd7d90938f1fe77de5991dc4b727843c4980b2a (patch) | |
tree | a3ae0f53674b8a95b8e2c52959e32b4cc7a43d09 /drivers/gpu/drm/i915/intel_dvo.c | |
parent | 489fbc107f5fb041d598f30f367ea3ca714ff133 (diff) |
drm/i915/intel_i2c: refactor using intel_gmbus_get_adapter
Instead of letting other modules directly access the ->gmbus array,
introduce intel_gmbus_get_adapter() for looking up an i2c_adapter
for a given gmbus port identifier. This will enable later refactoring
of the gmbus port list.
Note: Before requesting an adapter for a given gmbus port number, the
driver must first check its validity using i2c_intel_gmbus_is_port_valid().
If this check fails, a call to intel_gmbus_get_adapter() will WARN_ON and
return NULL. This is relevant for parts of the driver that read a port
from VBIOS, which might be improperly initialized and contain an invalid
port. In these cases, the driver must fall back to using a safer default
port.
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dvo.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_dvo.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c index 020a7d7f744d..60ba50b956f2 100644 --- a/drivers/gpu/drm/i915/intel_dvo.c +++ b/drivers/gpu/drm/i915/intel_dvo.c | |||
@@ -243,7 +243,7 @@ static int intel_dvo_get_modes(struct drm_connector *connector) | |||
243 | * that's not the case. | 243 | * that's not the case. |
244 | */ | 244 | */ |
245 | intel_ddc_get_modes(connector, | 245 | intel_ddc_get_modes(connector, |
246 | &dev_priv->gmbus[GMBUS_PORT_DPC].adapter); | 246 | intel_gmbus_get_adapter(dev_priv, GMBUS_PORT_DPC)); |
247 | if (!list_empty(&connector->probed_modes)) | 247 | if (!list_empty(&connector->probed_modes)) |
248 | return 1; | 248 | return 1; |
249 | 249 | ||
@@ -375,7 +375,7 @@ void intel_dvo_init(struct drm_device *dev) | |||
375 | * special cases, but otherwise default to what's defined | 375 | * special cases, but otherwise default to what's defined |
376 | * in the spec. | 376 | * in the spec. |
377 | */ | 377 | */ |
378 | if (dvo->gpio != 0) | 378 | if (intel_gmbus_is_port_valid(dvo->gpio)) |
379 | gpio = dvo->gpio; | 379 | gpio = dvo->gpio; |
380 | else if (dvo->type == INTEL_DVO_CHIP_LVDS) | 380 | else if (dvo->type == INTEL_DVO_CHIP_LVDS) |
381 | gpio = GMBUS_PORT_SSC; | 381 | gpio = GMBUS_PORT_SSC; |
@@ -386,7 +386,7 @@ void intel_dvo_init(struct drm_device *dev) | |||
386 | * It appears that everything is on GPIOE except for panels | 386 | * It appears that everything is on GPIOE except for panels |
387 | * on i830 laptops, which are on GPIOB (DVOA). | 387 | * on i830 laptops, which are on GPIOB (DVOA). |
388 | */ | 388 | */ |
389 | i2c = &dev_priv->gmbus[gpio].adapter; | 389 | i2c = intel_gmbus_get_adapter(dev_priv, gpio); |
390 | 390 | ||
391 | intel_dvo->dev = *dvo; | 391 | intel_dvo->dev = *dvo; |
392 | if (!dvo->dev_ops->init(&intel_dvo->dev, i2c)) | 392 | if (!dvo->dev_ops->init(&intel_dvo->dev, i2c)) |