All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Thierry Reding <thierry.reding@gmail.com>,
	Lee Jones <lee.jones@linaro.org>
Cc: linux-pwm@vger.kernel.org, kernel@pengutronix.de,
	"Uwe Kleine-König" <uwe@kleine-koenig.org>
Subject: [PATCH 04/14] pwm: Drop function pwmchip_add_with_polarity()
Date: Fri, 19 Mar 2021 11:28:42 +0100	[thread overview]
Message-ID: <20210319102852.101209-5-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20210319102852.101209-1-u.kleine-koenig@pengutronix.de>

From: Uwe Kleine-König <uwe@kleine-koenig.org>

pwmchip_add() only calls pwmchip_add_with_polarity() and nothing else. All
other users of pwmchip_add_with_polarity() are gone. So drop
pwmchip_add_with_polarity() and move the code instead to pwmchip_add().

The initial assignment to pwm->state.polarity is dropped. In every correct
usage of the PWM API this value is overwritten later anyhow.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Link: https://lore.kernel.org/r/20201207134556.25217-4-uwe@kleine-koenig.org
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/core.c  | 25 +++----------------------
 include/linux/pwm.h |  2 --
 2 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index a8eff4b3ee36..e7a2d9095669 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -260,18 +260,15 @@ static bool pwm_ops_check(const struct pwm_chip *chip)
 }
 
 /**
- * pwmchip_add_with_polarity() - register a new PWM chip
+ * pwmchip_add() - register a new PWM chip
  * @chip: the PWM chip to add
- * @polarity: initial polarity of PWM channels
  *
  * Register a new PWM chip. If chip->base < 0 then a dynamically assigned base
- * will be used. The initial polarity for all channels is specified by the
- * @polarity parameter.
+ * will be used.
  *
  * Returns: 0 on success or a negative error code on failure.
  */
-int pwmchip_add_with_polarity(struct pwm_chip *chip,
-			      enum pwm_polarity polarity)
+int pwmchip_add(struct pwm_chip *chip)
 {
 	struct pwm_device *pwm;
 	unsigned int i;
@@ -303,7 +300,6 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip,
 		pwm->chip = chip;
 		pwm->pwm = chip->base + i;
 		pwm->hwpwm = i;
-		pwm->state.polarity = polarity;
 
 		radix_tree_insert(&pwm_tree, pwm->pwm, pwm);
 	}
@@ -326,21 +322,6 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip,
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(pwmchip_add_with_polarity);
-
-/**
- * pwmchip_add() - register a new PWM chip
- * @chip: the PWM chip to add
- *
- * Register a new PWM chip. If chip->base < 0 then a dynamically assigned base
- * will be used. The initial polarity for all channels is normal.
- *
- * Returns: 0 on success or a negative error code on failure.
- */
-int pwmchip_add(struct pwm_chip *chip)
-{
-	return pwmchip_add_with_polarity(chip, PWM_POLARITY_NORMAL);
-}
 EXPORT_SYMBOL_GPL(pwmchip_add);
 
 /**
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index e4d84d4db293..8f4eefd129aa 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -392,8 +392,6 @@ int pwm_capture(struct pwm_device *pwm, struct pwm_capture *result,
 int pwm_set_chip_data(struct pwm_device *pwm, void *data);
 void *pwm_get_chip_data(struct pwm_device *pwm);
 
-int pwmchip_add_with_polarity(struct pwm_chip *chip,
-			      enum pwm_polarity polarity);
 int pwmchip_add(struct pwm_chip *chip);
 int pwmchip_remove(struct pwm_chip *chip);
 struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
-- 
2.30.1


  parent reply	other threads:[~2021-03-19 10:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 10:28 [PATCH 00/14] pwm: Patches I consider ready for the next merge window Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 01/14] pwm: bcm2835: Improve period and duty cycle calculation Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 02/14] pwm: bcm-kona: Use pwmchip_add() instead of pwmchip_add_with_polarity() Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 03/14] pwm: atmel-hlcdc: " Uwe Kleine-König
2021-03-19 10:28 ` Uwe Kleine-König [this message]
2021-03-19 10:28 ` [PATCH 05/14] pwm: ab8500: Implement .apply instead of .config, .enable and .disable Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 06/14] pwm: imx-tpm: Use a single line for error message Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 07/14] pwm: Always allocate pwm id dynamically Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 08/14] pwm: Return -EINVAL for old-style drivers without .set_polarity callback Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 09/14] pwm: Prevent a glitch in compat code Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 10/14] pwm: atmel-tcb: Implement .apply callback Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 11/14] pwm: atmel-tcb: Only free resources after pwm_chip_remove() returned Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 12/14] pwm: sprd: Refuse requests with unsupported polarity Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 13/14] pwm: cros-ec: " Uwe Kleine-König
2021-03-19 10:28 ` [PATCH 14/14] pwm: Soften potential loss of precision in compat code Uwe Kleine-König
2021-03-22 13:26 ` [PATCH 00/14] pwm: Patches I consider ready for the next merge window Thierry Reding
2021-03-22 14:00   ` Uwe Kleine-König
2021-03-23  7:19   ` Lee Jones
2021-03-23  8:53     ` Thierry Reding
2021-03-23  9:02       ` Lee Jones
2021-04-08 10:43     ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210319102852.101209-5-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=uwe@kleine-koenig.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.