[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdVLA4xRGKrsyGTokZvRWkNAFyNv+_JycavfpibO8GXkkQ@mail.gmail.com>
Date: Mon, 18 Aug 2014 10:38:00 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Thierry Reding <thierry.reding@...il.com>
Cc: Geert Uytterhoeven <geert+renesas@...der.be>,
Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
Haavard Skinnemoen <hskinnemoen@...il.com>,
Hans-Christian Egtvedt <egtvedt@...fundet.no>,
linux-pwm@...r.kernel.org,
Linux-sh list <linux-sh@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
stable <stable@...r.kernel.org>
Subject: Re: [PATCH] pwm: Fix period and polarity in pwm_get() for non-perfect matches
Hi Thierry,
On Mon, Aug 18, 2014 at 10:20 AM, Thierry Reding
<thierry.reding@...il.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.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists