lkml.org 
[lkml]   [2016]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v5 04/46] pwm: get rid of pwm->lock
    On Wed, Mar 30, 2016 at 10:03:27PM +0200, Boris Brezillon wrote:
    > PWM devices are not protected against concurrent accesses. The lock in
    > 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 accesses to the exported PWM device.
    >
    > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
    > ---
    > drivers/pwm/core.c | 19 ++++--------------
    > drivers/pwm/sysfs.c | 57 ++++++++++++++++++++++++++++++++++++++++++-----------
    > include/linux/pwm.h | 2 --
    > 3 files changed, 50 insertions(+), 28 deletions(-)

    This is a little overzealous. Only accesses that can cause races need to
    be protected by the lock. All of the *_show() callbacks don't modify the
    PWM device in any way, so there is no need to protect them against
    concurrent accesses.

    I've dropped the changes when applying.

    Thanks,
    Thierry
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2016-04-12 13:41    [W:4.186 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site