From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: Lee Jones <lee.jones@linaro.org>,
Daniel Thompson <daniel.thompson@linaro.org>,
Jingoo Han <jingoohan1@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
<dri-devel@lists.freedesktop.org>, <linux-fbdev@vger.kernel.org>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH 3/5] backlight: led_bl: add led_access locking
Date: Fri, 17 Apr 2020 14:33:10 +0300 [thread overview]
Message-ID: <20200417113312.24340-3-tomi.valkeinen@ti.com> (raw)
In-Reply-To: <20200417113312.24340-1-tomi.valkeinen@ti.com>
led_bl does not lock 'led_access' when calling led_sysfs_disable and
led_sysfs_enable, causing the below WARN. Add the locking.
WARNING: CPU: 0 PID: 223 at drivers/leds/led-core.c:353 led_sysfs_disable+0x4c/0x5c
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/backlight/led_bl.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c
index c46ecdfe8b0a..63693c4f0883 100644
--- a/drivers/video/backlight/led_bl.c
+++ b/drivers/video/backlight/led_bl.c
@@ -216,8 +216,11 @@ static int led_bl_probe(struct platform_device *pdev)
return PTR_ERR(priv->bl_dev);
}
- for (i = 0; i < priv->nb_leds; i++)
+ for (i = 0; i < priv->nb_leds; i++) {
+ mutex_lock(&priv->leds[i]->led_access);
led_sysfs_disable(priv->leds[i]);
+ mutex_unlock(&priv->leds[i]->led_access);
+ }
backlight_update_status(priv->bl_dev);
@@ -233,8 +236,11 @@ static int led_bl_remove(struct platform_device *pdev)
backlight_device_unregister(bl);
led_bl_power_off(priv);
- for (i = 0; i < priv->nb_leds; i++)
+ for (i = 0; i < priv->nb_leds; i++) {
+ mutex_lock(&priv->leds[i]->led_access);
led_sysfs_enable(priv->leds[i]);
+ mutex_unlock(&priv->leds[i]->led_access);
+ }
return 0;
}
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-04-17 11:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-17 11:33 [PATCH 1/5] backlight: led_bl: fix cosmetic issues Tomi Valkeinen
2020-04-17 11:33 ` [PATCH 2/5] backlight: led_bl: drop useless NULL initialization Tomi Valkeinen
2020-04-20 15:29 ` Daniel Thompson
2020-04-17 11:33 ` Tomi Valkeinen [this message]
2020-04-20 15:45 ` [PATCH 3/5] backlight: led_bl: add led_access locking Daniel Thompson
2020-04-17 11:33 ` [PATCH 4/5] backlight: led_bl: fix led -> backlight brightness mapping Tomi Valkeinen
2020-04-20 15:55 ` Daniel Thompson
2020-04-21 5:57 ` Tomi Valkeinen
2020-04-17 11:33 ` [PATCH 5/5] backlight: led_bl: rewrite led_bl_parse_levels() Tomi Valkeinen
2020-04-20 16:01 ` Daniel Thompson
2020-04-21 5:52 ` Tomi Valkeinen
2020-04-21 10:48 ` Daniel Thompson
2020-04-21 11:26 ` Tomi Valkeinen
2020-04-21 11:53 ` Tomi Valkeinen
2020-04-20 15:29 ` [PATCH 1/5] backlight: led_bl: fix cosmetic issues Daniel Thompson
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=20200417113312.24340-3-tomi.valkeinen@ti.com \
--to=tomi.valkeinen@ti.com \
--cc=b.zolnierkie@samsung.com \
--cc=daniel.thompson@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingoohan1@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-fbdev@vger.kernel.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).