Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4228190imj; Tue, 12 Feb 2019 12:03:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IaNS64PIpA3FFUjv4fFeuq5utpGaw08gMTQbxVMcWyHgZCG6IkTXcxe+r2cgxp4dvzkD+XU X-Received: by 2002:a63:295:: with SMTP id 143mr5010577pgc.362.1550001822060; Tue, 12 Feb 2019 12:03:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550001822; cv=none; d=google.com; s=arc-20160816; b=GD1xES1PjgoM3hPC3UBZDwUMBrFrz9Lce3FyxYnB15z9j1hd5ztq7vr0Wb8w3S7eBd 4cpDXyEeOAv+un9lV8u8bJl905pJqnhApNX/2Q+QJyrX1NHvsQeSR7bOObJio0Mrr0XF ufBctsUrjI8E75RJcFOhXdSkgVvI56Mrvy2+4Txy0+Yd4ItUhlnI6jQNj3MBAiGlBTzH //F6J1LiurAUR4yJ5OsjFrwywa6W/otcezCspQJlyW0K7RjM0Q65WGxqWzGG9E+kkKwP CDtXvxf0cQ0vbygA4Ggj+9ArLN8OgixEqky2xL6k0fJZW0pGL/Hc+ugVwP+hagyhvP8W pCnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rTdRVLW4iqU6YEAbXMBAFwSqvU1zcoPcYP09y7jwxtU=; b=yIAJhktMG+3eRcsHfzj2OLJ35CyvbIe8qlmA+IIuU3oXBMDDJ+1FzhkGyOKrCAL1mC 5qQ5kweBRdn23Zxcr3J4hjHDwFd02UD7Y/W9sEzUkPg8FMPDd0Rv0tYzQXC4Pow/4b6s 7on4LgxHFeY6bSO1fLUa0FgenGBOoVX9GNm/zIhtFcIQmk0zxS0cYjCRbvs9tdryC1i7 ECxp5ka2LYhMGGpsmGPjjxgmyrg3UMvl+XxtPE1bPKsbB+Gx9f4B1IEmNehjmys0jGGX eY+Bwfebu7b2/trHQVHH1f49frapBIabAgVR0Y0OTyVBK4O8I9bBbLzhgeR7ZCE6ub/S RYtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=srcDGxNS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t22si12485948pgv.190.2019.02.12.12.03.26; Tue, 12 Feb 2019 12:03:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=srcDGxNS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730375AbfBLTMX (ORCPT + 99 others); Tue, 12 Feb 2019 14:12:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:57280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726748AbfBLTMX (ORCPT ); Tue, 12 Feb 2019 14:12:23 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 27DAB21905; Tue, 12 Feb 2019 19:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549998742; bh=ApG+XFbVUeB9kRK7kR/51mjNC0Eay2PRw/AGiZJw+w4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=srcDGxNS31/YWGMYqK8nr7pN8mrTEZaPHSGedyaCLAydD/IkJuGIZx3jaekE8c9IR T6+5iNcPQtCjFxyfr5gnGQmYqnV5FRMdAUJl0koWvF/tc7UHtEzCXxIQNBJPe0Ko/e opjNTIjUVn+p1kIABAXp23G2Npxen9V39/ql49yQ= Date: Tue, 12 Feb 2019 20:12:19 +0100 From: Greg KH To: Xiang Xiao Cc: alexander.shishkin@linux.intel.com, andriy.shevchenko@linux.intel.com, linux-kernel@vger.kernel.org, Xiang Xiao Subject: Re: [v2] lib/string: add memrchr function Message-ID: <20190212191219.GB22246@kroah.com> References: <1549994809-27479-1-git-send-email-xiaoxiang@xiaomi.com> <1549997683-27986-1-git-send-email-xiaoxiang@xiaomi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1549997683-27986-1-git-send-email-xiaoxiang@xiaomi.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 13, 2019 at 02:54:43AM +0800, Xiang Xiao wrote: > Here is the detailed description for memrchr: > > void *memrchr(const void *s, int c, size_t n); > > The memrchr() function is like the memchr() function, except > that it searches backward from the end of the n bytes pointed > to by s instead of forward from the beginning. > > The memrchr() functions return a pointer to the matching byte > or NULL if the character does not occur in the given memory > area. > > Signed-off-by: Xiang Xiao > --- > include/linux/string.h | 1 + > lib/string.c | 21 +++++++++++++++++++++ > 2 files changed, 22 insertions(+) > > diff --git a/include/linux/string.h b/include/linux/string.h > index 7927b87..f380f4b 100644 > --- a/include/linux/string.h > +++ b/include/linux/string.h > @@ -167,6 +167,7 @@ static inline void memcpy_flushcache(void *dst, const void *src, size_t cnt) > memcpy(dst, src, cnt); > } > #endif > +void *memrchr(const void *s, int c, size_t n); > void *memchr_inv(const void *s, int c, size_t n); > char *strreplace(char *s, char old, char new); Also, if you really need this, why not also provide the arch-specific versions as well? thanks, greg k-h