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

Configure Feed

Select the types of activity you want to include in your feed.

pwm: sifive: Fold pwm_sifive_enable() into its only caller

There is only a single caller of pwm_sifive_enable() which only enables
or disables the clk. Put this implementation directly into
pwm_sifive_apply() which allows further simplification in the next
change.

There is no change in behaviour.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

Uwe Kleine-König and committed by
Thierry Reding
61180f68 20550a61

+8 -20
+8 -20
drivers/pwm/pwm-sifive.c
··· 124 124 state->polarity = PWM_POLARITY_INVERSED; 125 125 } 126 126 127 - static int pwm_sifive_enable(struct pwm_chip *chip, bool enable) 128 - { 129 - struct pwm_sifive_ddata *ddata = pwm_sifive_chip_to_ddata(chip); 130 - int ret; 131 - 132 - if (enable) { 133 - ret = clk_enable(ddata->clk); 134 - if (ret) { 135 - dev_err(ddata->chip.dev, "Enable clk failed\n"); 136 - return ret; 137 - } 138 - } else { 139 - clk_disable(ddata->clk); 140 - } 141 - 142 - return 0; 143 - } 144 - 145 127 static int pwm_sifive_apply(struct pwm_chip *chip, struct pwm_device *pwm, 146 128 const struct pwm_state *state) 147 129 { ··· 174 192 175 193 writel(frac, ddata->regs + PWM_SIFIVE_PWMCMP(pwm->hwpwm)); 176 194 177 - if (state->enabled != enabled) 178 - pwm_sifive_enable(chip, state->enabled); 195 + if (state->enabled != enabled) { 196 + if (state->enabled) { 197 + if (clk_enable(ddata->clk)) 198 + dev_err(ddata->chip.dev, "Enable clk failed\n"); 199 + } else { 200 + clk_disable(ddata->clk); 201 + } 202 + } 179 203 180 204 exit: 181 205 clk_disable(ddata->clk);