Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp390915lqp; Sun, 9 Jun 2024 00:27:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHFwtgDIf0mbBuSQRkbqXHnxXvg2soNHJOnom1ioFiE/E9Fnafr+0YfEzPEdNzjpp1yyI0u8geTXa2y0zKyNGCXSB2EHVvUVuz+y+2Lw== X-Google-Smtp-Source: AGHT+IH55Va54qAi7eYxv3OwJXPdFDUH8CVY8oGHbwOdaIzomCVfWYe1lWHIzL2QD6T5dQAhvp4v X-Received: by 2002:a05:622a:1887:b0:43a:664f:e1c7 with SMTP id d75a77b69052e-44041b67efdmr77256741cf.16.1717918079464; Sun, 09 Jun 2024 00:27:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717918079; cv=pass; d=google.com; s=arc-20160816; b=niGGV/NcwAWuczsCjtDrYiKCp1cCqZfXJDBa7bEaFv9C/OC9lLMgQa8efP8qiHCIMw DEEmW/PDIT1Zb2ANRnBoruQdZ9OE6M9mH8n+bjv7aKr8YgoQukFGHCHL3yTHQ8BKMeLI 11Vj6+0dIfcVaUJLIfi44sTE6GhNmDx5s7kpmv0WVKF8r6/NY5paJk+phEsetOb1teOL SpSXbcRYuBt2IjO7jqMSatt1TZ7l/tOGi5tYK5zxYgbwM7TdYc+WaATrCP3U+d2gnhNk +VDeV3Tu4cXNpkzHG8aronsb9wLbc3Xq8hUU6Frl/CDdqjF2969Q8tb5DN7Byv5kr4ZS Sodg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=zds1iR/STPDW0No3Uo15NaUmVEV4dq0DfBJEOP3/GlE=; fh=3fJWFrtiiPD+viya4NwE6ZvCPdMm1SLkJQEHzoJ8YWk=; b=S1T2ASOZsop4x6vTNEZnpuRSaze7nfvBh4LIqK1ao9N3BYlYB0ng/2gsvKo+qzwQ+u k8EpdE+QTDAFZ7IQhEb6Ytmpf6LW0+4UuHdRKWrtCowNWi6XTbz91pOXCQn2+wCXSw6e d4FZyL1yB1gqxDI9OMCJkjO40ODQPX7ZZJdy6N6qmzMucz2rD7NvbtcA5wJ34XbFRdub PL4aF3W5fP9fAi4mejdV6oi8QlYjnvnm2qTOLBm30hj6lU7EyJBUE/mBubc8WnYJhyBR b0mWUSgQJv1Nd/fTltIuYLL1soicdEGOOmKnD0S1kOwya9tAm3iV7Fngl8GZr6qXi2i8 t87Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b="o2vTTYa/"; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-207266-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44038b7ad9fsi78017731cf.715.2024.06.09.00.27.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jun 2024 00:27:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207266-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b="o2vTTYa/"; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-207266-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E93AA1C20FD2 for ; Sun, 9 Jun 2024 07:27:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA3E020DF4; Sun, 9 Jun 2024 07:27:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="o2vTTYa/" Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 230591B28D; Sun, 9 Jun 2024 07:27:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717918042; cv=none; b=DTNbFbp7knIqMLeWNtnyB9FMMIg+VJrgtiHWO8vzIHJgZLaUvEmn1eH3UOeOKaZm4ZAvK0qgNJnqHShhbW1EIfJREdafRBjCIG90Zo6E++9jbicp29CeJEDorlvhPgVWQlUf5CgoE/QrYuoJp0HOG3ELdTm/Qaz5tzmkLVa7Gso= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717918042; c=relaxed/simple; bh=n1WQcr0Jjs8K54pWJ570AATvW6C/bMm/V7v5t/VuBkM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EdxS4mcnLsVrjLEOsf/FVj6BkmhkbOpS1MUgj/sCw4xF+ca9jCySkHtvf6AbsqUxJc6xSZDQ/3Rwww2GQWuozKO7n/aSRTqiWCnTflvRGTlPwElzAjBCg+wBkyz5tyqGRc4oHXdyMvKumDlu0zqERM6OnwSyOqJRnf1dhvQddJg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=o2vTTYa/; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1717918035; bh=n1WQcr0Jjs8K54pWJ570AATvW6C/bMm/V7v5t/VuBkM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=o2vTTYa/52GfwDIH50bo5k56LhILhUQZSaJcau3u0IwZMqnCNwzTQFQILPKMokNS0 tz0ZOWTYzz3V5w2t4Pv7yxOIoJFmQOpZLjflPgserUW3sGgA2vNXCPBqnvU9tvBrsL aMvH+HUlkuA85AgpD0IqSPjNBJ1OAB+cvUn7wY7o= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 09 Jun 2024 09:27:15 +0200 Subject: [PATCH 4/5] ACPI: battery: use sysfs_emit over sprintf Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240609-acpi-battery-cleanup-v1-4-344517bdca73@weissschuh.net> References: <20240609-acpi-battery-cleanup-v1-0-344517bdca73@weissschuh.net> In-Reply-To: <20240609-acpi-battery-cleanup-v1-0-344517bdca73@weissschuh.net> To: "Rafael J. Wysocki" , Len Brown Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717918035; l=770; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=n1WQcr0Jjs8K54pWJ570AATvW6C/bMm/V7v5t/VuBkM=; b=X2WU9aZZtK2pcr/wgLdCSvmY+kM+VWNyNxvaxbW1JmfNI+WIBFdfdTXNF6HALMSrEv2Oqft3J SGIrh7Z6uVKCoHHhTQPP92w45mr+gvZFXv2ewccYpeN04fbA0iyPHOh X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= sysfs_emit validates assumptions made by sysfs and is the correct mechanism to format data for sysfs. Signed-off-by: Thomas Weißschuh --- drivers/acpi/battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 984236b95dff..5f47bd58aff3 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -661,7 +661,7 @@ static ssize_t acpi_battery_alarm_show(struct device *dev, { struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev)); - return sprintf(buf, "%d\n", battery->alarm * 1000); + return sysfs_emit(buf, "%d\n", battery->alarm * 1000); } static ssize_t acpi_battery_alarm_store(struct device *dev, -- 2.45.2