[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190601160459.baedo5pp5hsrltzs@pengutronix.de>
Date: Sat, 1 Jun 2019 18:04:59 +0200
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Sven Van Asbroeck <thesven73@...il.com>
Cc: YueHaibing <yuehaibing@...wei.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Thierry Reding <thierry.reding@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-pwm@...r.kernel.org, kernel-janitors@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next] pwm: pca9685: Remove set but not used variable
'pwm'
Hello Sven,
On Sat, Jun 01, 2019 at 09:03:09AM -0400, Sven Van Asbroeck wrote:
> Hi YueHaibing,
>
> On Fri, May 31, 2019 at 11:49 PM YueHaibing <yuehaibing@...wei.com> wrote:
> >
> > mutex_lock(&pca->lock);
> > - pwm = &pca->chip.pwms[offset];
> > mutex_unlock(&pca->lock);
>
> Thanks for noticing this issue. However it should be fixed differently.
>
> This was introduced by Uwe's clean-up patch:
> commit e926b12c611c2095c79 ("pwm: Clear chip_data in pwm_put()")
>
> But Uwe did not realize that in this case, the pwm chip_data is used as a
> synchronization mechanism between pwm and gpio. Moving the chip_data
> clear out of the mutex breaks this mechanism.
>
> I think the following would restore the mechanism:
>
> > mutex_lock(&pca->lock);
> > pwm = &pca->chip.pwms[offset];
> > + pwm_set_chip_data(pwm, NULL);
> > mutex_unlock(&pca->lock);
I didn't look into the driver to try to understand that, but the
definitely needs a comment to explain for the next person to think they
can do a cleanup here.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Powered by blists - more mailing lists