mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benjamin Gaignard <benjamin.gaignard@st.com>
To: <broonie@kernel.org>, <robh@kernel.org>, <arnd@arndb.de>,
	<shawnguo@kernel.org>, <s.hauer@pengutronix.de>,
	<fabio.estevam@nxp.com>
Cc: <linux-kernel@vger.kernel.org>, <loic.pallardy@st.com>,
	<benjamin.gaignard@linaro.org>, <kernel@pengutronix.de>,
	<linux-imx@nxp.com>, <linux-arm-kernel@lists.infradead.org>,
	Benjamin Gaignard <benjamin.gaignard@st.com>
Subject: [RFC v2 3/7] base: Add calls to domains controller
Date: Mon, 28 Jan 2019 15:23:09 +0100	[thread overview]
Message-ID: <20190128142313.17036-4-benjamin.gaignard@st.com> (raw)
In-Reply-To: <20190128142313.17036-1-benjamin.gaignard@st.com>

To avoid modifying all the drivers call domainsctrl_set_default_config
before probe to apply the configuration define in device node (if any).

When unbinding the device try to apply configuration named "unbind".

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
---
 drivers/base/dd.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 8ac10af17c00..2880fe893096 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -20,6 +20,7 @@
 #include <linux/device.h>
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
+#include <linux/domainsctrl.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kthread.h>
@@ -478,6 +479,10 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 re_probe:
 	dev->driver = drv;
 
+	ret = domainsctrl_set_default_config(dev);
+	if (ret)
+		goto domainctrl_failed;
+
 	/* If using pinctrl, bind pins now before probing */
 	ret = pinctrl_bind_pins(dev);
 	if (ret)
@@ -548,6 +553,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 		blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
 					     BUS_NOTIFY_DRIVER_NOT_BOUND, dev);
 pinctrl_bind_failed:
+	domainsctrl_set_config_by_name(dev, "unbind");
+domainctrl_failed:
 	device_links_no_driver(dev);
 	devres_release_all(dev);
 	driver_sysfs_remove(dev);
@@ -970,6 +977,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
 		device_links_driver_cleanup(dev);
 		arch_teardown_dma_ops(dev);
 
+		domainsctrl_set_config_by_name(dev, "unbind");
+
 		devres_release_all(dev);
 		dev->driver = NULL;
 		dev_set_drvdata(dev, NULL);
-- 
2.15.0


  parent reply	other threads:[~2019-01-28 14:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 14:23 [RFC v2 0/7] Introduce bus domains controller framework Benjamin Gaignard
2019-01-28 14:23 ` [RFC v2 1/7] devicetree: bindings: Document domains controller bindings Benjamin Gaignard
2019-02-18 16:04   ` Benjamin Gaignard
2019-01-28 14:23 ` [RFC v2 2/7] domainsctrl: Introduce domains controller framework Benjamin Gaignard
2019-01-29 15:12   ` Mark Brown
2019-01-28 14:23 ` Benjamin Gaignard [this message]
2019-01-29 15:14   ` [RFC v2 3/7] base: Add calls to domains controller Mark Brown
2019-01-28 14:23 ` [RFC v2 4/7] devicetree: bindings: domainsctrl: Add STM32 ETZPC bindings Benjamin Gaignard
2019-01-28 14:23 ` [RFC v2 5/7] bus: domainsctrl: Add driver for STM32 ETZPC controller Benjamin Gaignard
2019-01-28 14:23 ` [RFC v2 6/7] ARM: dts: stm32: Add domainsctrl node for stm32mp157 SoC Benjamin Gaignard
2019-01-28 14:23 ` [RFC v2 7/7] ARM: dts: stm32: enable domains controller node on stm32mp157c-ed1 Benjamin Gaignard

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=20190128142313.17036-4-benjamin.gaignard@st.com \
    --to=benjamin.gaignard@st.com \
    --cc=arnd@arndb.de \
    --cc=benjamin.gaignard@linaro.org \
    --cc=broonie@kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.pallardy@st.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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

all inboxes | Powered by JetHome®