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
Subject: [PATCH v2 2/4] pwm: Drop of_pwm_simple_xlate() in favour of of_pwm_xlate_with_flags()
Date: Mon, 10 May 2021 16:06:38 +0200 [thread overview]
Message-ID: <20210510140640.980100-3-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20210510140640.980100-1-u.kleine-koenig@pengutronix.de>
Since the previous commit the latter function can do everything that the
former does. So simplify accordingly.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/pwm/core.c | 27 +--------------------------
1 file changed, 1 insertion(+), 26 deletions(-)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index c0cfed992ba4..9eb7ab19dbfb 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -153,38 +153,13 @@ of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args)
}
EXPORT_SYMBOL_GPL(of_pwm_xlate_with_flags);
-static struct pwm_device *
-of_pwm_simple_xlate(struct pwm_chip *pc, const struct of_phandle_args *args)
-{
- struct pwm_device *pwm;
-
- /* sanity check driver support */
- if (pc->of_pwm_n_cells < 2)
- return ERR_PTR(-EINVAL);
-
- /* all cells are required */
- if (args->args_count != pc->of_pwm_n_cells)
- return ERR_PTR(-EINVAL);
-
- if (args->args[0] >= pc->npwm)
- return ERR_PTR(-EINVAL);
-
- pwm = pwm_request_from_chip(pc, args->args[0], NULL);
- if (IS_ERR(pwm))
- return pwm;
-
- pwm->args.period = args->args[1];
-
- return pwm;
-}
-
static void of_pwmchip_add(struct pwm_chip *chip)
{
if (!chip->dev || !chip->dev->of_node)
return;
if (!chip->of_xlate) {
- chip->of_xlate = of_pwm_simple_xlate;
+ chip->of_xlate = of_pwm_xlate_with_flags;
chip->of_pwm_n_cells = 2;
}
--
2.30.2
next prev parent reply other threads:[~2021-05-10 14:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-10 14:06 [PATCH v2 0/4] pwm: Simplify drivers with of_pwm_n_cells = 3 Uwe Kleine-König
2021-05-10 14:06 ` [PATCH v2 1/4] pwm: Make of_pwm_xlate_with_flags() work with #pwm-cells = <2> Uwe Kleine-König
2021-05-10 14:06 ` Uwe Kleine-König [this message]
2021-05-10 14:06 ` [PATCH v2 3/4] pwm: Autodetect default value for of_pwm_n_cells from device tree Uwe Kleine-König
2021-05-10 14:06 ` [PATCH v2 4/4] pwm: Simplify all drivers with explicit of_pwm_n_cells = 3 Uwe Kleine-König
2021-05-10 14:48 ` [PATCH v2 0/4] pwm: Simplify drivers with " Uwe Kleine-König
-- strict thread matches above, loose matches on Subject: below --
2021-04-24 21:07 Uwe Kleine-König
2021-04-24 21:07 ` [PATCH v2 2/4] pwm: Drop of_pwm_simple_xlate() in favour of of_pwm_xlate_with_flags() 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=20210510140640.980100-3-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 \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).