[Intel-gfx] [PATCH 2/4] drm/i915: Protect force_bit with gmbus_mutex
Jani Nikula
jani.nikula at linux.intel.com
Mon Apr 11 09:24:52 UTC 2016
On Mon, 07 Mar 2016, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Extend the protection of gmbus_mutex around the force_bit
> RMW in intel_gmbus_force_bit(), in case someone gets the
> idea of calling it from a separate thread while there's
> other stuff happening on the same bus.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
intel_gmbus_is_forced_bit() usage in intel_crt_get_edid() seems a bit
suspect still, but this is a step forward.
Reviewed-by: Jani Nikula <jani.nikula at intel.com>
> ---
> drivers/gpu/drm/i915/intel_i2c.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
> index 52fbe530fc9e..7bf8a485e18f 100644
> --- a/drivers/gpu/drm/i915/intel_i2c.c
> +++ b/drivers/gpu/drm/i915/intel_i2c.c
> @@ -718,11 +718,16 @@ void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed)
> void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit)
> {
> struct intel_gmbus *bus = to_intel_gmbus(adapter);
> + struct drm_i915_private *dev_priv = bus->dev_priv;
> +
> + mutex_lock(&dev_priv->gmbus_mutex);
>
> bus->force_bit += force_bit ? 1 : -1;
> DRM_DEBUG_KMS("%sabling bit-banging on %s. force bit now %d\n",
> force_bit ? "en" : "dis", adapter->name,
> bus->force_bit);
> +
> + mutex_unlock(&dev_priv->gmbus_mutex);
> }
>
> void intel_teardown_gmbus(struct drm_device *dev)
--
Jani Nikula, Intel Open Source Technology Center
More information about the Intel-gfx
mailing list