UPSTREAM: pwm: Get rid of pwm->lock
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Wed, 30 Mar 2016 20:03:27 +0000 (22:03 +0200)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 6 Mar 2017 10:28:40 +0000 (18:28 +0800)
commit3f4e6dcb3d2d9eefb04e6356a03696e30887ab65
tree6303806a908960c5e1571dd825581c3ccdda65dd
parenta0a5f14bc8620564b428025f7ab812d2c5d9a87e
UPSTREAM: pwm: Get rid of pwm->lock

PWM devices are not protected against concurrent accesses. The lock in
struct pwm_device might let PWM users think it is, but it's actually
only protecting the enabled state.

Removing this lock should be fine as long as all PWM users are aware
that accesses to the PWM device have to be serialized, which seems to be
the case for all of them except the sysfs interface. Patch the sysfs
code by adding a lock to the pwm_export struct and making sure it's
taken for all relevant accesses to the exported PWM device.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 459a25afe97cb3d7f978b90c881f4d7aac8fb755)

Change-Id: I30d97ebaf1db8b80c353da5ebebd0fc5d5c57bb0
Signed-off-by: David Wu <david.wu@rock-chips.com>
drivers/pwm/core.c
drivers/pwm/sysfs.c
include/linux/pwm.h