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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 21 Jul 2015 15:50:47 +0200
From:	Tomeu Vizoso <tomeu.vizoso@...labora.com>
To:	linux-kernel@...r.kernel.org
Cc:	Stephen Warren <swarren@...dotorg.org>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	linux-arm-kernel@...ts.infradead.org,
	Arnd Bergmann <arnd@...db.de>, Mark Brown <broonie@...nel.org>,
	Tomeu Vizoso <tomeu.vizoso@...labora.com>
Subject: [RFC PATCH 05/16] Add DEVM_RESET()

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@...labora.com>
---

 drivers/reset/core.c  | 13 +++++++++++++
 include/linux/reset.h | 10 ++++++++++
 2 files changed, 23 insertions(+)

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 7955e00d04d4..a890c401dbf0 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -303,3 +303,16 @@ int device_reset(struct device *dev)
 	return ret;
 }
 EXPORT_SYMBOL_GPL(device_reset);
+
+int devm_acquire_reset(struct device *dev,
+		       const struct devm_resource *resource)
+{
+	struct reset_control **rstp = dev_get_drvdata(dev) + resource->offset;
+
+	*rstp = devm_reset_control_get(dev, resource->name);
+	if (IS_ERR(*rstp))
+		return PTR_ERR(*rstp);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(devm_acquire_reset);
diff --git a/include/linux/reset.h b/include/linux/reset.h
index da5602bd77d7..1771c5cbfeb1 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -3,6 +3,7 @@
 
 struct device;
 struct device_node;
+struct devm_resource;
 struct reset_control;
 
 #ifdef CONFIG_RESET_CONTROLLER
@@ -38,6 +39,15 @@ static inline struct reset_control *devm_reset_control_get_optional(
 struct reset_control *of_reset_control_get(struct device_node *node,
 					   const char *id);
 
+int devm_acquire_reset(struct device *dev,
+		       const struct devm_resource *resource);
+
+#define DEVM_RESET(_struct, _member, _name) {	 			\
+	.initfunc = devm_acquire_reset,				 	\
+	.offset = offsetof_t(struct _struct, _member, struct reset_control *),\
+	.name = _name,							\
+}
+
 #else
 
 static inline int reset_control_reset(struct reset_control *rstc)
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ