Linux-MIPS Archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Paul Cercueil <paul@crapouillou.net>, linux-pwm@vger.kernel.org
Cc: linux-mips@vger.kernel.org, kernel@pengutronix.de
Subject: [PATCH v6 056/164] pwm: jz4740: Make use of pwmchip_parent() accessor
Date: Wed, 14 Feb 2024 10:31:43 +0100	[thread overview]
Message-ID: <86b8a362f1e50c5b95c43e056d03ee5ca66d1641.1707900770.git.u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <cover.1707900770.git.u.kleine-koenig@pengutronix.de>

struct pwm_chip::dev is about to change. To not have to touch this
driver in the same commit as struct pwm_chip::dev, use the accessor
function provided for exactly this purpose.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pwm/pwm-jz4740.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index de9e66065e48..4d39f61b86ff 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -40,7 +40,7 @@ static bool jz4740_pwm_can_use_chn(struct pwm_chip *chip, unsigned int channel)
 	/* Enable all TCU channels for PWM use by default except channels 0/1 */
 	u32 pwm_channels_mask = GENMASK(chip->npwm - 1, 2);
 
-	device_property_read_u32(chip->dev->parent,
+	device_property_read_u32(pwmchip_parent(chip)->parent,
 				 "ingenic,pwm-channels-mask",
 				 &pwm_channels_mask);
 
@@ -59,9 +59,10 @@ static int jz4740_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
 
 	snprintf(name, sizeof(name), "timer%u", pwm->hwpwm);
 
-	clk = clk_get(chip->dev, name);
+	clk = clk_get(pwmchip_parent(chip), name);
 	if (IS_ERR(clk)) {
-		dev_err(chip->dev, "error %pe: Failed to get clock\n", clk);
+		dev_err(pwmchip_parent(chip),
+			"error %pe: Failed to get clock\n", clk);
 		return PTR_ERR(clk);
 	}
 
@@ -149,7 +150,7 @@ static int jz4740_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 	 */
 	rate = clk_round_rate(clk, tmp);
 	if (rate < 0) {
-		dev_err(chip->dev, "Unable to round rate: %ld\n", rate);
+		dev_err(pwmchip_parent(chip), "Unable to round rate: %ld\n", rate);
 		return rate;
 	}
 
@@ -170,7 +171,7 @@ static int jz4740_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 
 	err = clk_set_rate(clk, rate);
 	if (err) {
-		dev_err(chip->dev, "Unable to set rate: %d\n", err);
+		dev_err(pwmchip_parent(chip), "Unable to set rate: %d\n", err);
 		return err;
 	}
 
-- 
2.43.0


  parent reply	other threads:[~2024-02-14  9:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-14  9:30 [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips Uwe Kleine-König
2024-02-14  9:30 ` [PATCH v6 001/164] pwm: Provide an inline function to get the parent device of a given chip Uwe Kleine-König
2024-02-14 10:39   ` Greg Kroah-Hartman
2024-02-14  9:30 ` [PATCH v6 003/164] pwm: Provide pwmchip_alloc() function and a devm variant of it Uwe Kleine-König
2024-02-14 12:49   ` Andy Shevchenko
2024-02-15 12:01     ` Uwe Kleine-König
2024-02-15 13:51       ` Nuno Sá
2024-02-14  9:31 ` [PATCH v6 055/164] pwm: jz4740: Change prototype of a helper to prepare further changes Uwe Kleine-König
2024-02-14  9:31 ` Uwe Kleine-König [this message]
2024-02-14  9:31 ` [PATCH v6 057/164] pwm: jz4740: Make use of devm_pwmchip_alloc() function Uwe Kleine-König
2024-02-15 11:46 ` [PATCH v6 000/164] pwm: Improve lifetime tracking for pwm_chips Uwe Kleine-König
2024-03-25  1:54 ` patchwork-bot+chrome-platform
2024-03-25  2:13 ` patchwork-bot+chrome-platform

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=86b8a362f1e50c5b95c43e056d03ee5ca66d1641.1707900770.git.u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=paul@crapouillou.net \
    /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).