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
464 464
465static inline void pwm_apply_args(struct pwm_device *pwm)465static inline void pwm_apply_args(struct pwm_device *pwm)
466{466{
467 struct pwm_state state = { };
468
467 /*469 /*
468 * PWM users calling pwm_apply_args() expect to have a fresh config470 * PWM users calling pwm_apply_args() expect to have a fresh config
469 * where the polarity and period are set according to pwm_args info.471 * 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
476 * at startup (even if they are actually enabled), thus authorizing478 * at startup (even if they are actually enabled), thus authorizing
477 * polarity setting.479 * polarity setting.
478 *480 *
479 * Instead of setting ->enabled to false, we call pwm_disable()481 * To fulfill this requirement, we apply a new state which disables
480 * before pwm_set_polarity() to ensure that everything is configured482 * the PWM device and set the reference period and polarity config.
481 * as expected, and the PWM is really disabled when the user request
482 * it.
483 *483 *
484 * Note that PWM users requiring a smooth handover between the484 * Note that PWM users requiring a smooth handover between the
485 * bootloader and the kernel (like critical regulators controlled by485 * bootloader and the kernel (like critical regulators controlled by
486 * PWM devices) will have to switch to the atomic API and avoid calling486 * PWM devices) will have to switch to the atomic API and avoid calling
487 * pwm_apply_args().487 * pwm_apply_args().
488 */488 */
489 pwm_disable(pwm);489
490 pwm_set_polarity(pwm, pwm->args.polarity);490 state.enabled = false;
491 state.polarity = pwm->args.polarity;
492 state.period = pwm->args.period;
493
494 pwm_apply_state(pwm, &state);
491}495}
492 496
493struct pwm_lookup {497struct 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