From: Thierry Reding <thierry.reding@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] pwm: Fix period and polarity in pwm_get() for non-perfect matches
Date: Mon, 18 Aug 2014 08:57:24 +0000 [thread overview]
Message-ID: <20140818085722.GE31171@ulmo> (raw)
In-Reply-To: <CAMuHMdVLA4xRGKrsyGTokZvRWkNAFyNv+_JycavfpibO8GXkkQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]
On Mon, Aug 18, 2014 at 10:38:00AM +0200, Geert Uytterhoeven wrote:
> Hi Thierry,
>
> On Mon, Aug 18, 2014 at 10:20 AM, Thierry Reding
> <thierry.reding@gmail.com> wrote:
> > Could we achieve the same by storing a pointer to the best match and
> > then use that instead of p? Perhaps something like this:
> >
> > struct pwm_lookup *entry;
> >
> > ...
> >
> > if (match > best) {
> > chip = pwmchip_find_by_name(p->provider);
> > entry = p;
> >
> > if (match != 3)
> > best = match;
> > else
> > break;
> > }
> >
> > ...
> >
> > if (chip)
> > pwm = pwm_request_from_chip(chip, entry->index,
> > con_id ?: dev_id);
> > if (IS_ERR(pwm))
> > return pwm;
> >
> > pwm_set_period(pwm, entry->period);
> > pwm_set_polarity(pwm, entry->polarity);
> >
> > ?
>
> That's possible. But that will add complexity, as you have to move the
> "mutex_unlock(&pwm_lookup_lock);" after the last user of "entry" again,
> and add a goto for the IS_ERR(pwm) case.
> So I'm not sure it's worth the effort.
Oh, right. It would've been nice to avoid all the temporary variables,
but we can always refactor if that turns out to become too messy. I'll
apply this one for now.
I'll shorten the SHA-1 in the Fixes: line to 12 characters if you don't
mind to match the guidelines in Documentation/SubmittingPatches.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2014-08-18 8:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-13 15:18 [PATCH] pwm: Fix period and polarity in pwm_get() for non-perfect matches Geert Uytterhoeven
2014-08-18 8:20 ` Thierry Reding
2014-08-18 8:38 ` Geert Uytterhoeven
2014-08-18 8:57 ` Thierry Reding [this message]
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=20140818085722.GE31171@ulmo \
--to=thierry.reding@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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).