linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com
Cc: Lee Jones <lee.jones@linaro.org>,
	Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-kernel@vger.kernel.org, linux-power@fi.rohmeurope.com,
	linux-clk@vger.kernel.org
Subject: [PATCH 02/15] clk: BD718x7: Do not depend on parent driver data
Date: Fri, 8 Jan 2021 15:31:57 +0200	[thread overview]
Message-ID: <831b5fd8f595599b628303c1b678a9c74d73907d.1610110144.git.matti.vaittinen@fi.rohmeurope.com> (raw)
In-Reply-To: <cover.1610110144.git.matti.vaittinen@fi.rohmeurope.com>

The bd718x7 only needs a regmap from parent device. This can be
obtained by call to dev_get_regmap. Do not require parent to
populate the driver data for this.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
---

Please note that this same change has been sent individually:
https://lore.kernel.org/lkml/20210105123028.GA3409663@localhost.localdomain/
It is present in this series only because some patches depend on it.

 drivers/clk/clk-bd718x7.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/clk-bd718x7.c b/drivers/clk/clk-bd718x7.c
index b52e8d6f660c..17d90e09f1c0 100644
--- a/drivers/clk/clk-bd718x7.c
+++ b/drivers/clk/clk-bd718x7.c
@@ -31,12 +31,12 @@ struct bd718xx_clk {
 	u8 reg;
 	u8 mask;
 	struct platform_device *pdev;
-	struct rohm_regmap_dev *mfd;
+	struct regmap *regmap;
 };
 
 static int bd71837_clk_set(struct bd718xx_clk *c, unsigned int status)
 {
-	return regmap_update_bits(c->mfd->regmap, c->reg, c->mask, status);
+	return regmap_update_bits(c->regmap, c->reg, c->mask, status);
 }
 
 static void bd71837_clk_disable(struct clk_hw *hw)
@@ -62,7 +62,7 @@ static int bd71837_clk_is_enabled(struct clk_hw *hw)
 	int rval;
 	struct bd718xx_clk *c = container_of(hw, struct bd718xx_clk, hw);
 
-	rval = regmap_read(c->mfd->regmap, c->reg, &enabled);
+	rval = regmap_read(c->regmap, c->reg, &enabled);
 
 	if (rval)
 		return rval;
@@ -82,7 +82,6 @@ static int bd71837_clk_probe(struct platform_device *pdev)
 	int rval = -ENOMEM;
 	const char *parent_clk;
 	struct device *parent = pdev->dev.parent;
-	struct rohm_regmap_dev *mfd = dev_get_drvdata(parent);
 	struct clk_init_data init = {
 		.name = "bd718xx-32k-out",
 		.ops = &bd71837_clk_ops,
@@ -93,6 +92,10 @@ static int bd71837_clk_probe(struct platform_device *pdev)
 	if (!c)
 		return -ENOMEM;
 
+	c->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	if (!c->regmap)
+		return -ENODEV;
+
 	init.num_parents = 1;
 	parent_clk = of_clk_get_parent_name(parent->of_node, 0);
 
@@ -119,7 +122,6 @@ static int bd71837_clk_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "Unknown clk chip\n");
 		return -EINVAL;
 	}
-	c->mfd = mfd;
 	c->pdev = pdev;
 	c->hw.init = &init;
 
-- 
2.25.4


-- 
Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
Simon says - in Latin please.
~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
Thanks to Simon Glass for the translation =] 

  parent reply	other threads:[~2021-01-08 13:32 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 13:27 [PATCH 00/15] Support ROHM BD71815 PMIC Matti Vaittinen
2021-01-08 13:29 ` [PATCH 01/15] rtc: bd70528: Do not require parent data Matti Vaittinen
2021-01-08 13:31 ` Matti Vaittinen [this message]
2021-01-08 13:32 ` [PATCH 03/15] mfd: bd718x7: simplify by cleaning unnecessary device data Matti Vaittinen
2021-01-08 13:34 ` [PATCH 04/15] dt_bindings: bd71828: Add clock output mode Matti Vaittinen
2021-01-13 13:52   ` Rob Herring
2021-01-13 14:52     ` Matti Vaittinen
2021-01-13 15:52       ` Rob Herring
2021-01-08 13:34 ` [PATCH 05/15] dt_bindings: mfd: Add ROHM BD71815 PMIC Matti Vaittinen
2021-01-11 19:06   ` Rob Herring
2021-01-12  6:14     ` Vaittinen, Matti
2021-01-08 13:36 ` [PATCH 06/15] dt_bindings: regulator: Add ROHM BD71815 PMIC regulators Matti Vaittinen
2021-01-11 19:09   ` Rob Herring
2021-01-12  6:10     ` Matti Vaittinen
2021-01-13 13:53       ` Rob Herring
2021-01-13 14:23         ` Vaittinen, Matti
2021-01-13 15:47           ` Rob Herring
2021-01-08 13:37 ` [PATCH 07/15] mfd: Add ROHM BD71815 ID Matti Vaittinen
2021-01-08 13:37 ` [PATCH 08/15] mfd: Support for ROHM BD71815 PMIC core Matti Vaittinen
2021-01-08 13:39 ` [PATCH 09/15] gpio: support ROHM BD71815 GPOs Matti Vaittinen
2021-01-08 19:28   ` kernel test robot
2021-01-09  0:45   ` Linus Walleij
2021-01-11  6:15     ` Vaittinen, Matti
2021-01-11  7:26       ` Vaittinen, Matti
2021-01-08 13:41 ` [PATCH 10/15] regulator: helpers: Export helper voltage listing Matti Vaittinen
2021-01-08 13:42 ` [PATCH 11/15] regulator: rohm-regulator: SNVS dvs and linear voltage support Matti Vaittinen
2021-01-15  8:26   ` Lee Jones
2021-01-15  9:10     ` Vaittinen, Matti
2021-01-15  9:48     ` Matti Vaittinen
2021-01-08 13:43 ` [PATCH 12/15] regulator: Support ROHM BD71815 regulators Matti Vaittinen
2021-01-08 22:30   ` kernel test robot
2021-01-08 13:45 ` [PATCH 13/15] clk: bd718x7: Add support for clk gate on ROHM BD71815 PMIC Matti Vaittinen
2021-01-08 13:46 ` [PATCH 14/15] rtc: bd70528: Support RTC on ROHM BD71815 Matti Vaittinen
2021-01-08 13:46 ` [PATCH 15/15] MAINTAINERS: Add ROHM BD71815AGW Matti Vaittinen

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=831b5fd8f595599b628303c1b678a9c74d73907d.1610110144.git.matti.vaittinen@fi.rohmeurope.com \
    --to=matti.vaittinen@fi.rohmeurope.com \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-power@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.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 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 NNTP newsgroup(s).