[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1438958976-1821-1-git-send-email-oliver+list@schinagl.nl>
Date: Fri, 7 Aug 2015 16:49:36 +0200
From: Olliver Schinagl <oliver+list@...inagl.nl>
To: Thierry Reding <thierry.reding@...il.com>
Cc: Olliver Schinagl <oliver@...inagl.nl>, linux-pwm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] pwm: core: cleanup pointer tests
From: Olliver Schinagl <oliver@...inagl.nl>
pwm_set_polarity() checks if there's ops and polarity function pointers.
Most of these pointers are actually checked when a chip is added via
pwm_add, except for set_polarity.
This patch adds set_polarity to the list of functions to test on
pwmchip_add_with_polarity(); and removes these checks from
pwm_set_polarity.
The pwm should be valid, as it was checked during
pwmchip_add_with_polarity().
Signed-off-by: Olliver Schinagl <oliver@...inagl.nl>
---
drivers/pwm/core.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 3a7769f..66fd5fd 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -239,7 +239,8 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip,
int ret;
if (!chip || !chip->dev || !chip->ops || !chip->ops->config ||
- !chip->ops->enable || !chip->ops->disable || !chip->npwm)
+ !chip->ops->set_polarity || !chip->ops->enable ||
+ !chip->ops->disable || !chip->npwm)
return -EINVAL;
mutex_lock(&pwm_lock);
@@ -449,12 +450,9 @@ int pwm_set_polarity(struct pwm_device *pwm, enum pwm_polarity polarity)
{
int err;
- if (!pwm || !pwm->chip->ops)
+ if (!pwm)
return -EINVAL;
- if (!pwm->chip->ops->set_polarity)
- return -ENOSYS;
-
if (test_bit(PWMF_ENABLED, &pwm->flags))
return -EBUSY;
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists