summaryrefslogtreecommitdiffstats
path: root/drivers/pwm
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@baylibre.com>2024-07-29 16:34:17 +0200
committerUwe Kleine-König <ukleinek@kernel.org>2024-09-05 11:14:14 +0200
commitd6a800796e9806f62b52f2aa80e52a2553e11e9f (patch)
treeb3a69043110aca1ecb64c45f1b468ba79d6dc612 /drivers/pwm
parent75f0cb339b7814dc759c58a0d42fc5c1b93c7836 (diff)
downloadlinux-d6a800796e9806f62b52f2aa80e52a2553e11e9f.tar.gz
linux-d6a800796e9806f62b52f2aa80e52a2553e11e9f.tar.bz2
linux-d6a800796e9806f62b52f2aa80e52a2553e11e9f.zip
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: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/ee7b3322c7b3e28defdfb886a70b8ba40d298416.1722261050.git.u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Diffstat (limited to 'drivers/pwm')
-rw-r--r--drivers/pwm/core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 56d91c11f0d4..6e752e148b98 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -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)