From: Jani Nikula <ext-jani.1.nikula@nokia.com> To: Tomi.Valkeinen@nokia.com, tony@atomide.com Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, ext-jani.1.nikula@nokia.com Subject: [PATCH v2 03/21] OMAP: DSS2: Taal: Add locks to protect taal data access Date: Mon, 03 May 2010 06:18:23 +0000 [thread overview] Message-ID: <db2b972d4fa08c2f5b3cd06392ef62415890a188.1272621452.git.ext-jani.1.nikula@nokia.com> (raw) In-Reply-To: <c95257e8042f471c55a38133020d1d63e22161f3.1272621452.git.ext-jani.1.nikula@nokia.com> From: Jani Nikula <ext-jani.1.nikula@nokia.com> Avoid potential race conditions in sysfs access to taal data. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> --- drivers/video/omap2/displays/panel-taal.c | 12 ++++++++++++ 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 5f5afba..f542607 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, u8 errors; int r; + mutex_lock(&td->lock); + if (td->enabled) { dsi_bus_lock(); r = taal_dcs_read_1(DCS_READ_NUM_ERRORS, &errors); @@ -372,6 +374,8 @@ static ssize_t taal_num_errors_show(struct device *dev, r = -ENODEV; } + mutex_unlock(&td->lock); + if (r) return r; @@ -386,6 +390,8 @@ static ssize_t taal_hw_revision_show(struct device *dev, u8 id1, id2, id3; int r; + mutex_lock(&td->lock); + if (td->enabled) { dsi_bus_lock(); r = taal_get_id(&id1, &id2, &id3); @@ -394,6 +400,8 @@ static ssize_t taal_hw_revision_show(struct device *dev, r = -ENODEV; } + mutex_unlock(&td->lock); + if (r) return r; @@ -443,6 +451,8 @@ static ssize_t store_cabc_mode(struct device *dev, if (i = ARRAY_SIZE(cabc_modes)) return -EINVAL; + mutex_lock(&td->lock); + if (td->enabled) { dsi_bus_lock(); if (!td->cabc_broken) @@ -452,6 +462,8 @@ static ssize_t store_cabc_mode(struct device *dev, td->cabc_mode = i; + mutex_unlock(&td->lock); + return count; } -- 1.6.5.2
WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <ext-jani.1.nikula@nokia.com> To: Tomi.Valkeinen@nokia.com, tony@atomide.com Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, ext-jani.1.nikula@nokia.com Subject: [PATCH v2 03/21] OMAP: DSS2: Taal: Add locks to protect taal data access Date: Mon, 3 May 2010 09:18:23 +0300 [thread overview] Message-ID: <db2b972d4fa08c2f5b3cd06392ef62415890a188.1272621452.git.ext-jani.1.nikula@nokia.com> (raw) In-Reply-To: <c95257e8042f471c55a38133020d1d63e22161f3.1272621452.git.ext-jani.1.nikula@nokia.com> In-Reply-To: <cover.1272621452.git.ext-jani.1.nikula@nokia.com> From: Jani Nikula <ext-jani.1.nikula@nokia.com> Avoid potential race conditions in sysfs access to taal data. Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com> --- drivers/video/omap2/displays/panel-taal.c | 12 ++++++++++++ 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 5f5afba..f542607 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, u8 errors; int r; + mutex_lock(&td->lock); + if (td->enabled) { dsi_bus_lock(); r = taal_dcs_read_1(DCS_READ_NUM_ERRORS, &errors); @@ -372,6 +374,8 @@ static ssize_t taal_num_errors_show(struct device *dev, r = -ENODEV; } + mutex_unlock(&td->lock); + if (r) return r; @@ -386,6 +390,8 @@ static ssize_t taal_hw_revision_show(struct device *dev, u8 id1, id2, id3; int r; + mutex_lock(&td->lock); + if (td->enabled) { dsi_bus_lock(); r = taal_get_id(&id1, &id2, &id3); @@ -394,6 +400,8 @@ static ssize_t taal_hw_revision_show(struct device *dev, r = -ENODEV; } + mutex_unlock(&td->lock); + if (r) return r; @@ -443,6 +451,8 @@ static ssize_t store_cabc_mode(struct device *dev, if (i == ARRAY_SIZE(cabc_modes)) return -EINVAL; + mutex_lock(&td->lock); + if (td->enabled) { dsi_bus_lock(); if (!td->cabc_broken) @@ -452,6 +462,8 @@ static ssize_t store_cabc_mode(struct device *dev, td->cabc_mode = i; + mutex_unlock(&td->lock); + return count; } -- 1.6.5.2
next prev parent reply other threads:[~2010-05-03 6:18 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-05-03 6:18 [PATCH v2 00/21] OMAP: DSS2: Taal panel driver updates Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 01/21] OMAP: DSS2: Taal: Add panel hardware reset Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 02/21] OMAP: DSS2: Taal: add locks to taal_bl_update_status Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` Jani Nikula [this message] 2010-05-03 6:18 ` [PATCH v2 03/21] OMAP: DSS2: Taal: Add locks to protect taal data access Jani Nikula 2010-05-03 6:18 ` [PATCH v2 04/21] OMAP: DSS2: Taal: Cosmetic improvement to backlight properties initialization Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 05/21] OMAP: DSS2: Taal: Remove platform enable/disable Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 06/21] OMAP: DSS2: Taal: Fix request_irq() error handling Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 07/21] OMAP: DSS2: Taal: Remove ESD work cancel from driver probe " Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 08/21] OMAP: DSS2: Taal: Improve taal_power_on() " Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 09/21] OMAP: DSS2: Taal: Bail out from taal_run_test() if panel is not enabled Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 10/21] OMAP: DSS2: Taal: Change DSI bus locking to avoid deadlock in ESD work Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 11/21] OMAP: DSS2: Taal: Check taal_power_on() return value in taal_resume() Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 12/21] OMAP: DSS2: Taal: Change ESD work management Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 13/21] OMAP: DSS2: Taal: Change probe error handling labels Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 14/21] OMAP: DSS2: Taal: Add proper external TE support Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 15/21] OMAP: DSS2: Add Nokia DSI command mode panel configuration struct Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 16/21] OMAP: DSS2: Taal: Use Nokia DSI panel data Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 17/21] OMAP: DSS2: Taal: Configure ESD check in " Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 18/21] OMAP: DSS2: Taal: Add panel specific configuration structure Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 19/21] OMAP: DSS2: Taal: Print panel name in addition to revision Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 20/21] OMAP: DSS2: Taal: Add regulator configuration support Jani Nikula 2010-05-03 6:18 ` Jani Nikula 2010-05-03 6:18 ` [PATCH v2 21/21] OMAP: DSS2: Taal: CABC workaround is Taal specific Jani Nikula 2010-05-03 6:18 ` Jani Nikula
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=db2b972d4fa08c2f5b3cd06392ef62415890a188.1272621452.git.ext-jani.1.nikula@nokia.com \ --to=ext-jani.1.nikula@nokia.com \ --cc=Tomi.Valkeinen@nokia.com \ --cc=linux-fbdev@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=tony@atomide.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.