Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1697117ybh; Tue, 14 Jul 2020 05:06:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSnqOQd2kY7WlRClg1hoPhRf1xwd+/1EGw1cjELIukY5Avr/ywWekf8r4FO3zD/naZmioQ X-Received: by 2002:a17:906:abca:: with SMTP id kq10mr4332875ejb.515.1594728396912; Tue, 14 Jul 2020 05:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594728396; cv=none; d=google.com; s=arc-20160816; b=RqcbSOU3w1wwNuO22i4ARkIMaQSAIrBMr0uDJnzun1LsAi1qs6i8YgQCsTW9JRHwWX 5UkFx0A3YMPQ6PSL1xzI6YgGgTd+mkb4zcWCT34N6t1dNCuSOOdHBaj1Myl4s2eLsjfu UU2HJT7S5KSRz3ipXoyCOpE2fKxAQv1CkR4y75326l9zxhDcw93lFemWq/eRoAQvDFSN jxpgf/pGyniSeVyveXMjNqKSNmwr8sSkDYHdh9Xn2P0UC30Ok0NIwv6e30jql+fkDIof UOZshwMTtJZHJqVu0eaamQfvvsuhQ+CXhXtrGYpqDD1TmSlQFiukTH6YesX+q1IKKq39 Qpng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=xILWBy+WcBR3Ga5ltUizsaAt3ttcC5+NQCsKUW5WOl0=; b=tzd6CH6RNvKAZmLnnYKYORazoLY84uDmzLascdiuOLzhyA71oym3tS60auNZmQ7i60 2ip3MovN787h3emdbdbZzvx7bBZQUqYyLakEY1Rqs5k8LKu0IdN/nzawxUpD29xsExjV 4RegMnwRV9iibs808AZk8ew9ZvsPPkErPXjynYFdOcJagWLikBjM3GvLNQowZnN0CB9J QppSZgmJYclfVeXRoJ98DFz+jGSFNNXCk16Vt90etKIqXkJqI+uQNlxDpbz5sIhXuDoU tawQzi6vVx44JhS+KT4utoeB980pzVoxe/Eg5uNSbvu2cWyiOfDYBGXFuucFFwkb04iW 1g8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si11765655eje.503.2020.07.14.05.06.12; Tue, 14 Jul 2020 05:06:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728096AbgGNMCO (ORCPT + 99 others); Tue, 14 Jul 2020 08:02:14 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:52571 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728047AbgGNMCN (ORCPT ); Tue, 14 Jul 2020 08:02:13 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from vadimp@mellanox.com) with SMTP; 14 Jul 2020 15:02:06 +0300 Received: from r-build-lowlevel.mtr.labs.mlnx. (r-build-lowlevel.mtr.labs.mlnx [10.209.0.190]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 06EC25de004353; Tue, 14 Jul 2020 15:02:06 +0300 From: Vadim Pasternak To: andy@infradead.org, dvhart@infradead.org Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Vadim Pasternak Subject: [PATCH platform-next v2 01/11] lib/string_helpers: Introduce string_upper() and string_lower() helpers Date: Tue, 14 Jul 2020 15:01:53 +0300 Message-Id: <20200714120203.10352-2-vadimp@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200714120203.10352-1-vadimp@mellanox.com> References: <20200714120203.10352-1-vadimp@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Provide the helpers for string conversions to upper alnd lower cases. Signed-off-by: Vadim Pasternak --- include/linux/string_helpers.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index c28955132234..86f150c2a6b6 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -2,6 +2,7 @@ #ifndef _LINUX_STRING_HELPERS_H_ #define _LINUX_STRING_HELPERS_H_ +#include #include struct file; @@ -75,6 +76,20 @@ static inline int string_escape_str_any_np(const char *src, char *dst, return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, only); } +static inline void string_upper(char *dst, const char *src) +{ + do { + *dst++ = toupper(*src); + } while (*src++); +} + +static inline void string_lower(char *dst, const char *src) +{ + do { + *dst++ = tolower(*src); + } while (*src++); +} + char *kstrdup_quotable(const char *src, gfp_t gfp); char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp); char *kstrdup_quotable_file(struct file *file, gfp_t gfp); -- 2.11.0