Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp151235rdb; Fri, 29 Sep 2023 21:59:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyxqZxWf6TQQafUZyYqYx8Y3dd3JGpwO7ikhuv+GYpOwCZ4uzTiRFnlXjaD7uSOmaNRTlu X-Received: by 2002:a05:6358:9992:b0:133:595:1c with SMTP id j18-20020a056358999200b001330595001cmr5207606rwb.31.1696049940243; Fri, 29 Sep 2023 21:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696049940; cv=none; d=google.com; s=arc-20160816; b=i2eTbnXT5JjCi9bFw5zqjDpbgx36jrnyjFFrj5C98jZZ6Ao6wRwvMzm1gqtkT3prt9 KzaIofpWoMLE4T1yW/sw1yVXAJAA5U8j012BlBmIslIsqy557w8PsFhoPhfolrHCIG+Z xFnMUOxD3Z6BVQf2mu8FQ/brRrt6rGlI6c5pBWbX1iSHaNUIk1MBBfrHEbfBpgHyG/Ds 0urxFI8gRLZDn/VSs+1u1OKqnXmS1MeYU3dUV/5hgL1wmEYipw6ozxSM/weJsQS5CElH QcB0cfVar06V7d2E8wi04XnuyMiQ6URy2Xa1N2sCqNpPm2PwQL9hsZztVbFmOqKnKVQF UJHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=uA9XK8E7/6R+QMcu0HmvQ9D0Jr37mtSddcB/J0TCnlo=; fh=pqXxjzc7zV6c0FZ/rb/NmcR4vRIbdxyF35OEhIBQUys=; b=zF+KTD/xlWiJv29iAwfkmTfTQL05gW8xrjLA8ik2jeYSXGxRaG3dSY4b59umvvI7t/ eKFd66fiOYf6r7eQruTlSeAAe27XjWGlg7XE//sTx4NamYsQUWCwgtgQe2rs3YMNBLJL 0kaYHGp6OZ+4gONBHGR/hvzeXBO3FguebA99qZjqm3JpAIvonDzEFNtld22bJOKPsRCr 0czXc6kKQJ8qLnJ3dEJA4a8sf+ag2wVAIyY0fOOZc4gug5ocStxdJAINDHTFTAiOyMuA J6HiG/KLKEVwVHjc46b/BF2v0hbvIdJ4snyFsl5sqL+TKm1qRuyjnZ1cNHwp7qSP063z svIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=mYmvzhSA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 64-20020a630043000000b005859a90c58csi3535043pga.772.2023.09.29.21.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 21:59:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=mYmvzhSA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C6722819476F; Fri, 29 Sep 2023 10:39:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233179AbjI2RjT (ORCPT + 99 others); Fri, 29 Sep 2023 13:39:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232923AbjI2RjS (ORCPT ); Fri, 29 Sep 2023 13:39:18 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77AE4195; Fri, 29 Sep 2023 10:39:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1696009154; bh=W5xM3Txn9PEOVtEBA1zRK/LCXQhgKhgHvmFCijy64WI=; h=From:Date:Subject:To:Cc:From; b=mYmvzhSAvNPEUX4++pDCcwGZX82vBn8zpTox1N/nKOcaWJ/XNUQFvC64j1Sivcjeb BI5pvqdk0lYwwsuYb/bbSSRhXikXMO4e5tizZwZQdVrh/R2Rd8WH4Yo/TPKlXlfkby MAguxAZx6BCu8u1Ba4gZZu/oWpCTy49cHi+Tw23c= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Fri, 29 Sep 2023 19:39:00 +0200 Subject: [PATCH] power: supply: core: remove opencoded string_lower() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230929-power_supply-string_lower-v1-1-3141a2634d53@weissschuh.net> X-B4-Tracking: v=1; b=H4sIALMLF2UC/x2MWwqAMAzAriL9duAmKPMqIiJatSBztD4Z3t3pZ wJJAEEmFKiSAIwHCa0ugk4T6OfOTahoiAwmM3lmjVV+PZFb2b1fbiUbk5va5XMq14UebVkiFgZ i7xlHuv533TzPC0m8GyxrAAAA To: Sebastian Reichel Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1696009154; l=1573; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=W5xM3Txn9PEOVtEBA1zRK/LCXQhgKhgHvmFCijy64WI=; b=iCSDW/uuOBs5cAmRcRWMdP4nKFuq3RlYVhLVRLvmDfOGl9Rz0bJQ0M9WpROsOOdM9w59s+Yl/ MR9NyysF9vhDYmGw5EHd1mBHgtsIwl4a2vgElRfwGyUrNkaa61eTkKS X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, TVD_SUBJ_WIPE_DEBT autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 10:39:28 -0700 (PDT) string_lower from string_helpers.h can be used to modify the string in-place. Use it to get rid of the custom str_to_lower(). Signed-off-by: Thomas Weißschuh --- drivers/power/supply/power_supply_sysfs.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index d483a81560ab..977611e16373 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "power_supply.h" @@ -398,14 +399,6 @@ static const struct attribute_group *power_supply_attr_groups[] = { NULL, }; -static void str_to_lower(char *str) -{ - while (*str) { - *str = tolower(*str); - str++; - } -} - void power_supply_init_attrs(struct device_type *dev_type) { int i; @@ -420,7 +413,8 @@ void power_supply_init_attrs(struct device_type *dev_type) __func__, i); sprintf(power_supply_attrs[i].attr_name, "_err_%d", i); } else { - str_to_lower(power_supply_attrs[i].attr_name); + string_lower(power_supply_attrs[i].attr_name, + power_supply_attrs[i].attr_name); } attr = &power_supply_attrs[i].dev_attr; --- base-commit: 71e58659bfc02e4171345f80b13d6485e9cdf687 change-id: 20230929-power_supply-string_lower-3161f977ee62 Best regards, -- Thomas Weißschuh