Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: mt6779-keypad - use devm_clk_get_enabled()

Switch to using devm_clk_get_enable() helper instead of acquiring the
clock with devm_clk_get(), enabling it, and defining and installing
a custom devm action to call clk_disable().

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/Zs4UWGKt3hLjNmoP@google.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+1 -17
+1 -17
drivers/input/keyboard/mt6779-keypad.c
··· 92 92 return IRQ_HANDLED; 93 93 } 94 94 95 - static void mt6779_keypad_clk_disable(void *data) 96 - { 97 - clk_disable_unprepare(data); 98 - } 99 - 100 95 static void mt6779_keypad_calc_row_col_single(unsigned int key, 101 96 unsigned int *row, 102 97 unsigned int *col) ··· 208 213 regmap_update_bits(keypad->regmap, MTK_KPD_SEL, MTK_KPD_SEL_COL, 209 214 MTK_KPD_SEL_COLMASK(keypad->n_cols)); 210 215 211 - keypad->clk = devm_clk_get(&pdev->dev, "kpd"); 216 + keypad->clk = devm_clk_get_enabled(&pdev->dev, "kpd"); 212 217 if (IS_ERR(keypad->clk)) 213 218 return PTR_ERR(keypad->clk); 214 - 215 - error = clk_prepare_enable(keypad->clk); 216 - if (error) { 217 - dev_err(&pdev->dev, "cannot prepare/enable keypad clock\n"); 218 - return error; 219 - } 220 - 221 - error = devm_add_action_or_reset(&pdev->dev, mt6779_keypad_clk_disable, 222 - keypad->clk); 223 - if (error) 224 - return error; 225 219 226 220 irq = platform_get_irq(pdev, 0); 227 221 if (irq < 0)