diff mbox

[4/5] backports: add bin2hex()

Message ID 20171012210025.7490-4-johannes@sipsolutions.net (mailing list archive)
State Superseded
Headers show

Commit Message

Johannes Berg Oct. 12, 2017, 9 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport/backport-include/linux/kernel.h |  5 +++++
 backport/compat/backport-3.18.c          | 10 ++++++++++
 2 files changed, 15 insertions(+)

Comments

Arend van Spriel Oct. 13, 2017, 8:55 a.m. UTC | #1
On 12-10-17 23:00, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>

any remark why/who needs this. The change summary hints that it is 
needed for kernels before 3.18.

Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Johannes Berg Oct. 13, 2017, 8:56 a.m. UTC | #2
On Fri, 2017-10-13 at 10:55 +0200, Arend van Spriel wrote:
> On 12-10-17 23:00, Johannes Berg wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> 
> any remark why/who needs this. The change summary hints that it is 
> needed for kernels before 3.18.

Sorry. Key stuff in the next patch requires it :)

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
diff mbox

Patch

diff --git a/backport/backport-include/linux/kernel.h b/backport/backport-include/linux/kernel.h
index ea55d7d3b143..0d625313f5fb 100644
--- a/backport/backport-include/linux/kernel.h
+++ b/backport/backport-include/linux/kernel.h
@@ -211,6 +211,11 @@  static inline u32 reciprocal_scale(u32 val, u32 ep_ro)
 }
 #endif /* LINUX_VERSION_IS_LESS(3,14,0) */
 
+#if LINUX_VERSION_IS_LESS(3,18,0)
+#define bin2hex LINUX_BACKPORT(bin2hex)
+extern char *bin2hex(char *dst, const void *src, size_t count);
+#endif
+
 #endif /* __BACKPORT_KERNEL_H */
 
 /*
diff --git a/backport/compat/backport-3.18.c b/backport/compat/backport-3.18.c
index 73db233cb22b..d2eceef7dc77 100644
--- a/backport/compat/backport-3.18.c
+++ b/backport/compat/backport-3.18.c
@@ -320,3 +320,13 @@  void memzero_explicit(void *s, size_t count)
 }
 EXPORT_SYMBOL_GPL(memzero_explicit);
 #endif
+
+char *bin2hex(char *dst, const void *src, size_t count)
+{
+	const unsigned char *_src = src;
+
+	while (count--)
+		dst = hex_byte_pack(dst, *_src++);
+	return dst;
+}
+EXPORT_SYMBOL(bin2hex);