linux-arm-kernel.lists.infradead.org archive mirror
 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>, <sudeep.holla@arm.com>, <lkml@metux.net>
Cc: devicetree@vger.kernel.org,
	Benjamin Gaignard <benjamin.gaignard@st.com>,
	loic.pallardy@st.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, linux-imx@nxp.com,
	kernel@pengutronix.de, stefano.stabellini@xilinx.com,
	system-dt@lists.openampproject.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/7] base: Add calls to firewall controller
Date: Tue, 28 Jan 2020 16:38:02 +0100	[thread overview]
Message-ID: <20200128153806.7780-4-benjamin.gaignard@st.com> (raw)
In-Reply-To: <20200128153806.7780-1-benjamin.gaignard@st.com>

To avoid modifying all the drivers call firewall_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 d811e60610d3..6a2153f6b19b 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/firewall.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kthread.h>
@@ -521,6 +522,10 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 re_probe:
 	dev->driver = drv;
 
+	ret = firewall_set_default_config(dev);
+	if (ret)
+		goto firewall_failed;
+
 	/* If using pinctrl, bind pins now before probing */
 	ret = pinctrl_bind_pins(dev);
 	if (ret)
@@ -601,6 +606,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:
+	firewall_set_config_by_name(dev, "unbind");
+firewall_failed:
 	device_links_no_driver(dev);
 	devres_release_all(dev);
 	arch_teardown_dma_ops(dev);
@@ -1135,6 +1142,8 @@ static void __device_release_driver(struct device *dev, struct device *parent)
 
 		device_links_driver_cleanup(dev);
 
+		firewall_set_config_by_name(dev, "unbind");
+
 		devres_release_all(dev);
 		arch_teardown_dma_ops(dev);
 		dev->driver = NULL;
-- 
2.15.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-01-28 15:39 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-28 15:37 [PATCH v2 0/7] Introduce bus firewall controller framework Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 1/7] dt-bindings: bus: Add firewall bindings Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 2/7] bus: Introduce firewall controller framework Benjamin Gaignard
2020-01-28 15:52   ` Greg KH
2020-01-28 16:41     ` Benjamin GAIGNARD
2020-01-28 16:57       ` Greg KH
2020-01-28 20:29         ` Benjamin GAIGNARD
2020-01-29  5:49           ` Greg KH
2020-01-29  9:42           ` Linus Walleij
2020-01-29  9:52             ` Greg KH
2020-01-29 11:17               ` Mark Brown
2020-01-31  8:37                 ` Benjamin GAIGNARD
2020-01-31  9:06                   ` Greg KH
2020-02-14 16:05                     ` Linus Walleij
2020-02-14 21:40                       ` Greg KH
2020-02-15 12:41                         ` Benjamin GAIGNARD
2020-02-16  7:21                           ` Greg KH
2020-01-28 15:38 ` Benjamin Gaignard [this message]
2020-01-28 15:38 ` [PATCH v2 4/7] dt-bindings: bus: Add STM32 ETZPC firewall controller Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 5/7] bus: firewall: Add driver for STM32 ETZPC controller Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 6/7] ARM: dts: stm32: Add firewall node for stm32mp157 SoC Benjamin Gaignard
2020-01-28 15:38 ` [PATCH v2 7/7] ARM: dts: stm32: enable firewall controller node on stm32mp157c-ed1 Benjamin Gaignard
2020-01-28 16:36 ` [PATCH v2 0/7] Introduce bus firewall controller framework Sudeep Holla
2020-01-28 16:46   ` Benjamin GAIGNARD
2020-01-28 17:17     ` Sudeep Holla
2020-01-28 20:06       ` Benjamin GAIGNARD
2020-01-28 22:06         ` Robin Murphy
2020-01-29 13:40           ` Benjamin GAIGNARD
2020-01-31 18:25             ` Robin Murphy
2020-02-03 13:16               ` Benjamin GAIGNARD
2020-01-31 20:51             ` Florian Fainelli
2020-02-03 13:41               ` Benjamin GAIGNARD
2020-01-31 20:48         ` Florian Fainelli
2020-02-02 12:23           ` Mark Brown

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=20200128153806.7780-4-benjamin.gaignard@st.com \
    --to=benjamin.gaignard@st.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@metux.net \
    --cc=loic.pallardy@st.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=stefano.stabellini@xilinx.com \
    --cc=sudeep.holla@arm.com \
    --cc=system-dt@lists.openampproject.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).