From patchwork Wed Sep 19 10:01:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chi-Hsien Lin X-Patchwork-Id: 10605575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2BEB4161F for ; Wed, 19 Sep 2018 10:01:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2437D2B5A4 for ; Wed, 19 Sep 2018 10:01:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18C922B604; Wed, 19 Sep 2018 10:01:23 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 15E0F2B5A4 for ; Wed, 19 Sep 2018 10:01:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730876AbeISPi3 (ORCPT ); Wed, 19 Sep 2018 11:38:29 -0400 Received: from mail-bl2nam02on0132.outbound.protection.outlook.com ([104.47.38.132]:13258 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728059AbeISPi3 (ORCPT ); Wed, 19 Sep 2018 11:38:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cycorp.onmicrosoft.com; s=selector1-cypress-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ANR9mTgsYv3WOjVJoiUNIHWgiOJChAvyV75s46cSyhU=; b=Z+0i+uQHNhFup16kBwRSeSh9+jTInxU/0jqFuF+nku8P6J+lWkSQM9LD1E+HMTKD8MyYixwobbFIU+NY/RpM1Q0J+ZscuxtUNitrZqTZ/EzhHFiPKxM0MvnjCbl0K9L6ai/pdIqgWsyaaPCu/S16OtQrJHtUZjwRfsMfzBVcKHg= Received: from BY1PR0601MB1436.namprd06.prod.outlook.com (10.162.111.23) by BY1PR0601MB1320.namprd06.prod.outlook.com (10.161.206.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Wed, 19 Sep 2018 10:01:14 +0000 Received: from BY1PR0601MB1436.namprd06.prod.outlook.com ([fe80::10be:ee6a:862e:98b0]) by BY1PR0601MB1436.namprd06.prod.outlook.com ([fe80::10be:ee6a:862e:98b0%2]) with mapi id 15.20.1143.017; Wed, 19 Sep 2018 10:01:14 +0000 From: Chi-Hsien Lin To: "backports@vger.kernel.org" , Johannes Berg CC: Winnie Chang , Winnie Chang , Chi-Hsien Lin Subject: [PATCH] backports: add strreplace() Thread-Topic: [PATCH] backports: add strreplace() Thread-Index: AQHUT/+zLcntM2b2GUORYT9K1lSilQ== Date: Wed, 19 Sep 2018 10:01:14 +0000 Message-ID: <1537351259-19914-1-git-send-email-chi-hsien.lin@cypress.com> Accept-Language: en-US, zh-TW Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [12.110.209.245] x-clientproxiedby: MWHPR19CA0089.namprd19.prod.outlook.com (2603:10b6:320:1f::27) To BY1PR0601MB1436.namprd06.prod.outlook.com (2a01:111:e400:522c::23) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Chi-Hsien.Lin@cypress.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BY1PR0601MB1320;6:MhRvGtc1YztML6aJQF1wukgIcK/oR+n1ojVRsc6rwDwI6ZoksH9MiO7zHWjrgnakiN/ctjQJW1VsLKALOQWuzhWhSI4SoJMQCqN0g3BltrCepa8lb9HS03lPfi2TQ97TTeSiOMvyge53arO0BGNQibCj+/Oty8UY1g56sSGeb3+LQGWq1sCzuoQBYbt2UUL/0Hk6zdDCKanjyNsromkzq3/aBMOOwdZkEt0iexD3oHv8C0oE4ZABxPUgTB1BzDtiZu/7keOoeezmLWeh9DEg5z1bsvFd6yL/CPLHnCIJzLMVn3EW7HATVIL8ZQhEXoDYw1wmiX+Kmij1wYZOH7wf+tduxQuxU+WUaZs478tG7m3s5kjVtcQ3qBrIoEhRZOFvOI6nTMAI72aHCTamQX57PIhvyqX4+siOC10uPfi81naFvROL2Ohbc+8OE8VXKQyxCwW912xp8U4E5ao/H1wf5Q==;5:nr1dluanCbaz1D+YhOZFKGxBWuvaPKdqRenWCPHB0yokQl/sK1n0zxq5tTAgS9X4p3KQhydXh0uRmIhlWeNSm69iGVBVYn2mvGY29AOA6MNGq53HB9GJ+29gRNcXfFx6pl1bO1mCNc0s/r+yPfObRUFHNxfrbsuTXZoSKqLogBs=;7:Tw2tZa78qTWw5jkJhL7oUBEEpXbBjR5cMgv34xzZT7lYtwTC1P8CgHTWQu8F3ByCBPANh1EZ9U5pBSOKeHvTbMoV4n1Meen/c2n+pdQmQubNLFSipvyc6gy1D5DRyuR1JcxrxR0ciQ+fub4tnJqoULNn79grdCW4EegPD5H17oUCRCS+kly7I81BqAL8H4LzaKuRycT3FdKKH+lyd9zstnhjVeQZSJmZLy+IZu+0Zz5SYHy3MwSo/DxA2uxrB4da x-ms-office365-filtering-correlation-id: 8b441652-d87f-4b46-ad77-08d61e16d552 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:BY1PR0601MB1320; x-ms-traffictypediagnostic: BY1PR0601MB1320: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(258095267146985)(103651359005742); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699050);SRVR:BY1PR0601MB1320;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0601MB1320; x-forefront-prvs: 0800C0C167 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(136003)(39860400002)(396003)(366004)(376002)(346002)(189003)(199004)(97736004)(186003)(14444005)(54906003)(476003)(2616005)(5250100002)(486006)(110136005)(6436002)(316002)(256004)(99286004)(102836004)(52116002)(86362001)(2900100001)(107886003)(2501003)(14454004)(5024004)(6486002)(105586002)(106356001)(4326008)(8936002)(6116002)(5660300001)(72206003)(36756003)(68736007)(3846002)(81166006)(6512007)(81156014)(53936002)(6506007)(1857600001)(305945005)(25786009)(478600001)(386003)(26005)(8676002)(2906002)(66066001)(7736002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0601MB1320;H:BY1PR0601MB1436.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: cypress.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: M403y+sPgOORWZT++/O894BMX4nXptJR6pPVi6d8rotKeTLK3XQrkMNtjRif+/QUkDhJzpb2YTfTulXM+9bomAY2LPmxNsFC/YcretuXY6da1aLdQSjj/PMJtn49u14NbiDbeU3MQDWp5IJhUfe+qY2s/rmnCpni9X0NnDmbPynSGguo9GorSYu+68C6E1G9FYYZPe/7m7m2LY63x3W1BY1PIvGucCucK6bORB2Pxr7Bd5gfwIFQtz+Wzc7lheMJf5QKf9tvp1xkGLmM1Bd4roe/9Bd1najxl8EKRwlzfRI6ADpTxDmW/S9SQQqmIZjLeeNfNb5aWvCeltKmL/OScFqDkZHbeawMkCEDOYyQGiQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: cypress.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b441652-d87f-4b46-ad77-08d61e16d552 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Sep 2018 10:01:14.5840 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 011addfc-2c09-450d-8938-e0bbc2dd2376 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0601MB1320 Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Winnie Chang wireless-drivers-next.git commit cb18e2e9ec71 (brcmfmac: fix wrong strnchr usage) used strreplace(), which is not available in kernel prior to v4.12. Before this commit proprgates to linux-stable.git, add strreplace() to avoid gentree failure. Signed-off-by: Winnie Chang Signed-off-by: Chi-Hsien Lin --- backport/backport-include/linux/string.h | 4 ++++ backport/compat/backport-4.2.c | 9 +++++++++ 2 files changed, 13 insertions(+) -- 2.1.0 This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message. -- To unsubscribe from this list: send the line "unsubscribe backports" in diff --git a/backport/backport-include/linux/string.h b/backport/backport-include/linux/string.h index b85d9c73dc27..4b35eb9f2baf 100644 --- a/backport/backport-include/linux/string.h +++ b/backport/backport-include/linux/string.h @@ -29,4 +29,8 @@ void memzero_explicit(void *s, size_t count); ssize_t strscpy(char *dest, const char *src, size_t count); #endif +#if LINUX_VERSION_IS_LESS(4,2,0) +char *strreplace(char *s, char old, char new); +#endif + #endif /* __BACKPORT_LINUX_STRING_H */ diff --git a/backport/compat/backport-4.2.c b/backport/compat/backport-4.2.c index e00aa49c7e4a..b275d349f7eb 100644 --- a/backport/compat/backport-4.2.c +++ b/backport/compat/backport-4.2.c @@ -65,3 +65,12 @@ struct aead_request *crypto_backport_convert(struct aead_request *req) return &nreq->subreq; } EXPORT_SYMBOL_GPL(crypto_backport_convert); + +char *strreplace(char *s, char old, char new) +{ +for (; *s; ++s) +if (*s == old) +*s = new; +return s; +} +EXPORT_SYMBOL_GPL(strreplace);