[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190603114029.GC2781@lahna.fi.intel.com>
Date: Mon, 3 Jun 2019 14:40:29 +0300
From: Mika Westerberg <mika.westerberg@...ux.intel.com>
To: Sven Van Asbroeck <thesven73@...il.com>
Cc: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
YueHaibing <yuehaibing@...wei.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'
On Sun, Jun 02, 2019 at 10:18:15AM -0400, Sven Van Asbroeck wrote:
> On Sat, Jun 1, 2019 at 12:05 PM Uwe Kleine-König
> <u.kleine-koenig@...gutronix.de> wrote:
> >
> > 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.
>
> Certainly.
I agree.
> But if we do restore the old behaviour, there may still be problems.
> I'm unsure if the old synchronization was working correctly.
> See the example at the end of this email.
I think you are right. pca9685_pwm_request() should take the mutex as
long as it is requesting PWM.
> An intuitive way forward would be to use a simple bitfield in
> struct pca9685 to track if a specific pwm is in use by either
> pwm or gpio. Protected by a mutex.
A flag would probably be easier to understand than the magic we have
now. Or then wrap it inside function with an explanation comment:
static inline void pca9685_pwm_set_as_gpio(struct pwm_device *pwm)
{
/*
* We use ->chip_data to convoy the fact that the PWM channel is
* being used as GPIO instead of PWM.
*/
pwm_set_chip_data(pwm, (void *)1)
}
static inline void pca9685_pwm_set_as_pwm(struct pwm_device *pwm)
{
pwm_set_chip_data(pwm, NULL);
}
Powered by blists - more mailing lists