Commit d6a80079 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Uwe Kleine-König

pwm: Simplify pwm_capture()

When pwm_capture() is called, pwm is valid, so the checks for pwm and
pwm->chip->ops being NULL can be dropped.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/ee7b3322c7b3e28defdfb886a70b8ba40d298416.1722261050.git.u.kleine-koenig@baylibre.comSigned-off-by: default avatarUwe Kleine-König <ukleinek@kernel.org>
parent 75f0cb33
......@@ -328,15 +328,15 @@ EXPORT_SYMBOL_GPL(pwm_adjust_config);
static int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result,
unsigned long timeout)
{
if (!pwm || !pwm->chip->ops)
return -EINVAL;
struct pwm_chip *chip = pwm->chip;
const struct pwm_ops *ops = chip->ops;
if (!pwm->chip->ops->capture)
if (!ops->capture)
return -ENOSYS;
guard(mutex)(&pwm_lock);
return pwm->chip->ops->capture(pwm->chip, pwm, result, timeout);
return ops->capture(chip, pwm, result, timeout);
}
static struct pwm_chip *pwmchip_find_by_name(const char *name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment