summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/atombios_i2c.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2014-11-11 09:16:15 +1000
committerAlex Deucher <alexander.deucher@amd.com>2014-11-11 17:22:26 -0500
commit1c9498425453bb65ef339a57705c5ef59fe1541d (patch)
tree293c1d2d23aa2269a67d13d8a5486cc3c6ccf549 /drivers/gpu/drm/radeon/atombios_i2c.c
parent03dca708521d30153fc5c7e2ff136f780a7372c9 (diff)
downloadop-kernel-dev-1c9498425453bb65ef339a57705c5ef59fe1541d.zip
op-kernel-dev-1c9498425453bb65ef339a57705c5ef59fe1541d.tar.gz
drm/radeon: add locking around atombios scratch space usage
While developing MST support I noticed I often got the wrong data back from a transaction, in a racy fashion. I noticed the scratch space wasn't locked against concurrent users. Based on a patch by Alex, but I've made it a bit more obvious when things are locked. Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/gpu/drm/radeon/atombios_i2c.c')
-rw-r--r--drivers/gpu/drm/radeon/atombios_i2c.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c b/drivers/gpu/drm/radeon/atombios_i2c.c
index 9c570fb..4157780 100644
--- a/drivers/gpu/drm/radeon/atombios_i2c.c
+++ b/drivers/gpu/drm/radeon/atombios_i2c.c
@@ -48,6 +48,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
memset(&args, 0, sizeof(args));
mutex_lock(&chan->mutex);
+ mutex_lock(&rdev->mode_info.atom_context->scratch_mutex);
base = (unsigned char *)rdev->mode_info.atom_context->scratch;
@@ -82,7 +83,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
args.ucSlaveAddr = slave_addr << 1;
args.ucLineNumber = chan->rec.i2c_id;
- atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
+ atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args);
/* error */
if (args.ucStatus != HW_ASSISTED_I2C_STATUS_SUCCESS) {
@@ -95,6 +96,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan,
radeon_atom_copy_swap(buf, base, num, false);
done:
+ mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex);
mutex_unlock(&chan->mutex);
return r;
OpenPOWER on IntegriCloud