lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 24 Feb 2016 12:19:01 +0100
From:	Philipp Zabel <p.zabel@...gutronix.de>
To:	Lee Jones <lee.jones@...aro.org>
Cc:	Arnd Bergmann <arnd@...db.de>, Alexander Shiyan <shc_work@...l.ru>,
	Pankaj Dubey <pankaj.dubey@...sung.com>,
	Pawel Moll <pawel.moll@....com>,
	Wolfram Sang <wsa@...-dreams.de>,
	Peter Seiderer <ps.report@....net>,
	Tushar Behera <tushar.behera@...aro.org>,
	linux-kernel@...r.kernel.org, kernel@...gutronix.de,
	Philipp Zabel <p.zabel@...gutronix.de>
Subject: [PATCH v2] mfd: syscon: allow to register syscon with a device

Commit bdb0066df96e ("mfd: syscon: Decouple syscon interface from platform
devices") added the possibility to register syscon devices without
associated platform device. This also removed regmap debugfs facilities,
which don't work without a device. Since there is no replacement, this
patch allows again to register syscon regions with an associated device
where that this device exists anyway.

Signed-off-by: Philipp Zabel <p.zabel@...gutronix.de>
---
Changes since v1:
 - Rebased onto for-mfd-next
---
 drivers/mfd/syscon.c       | 10 ++++++++--
 include/linux/mfd/syscon.h | 10 ++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 2f2225e..fe67fb0 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -42,7 +42,7 @@ static const struct regmap_config syscon_regmap_config = {
 	.reg_stride = 4,
 };
 
-static struct syscon *of_syscon_register(struct device_node *np)
+struct syscon *syscon_register(struct device *dev, struct device_node *np)
 {
 	struct syscon *syscon;
 	struct regmap *regmap;
@@ -89,7 +89,7 @@ static struct syscon *of_syscon_register(struct device_node *np)
 	syscon_config.val_bits = reg_io_width * 8;
 	syscon_config.max_register = resource_size(&res) - reg_io_width;
 
-	regmap = regmap_init_mmio(NULL, base, &syscon_config);
+	regmap = regmap_init_mmio(dev, base, &syscon_config);
 	if (IS_ERR(regmap)) {
 		pr_err("regmap init failed\n");
 		ret = PTR_ERR(regmap);
@@ -111,6 +111,12 @@ err_map:
 	kfree(syscon);
 	return ERR_PTR(ret);
 }
+EXPORT_SYMBOL_GPL(syscon_register);
+
+static struct syscon *of_syscon_register(struct device_node *np)
+{
+	return syscon_register(NULL, np);
+}
 
 struct regmap *syscon_node_to_regmap(struct device_node *np)
 {
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h
index 1088149..e26037c 100644
--- a/include/linux/mfd/syscon.h
+++ b/include/linux/mfd/syscon.h
@@ -17,10 +17,14 @@
 
 #include <linux/err.h>
 
+struct device;
 struct device_node;
+struct syscon;
 
 #ifdef CONFIG_MFD_SYSCON
 extern struct regmap *syscon_node_to_regmap(struct device_node *np);
+extern struct syscon *syscon_register(struct device *dev,
+				      struct device_node *np);
 extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
 extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s);
 extern struct regmap *syscon_regmap_lookup_by_phandle(
@@ -32,6 +36,12 @@ static inline struct regmap *syscon_node_to_regmap(struct device_node *np)
 	return ERR_PTR(-ENOTSUPP);
 }
 
+static struct syscon *syscon_register(struct device *dev,
+				      struct device_node *np)
+{
+	return ERR_PTR(-ENOTSUPP);
+}
+
 static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s)
 {
 	return ERR_PTR(-ENOTSUPP);
-- 
2.7.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ