aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/displays/panel-taal.c
diff options
context:
space:
mode:
authorJani Nikula <ext-jani.1.nikula@nokia.com>2010-04-28 04:15:18 -0400
committerTomi Valkeinen <tomi.valkeinen@nokia.com>2010-08-03 08:18:47 -0400
commit6b316715b4b96da49fcac0fa07082692eebca8af (patch)
tree0115f766399a859e5bdd831166b9ac7fa40c0467 /drivers/video/omap2/displays/panel-taal.c
parent006db7b4304303f014a0c13f479715885b603e9f (diff)
OMAP: DSS2: Taal: Add locks to protect taal data access
Avoid potential race conditions in sysfs access to taal data. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers/video/omap2/displays/panel-taal.c')
-rw-r--r--drivers/video/omap2/displays/panel-taal.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 8fbb94e2bf5d..0eed3282a7a5 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -364,6 +364,8 @@ static ssize_t taal_num_errors_show(struct device *dev,
364 u8 errors; 364 u8 errors;
365 int r; 365 int r;
366 366
367 mutex_lock(&td->lock);
368
367 if (td->enabled) { 369 if (td->enabled) {
368 dsi_bus_lock(); 370 dsi_bus_lock();
369 r = taal_dcs_read_1(DCS_READ_NUM_ERRORS, &errors); 371 r = taal_dcs_read_1(DCS_READ_NUM_ERRORS, &errors);
@@ -372,6 +374,8 @@ static ssize_t taal_num_errors_show(struct device *dev,
372 r = -ENODEV; 374 r = -ENODEV;
373 } 375 }
374 376
377 mutex_unlock(&td->lock);
378
375 if (r) 379 if (r)
376 return r; 380 return r;
377 381
@@ -386,6 +390,8 @@ static ssize_t taal_hw_revision_show(struct device *dev,
386 u8 id1, id2, id3; 390 u8 id1, id2, id3;
387 int r; 391 int r;
388 392
393 mutex_lock(&td->lock);
394
389 if (td->enabled) { 395 if (td->enabled) {
390 dsi_bus_lock(); 396 dsi_bus_lock();
391 r = taal_get_id(&id1, &id2, &id3); 397 r = taal_get_id(&id1, &id2, &id3);
@@ -394,6 +400,8 @@ static ssize_t taal_hw_revision_show(struct device *dev,
394 r = -ENODEV; 400 r = -ENODEV;
395 } 401 }
396 402
403 mutex_unlock(&td->lock);
404
397 if (r) 405 if (r)
398 return r; 406 return r;
399 407
@@ -443,6 +451,8 @@ static ssize_t store_cabc_mode(struct device *dev,
443 if (i == ARRAY_SIZE(cabc_modes)) 451 if (i == ARRAY_SIZE(cabc_modes))
444 return -EINVAL; 452 return -EINVAL;
445 453
454 mutex_lock(&td->lock);
455
446 if (td->enabled) { 456 if (td->enabled) {
447 dsi_bus_lock(); 457 dsi_bus_lock();
448 if (!td->cabc_broken) 458 if (!td->cabc_broken)
@@ -452,6 +462,8 @@ static ssize_t store_cabc_mode(struct device *dev,
452 462
453 td->cabc_mode = i; 463 td->cabc_mode = i;
454 464
465 mutex_unlock(&td->lock);
466
455 return count; 467 return count;
456} 468}
457 469