提交 b7b2b49e 编写于 作者: G Geert Uytterhoeven 提交者: Dmitry Torokhov

Input: palmas-pwrbutton - use bitfield helpers

Use the FIELD_PREP() helper, instead of open-coding the same operation.
Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/f8831b88346b36fc6e01e0910d0db6c94287d2b4.1637593297.git.geert+renesas@glider.beSigned-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 744d0090
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <linux/bitfield.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -192,8 +193,8 @@ static int palmas_pwron_probe(struct platform_device *pdev) ...@@ -192,8 +193,8 @@ static int palmas_pwron_probe(struct platform_device *pdev)
* Setup default hardware shutdown option (long key press) * Setup default hardware shutdown option (long key press)
* and debounce. * and debounce.
*/ */
val = config.long_press_time_val << __ffs(PALMAS_LPK_TIME_MASK); val = FIELD_PREP(PALMAS_LPK_TIME_MASK, config.long_press_time_val) |
val |= config.pwron_debounce_val << __ffs(PALMAS_PWRON_DEBOUNCE_MASK); FIELD_PREP(PALMAS_PWRON_DEBOUNCE_MASK, config.pwron_debounce_val);
error = palmas_update_bits(palmas, PALMAS_PMU_CONTROL_BASE, error = palmas_update_bits(palmas, PALMAS_PMU_CONTROL_BASE,
PALMAS_LONG_PRESS_KEY, PALMAS_LONG_PRESS_KEY,
PALMAS_LPK_TIME_MASK | PALMAS_LPK_TIME_MASK |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册