Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1426674lqt; Wed, 20 Mar 2024 03:53:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8DgKSGI4I1zDG0++DHnSVMHqCC/ex+4PxpqGcBPI6Ul29finA0WWe/k1YBzAA5Hd+37hYwy48OlmSMXVKhkimPKBW//8uPhDgpreexw== X-Google-Smtp-Source: AGHT+IFK8JfB1IhvpJnibfOP6NAKFcHUYryU54x3jvsURgPmmjOr80PuBaWKFmS3kvXGEFYbFj93 X-Received: by 2002:a05:6358:41a4:b0:17c:11b4:9cff with SMTP id w36-20020a05635841a400b0017c11b49cffmr5034841rwc.16.1710932022445; Wed, 20 Mar 2024 03:53:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710932022; cv=pass; d=google.com; s=arc-20160816; b=d1Hewls9VMQR39n2eSHuT1slG9wlA+oeVC8acJJSXdk34I/vjDGQuRr0w7vugwOTAH LR+z7c4qQLlEqgowh2nbuQVVVckPQHjtiEWDSMLIC1Us72ZZvGEzBnXdFZKn/UfKdpjq fGCmRCGAirWwH4VYOLYR2fY9NJMW8hY027j34U28mfiGr5VmUwaJeF/R2gfnPV0Ao8K4 4aWHx9iVUlbzCOQhkTKJkG6njISvzgrv9W8dkRUPTzlImCKCmruhHNGW6bSH8fFwXUCy d+VFGfA2/uqyPG8R4I1rPQpolJu/OvJu/zXOFzWhC4XrcEMZ3W2pZyof9KAtkfuC6AOd G3mA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=vjQpv43RsbyZPpH2EK5mjEDZoLFEPdnIRs0RsD7dBMo=; fh=j/FmaOQ0YI0rO8gBUcLVHT83uXDkJFiJKj3KqlKMbkk=; b=jSJBtlklXUyEz4yNw1F+d1urIgQVahOb2jWEC11LQSKcIXVGcX34wfr6c77dto7w7n QeEajwBQs5cobibJAnnkcazfQoapNTM6yWBhiu2b6A7b1YQGY8wNIAP1ScUDx4tUG3Af a6njap7AUb1Z7siowhc/18Ih26bnFR00Qj7nXXskwIItNto6o023mk1NJ9BdRbNrKLfi W03u/7YLMjFnNu6HMzh9G8aYEr+YWQiDwv7EqRMk51pv4bXW7x6TamdLEVJ+N4uOACzz Z+Q+qLXhVc2kp1AxiJa85IQrGZ28jkcQDgQCQ2eNjq+Mxur/Q+sNLdl0jwUTbFmTtpMB Nd6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Iwqqg2Mz; arc=pass (i=1 spf=pass spfdomain=rasmusvillemoes.dk dkim=pass dkdomain=rasmusvillemoes.dk); spf=pass (google.com: domain of linux-kernel+bounces-108805-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108805-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f35-20020a635563000000b005d7a13d0be6si11803055pgm.232.2024.03.20.03.53.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 03:53:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108805-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=Iwqqg2Mz; arc=pass (i=1 spf=pass spfdomain=rasmusvillemoes.dk dkim=pass dkdomain=rasmusvillemoes.dk); spf=pass (google.com: domain of linux-kernel+bounces-108805-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108805-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1633EB23006 for ; Wed, 20 Mar 2024 10:49:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD75F38DE9; Wed, 20 Mar 2024 10:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b="Iwqqg2Mz" Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E143629CEB for ; Wed, 20 Mar 2024 10:49:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710931786; cv=none; b=kQvL8RiglQxuIL0Le5UFYfpCnXcCC5P+um56DW7W4Key3wCFbhDChUwfDrbrCHAQ2C/1Io/3pFnuYeluz28Fkzc0IvjnzpdWENDcc6rxOziZv4zMy/vw0WVyxNCIFTblIkksSUkXvCeHfcpC1aoQgGVfolcZ+oAnwLIdSwkEooI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710931786; c=relaxed/simple; bh=t1TrKITjPnw/EArrpDUtUW0J3HKSodUqgn3N+ztvLRg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=bWjaFVGA8pWEX1NRHqTxI1s3Rnhf8dEItNG4GfKeXBhDkAYp9wEb2kJ3ITx5oLSE8cVv3C9NIs5+m0SrdrOsIarTa6B+Psz9uTR9fox11kYpY8lx+IoKAhp/vmZpFZD11P/lRhQz7k0STR88uasVxJQ8FksphNOm2c7wSEV/h+o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk; spf=pass smtp.mailfrom=rasmusvillemoes.dk; dkim=pass (1024-bit key) header.d=rasmusvillemoes.dk header.i=@rasmusvillemoes.dk header.b=Iwqqg2Mz; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rasmusvillemoes.dk Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-56b9e5ed074so2092544a12.3 for ; Wed, 20 Mar 2024 03:49:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; t=1710931783; x=1711536583; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vjQpv43RsbyZPpH2EK5mjEDZoLFEPdnIRs0RsD7dBMo=; b=Iwqqg2Mzr/HprEUXvFiP3zjkzbBtIpoP1UqPgR31A5a/M9jA0IZdpnYp3KfFV8H9M7 dbNc26xGapqzFilH2CkA96BD4dC1yuRb18c59E5jUuPgsQdLAZ59VaLkqgC2xtCaF4fg y2er15Xkfj34SjoSH4bgh9giC3/rUxU+9wyu8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710931783; x=1711536583; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vjQpv43RsbyZPpH2EK5mjEDZoLFEPdnIRs0RsD7dBMo=; b=HU1yZ7cG1L0QbvqWdQAF5nqWwbXdxz7cFpy6PbzlPRBEULqNq98zLHeKViJN1NF/pe A69VZSVYFjOUY9YzNlMt2Y3sPZCN9jSc1mAEB7CIbvCXQaiPqDaIAAbPtS6NlOM1KOzm Yu4K6B6udrfWAvws9ybb43sUV/Y5f3gaYxrPBkNUPmxxACUNMcmEd0vnvIVy4qfgKcaT 050wNX7Z9/YUc//CGdEDVny+AFnG260oTLOguRB0w0BkZWAYQ3BrdLP2Vd8A3mQbdygQ 7hhW8d1a091YFz2Fb/5wb4E99HCzcx3nYh6s/smKvjFKruovLj851n4RnJibk6zb2UUN sz7A== X-Forwarded-Encrypted: i=1; AJvYcCXahDN7rpPaD3+9/xOvhnpu2x8iGGLx7EeTplFFc4k6fbdYk/GFBrR4hTtp8fuqQUJX0IAGctbHXeeXplC5xf6Xa/woyMrYS4vuik2E X-Gm-Message-State: AOJu0YxdtBdKClFxuzG8OgzqUvFbgQIr27Kn1xK1SOKhzq+fX1uTsu+x Hdulsrivw/mnnfsWziIEaLltFTqXLKZBXtVH25/qSMy0XN/zr2zdkebcNud1LQI= X-Received: by 2002:a05:6402:5025:b0:567:a318:ac0b with SMTP id p37-20020a056402502500b00567a318ac0bmr1552209eda.16.1710931783220; Wed, 20 Mar 2024 03:49:43 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id l8-20020aa7c308000000b0056b7ed75a46sm2738978edq.27.2024.03.20.03.49.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 03:49:42 -0700 (PDT) From: Rasmus Villemoes To: Miquel Raynal , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba Cc: Rasmus Villemoes , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] thermal: armada: simplify name sanitization Date: Wed, 20 Mar 2024 11:49:39 +0100 Message-Id: <20240320104940.65031-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.40.1.1.g1c60b9335d Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Simplify the code by using the helper we have for doing exactly this. Signed-off-by: Rasmus Villemoes --- drivers/thermal/armada_thermal.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index f783547ef964..fdcb077cfd54 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -763,7 +763,6 @@ static void armada_set_sane_name(struct platform_device *pdev, struct armada_thermal_priv *priv) { const char *name = dev_name(&pdev->dev); - char *insane_char; if (strlen(name) > THERMAL_NAME_LENGTH) { /* @@ -781,12 +780,8 @@ static void armada_set_sane_name(struct platform_device *pdev, /* Save the name locally */ strscpy(priv->zone_name, name, THERMAL_NAME_LENGTH); - /* Then check there are no '-' or hwmon core will complain */ - do { - insane_char = strpbrk(priv->zone_name, "-"); - if (insane_char) - *insane_char = '_'; - } while (insane_char); + /* Then ensure there are no '-' or hwmon core will complain */ + strreplace(priv->zone_name, '-', '_'); } /* -- 2.40.1.1.g1c60b9335d