From patchwork Fri Oct 13 09:42:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 10003993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EF25D60216 for ; Fri, 13 Oct 2017 09:42:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2A8028FFD for ; Fri, 13 Oct 2017 09:42:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7C132900C; Fri, 13 Oct 2017 09:42:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92E2028FFD for ; Fri, 13 Oct 2017 09:42:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757800AbdJMJme (ORCPT ); Fri, 13 Oct 2017 05:42:34 -0400 Received: from s3.sipsolutions.net ([144.76.63.242]:49164 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757630AbdJMJmc (ORCPT ); Fri, 13 Oct 2017 05:42:32 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1e2wUB-000389-Ir; Fri, 13 Oct 2017 11:42:31 +0200 From: Johannes Berg To: backports@vger.kernel.org Cc: Johannes Berg Subject: [PATCH v2 05/11] backports: add bin2hex() Date: Fri, 13 Oct 2017 11:42:20 +0200 Message-Id: <20171013094226.10021-5-johannes@sipsolutions.net> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171013094226.10021-1-johannes@sipsolutions.net> References: <20171013094226.10021-1-johannes@sipsolutions.net> Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Berg This is needed in the key backports in the next patch. Signed-off-by: Johannes Berg --- backport/backport-include/linux/kernel.h | 5 +++++ backport/compat/backport-3.18.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/backport/backport-include/linux/kernel.h b/backport/backport-include/linux/kernel.h index 0e9a69f9bcd2..3ddeb13c29a2 100644 --- a/backport/backport-include/linux/kernel.h +++ b/backport/backport-include/linux/kernel.h @@ -213,6 +213,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);