History

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

Pull pwm fixes from Thierry Reding: "One more fix for some fallout observed after the introduction of the atomic API" * tag 'pwm/for-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: pwm: Fix pwm_apply_args()

Linus Torvalds committed 10 years ago

Commit 20bfdca2 parents 4aa34ce 33cdcee1 file · +10 −6Browse files

Unified · Split

include/linux/pwm.h+10−6
@@ -464,6 +464,8 @@ static inline bool pwm_can_sleep(struct pwm_device *pwm) · 463 unmodified lines
464464
465465 static inline void pwm_apply_args(struct pwm_device *pwm)
466466 {
467+ struct pwm_state state = { };
468+
467469 /*
468470 * PWM users calling pwm_apply_args() expect to have a fresh config
469471 * where the polarity and period are set according to pwm_args info.
@@ -476,18 +478,20 @@ static inline void pwm_apply_args(struct pwm_device *pwm) · 6 unmodified lines
476478 * at startup (even if they are actually enabled), thus authorizing
477479 * polarity setting.
478480 *
479− * Instead of setting ->enabled to false, we call pwm_disable()
480− * before pwm_set_polarity() to ensure that everything is configured
481− * as expected, and the PWM is really disabled when the user request
482− * it.
481+ * To fulfill this requirement, we apply a new state which disables
482+ * the PWM device and set the reference period and polarity config.
483483 *
484484 * Note that PWM users requiring a smooth handover between the
485485 * bootloader and the kernel (like critical regulators controlled by
486486 * PWM devices) will have to switch to the atomic API and avoid calling
487487 * pwm_apply_args().
488488 */
489− pwm_disable(pwm);
490− pwm_set_polarity(pwm, pwm->args.polarity);
489+
490+ state.enabled = false;
491+ state.polarity = pwm->args.polarity;
492+ state.period = pwm->args.period;
493+
494+ pwm_apply_state(pwm, &state);
491495 }
492496
493497 struct pwm_lookup {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t