Commit 451fd722 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pwm/for-3.17-rc2' of...

Merge tag 'pwm/for-3.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm

Pull pwm fix from Thierry Reding:
 "Just one bugfix for the PWM lookup table code that would cause a PWM
  channel to be set to the wrong period and polarity for non-perfect
  matches"

* tag 'pwm/for-3.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm:
  pwm: Fix period and polarity in pwm_get() for non-perfect matches
parents 47e4df94 d717ea73
......@@ -606,6 +606,8 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
unsigned int best = 0;
struct pwm_lookup *p;
unsigned int match;
unsigned int period;
enum pwm_polarity polarity;
/* look up via DT first */
if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node)
......@@ -653,6 +655,8 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
if (match > best) {
chip = pwmchip_find_by_name(p->provider);
index = p->index;
period = p->period;
polarity = p->polarity;
if (match != 3)
best = match;
......@@ -668,8 +672,8 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
if (IS_ERR(pwm))
return pwm;
pwm_set_period(pwm, p->period);
pwm_set_polarity(pwm, p->polarity);
pwm_set_period(pwm, period);
pwm_set_polarity(pwm, polarity);
return pwm;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment