Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp977902lqa; Sun, 28 Apr 2024 12:27:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpW8c6WDdL54jcXEpg2aNfKsn3Z3w0FX2bngA9qArkDTZK77jrxMtAHG9Dy8fnOyal/6fqef2uRWlVMI9QJFXDzj3v/RTwB/XloKLImA== X-Google-Smtp-Source: AGHT+IGr0ENPofAoGUVx7tYPUhISyn3QVuVuV8lJg87IzDc6JmxT8gdNba6cZILQ34DkYSEj+87t X-Received: by 2002:a05:690c:6aca:b0:61b:1e81:4eb8 with SMTP id ij10-20020a05690c6aca00b0061b1e814eb8mr9294459ywb.9.1714332423161; Sun, 28 Apr 2024 12:27:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714332423; cv=pass; d=google.com; s=arc-20160816; b=DzBlXEPq6cBwopxeCatvTeAZVF69YgXSRFiBrErtqnq1D5LZDTi98PE9h8iGcxCuYp LyPZawHClV75auh89a0LC6CcndFpJG4No9vmZqC4V9neFg6dQDrtkbcHZG+sPKnrWpZe CesEtRCDnVPsoLyDP5ba411RI8dAw/28ZDptiV6jUeH3p7zJbXXkcMBHsS1oflPQUfMf VhNyzxGWIjJ2MGk5s+zJZxWru3nnmy+N+Yx/FJGE3yWamC0HzqJXXM1yZPL04nU1DSap Wl29XUqzkiIoX59f5YyOcxvtViU9IuvEkpuDBfeoQgpzgUkoe+CT6GBFUQkh7XuWXd9m RxHw== 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:feedback-id:message-id:subject:cc :from:to:date:dkim-signature; bh=7SeU37LkQUjBnW0vKM/OHdQSjwL1fMqh2Dr0tLsHXyE=; fh=wyr5kd+OHhec+fSqlVS0QwHY6kapvvv7KAguD+qAyuw=; b=Gpri7cxw/3zZFxIBTQE0B2D7EBQ2GAYXeL9TN/4437CRoCiMvsJJWqFz9pjZ6MXHg+ B55E53sj/UPH30NgE8CtIrOZiaDvuXM2rThBg9ihLO+/bSCQQkLdZOCANg5O6rsAkp8T DdYl/bZVps7Zk9tUYmcvTptIwOMl1VLm15eSmoYBKv32exyouQ3pC405fkPhCQp6bZ7n TMzNCMJ4fIR5vQKfecsLyJD9KyK8sLwNtjBQx4eH6NiBcjdfepfru7EYY0qYioqqvfRo RwVUTh95j9foitr49+2z+nn/zm3NHD+LkbbQ/2f+UgtAt16iYUNyc0WlhVk+GJou4ifG Hh9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bluemarch.art header.s=protonmail2 header.b=W00eijjg; arc=pass (i=1 spf=pass spfdomain=bluemarch.art dkim=pass dkdomain=bluemarch.art dmarc=pass fromdomain=bluemarch.art); spf=pass (google.com: domain of linux-kernel+bounces-161552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bluemarch.art Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w1-20020a05622a190100b00432f64c1a32si25328780qtc.644.2024.04.28.12.27.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 12:27:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161552-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=@bluemarch.art header.s=protonmail2 header.b=W00eijjg; arc=pass (i=1 spf=pass spfdomain=bluemarch.art dkim=pass dkdomain=bluemarch.art dmarc=pass fromdomain=bluemarch.art); spf=pass (google.com: domain of linux-kernel+bounces-161552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bluemarch.art 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 DCEAD1C203DB for ; Sun, 28 Apr 2024 19:27:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8DC7745C5; Sun, 28 Apr 2024 19:26:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bluemarch.art header.i=@bluemarch.art header.b="W00eijjg" Received: from mail-0301.mail-europe.com (mail-0301.mail-europe.com [188.165.51.139]) (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 9050079EA for ; Sun, 28 Apr 2024 19:26:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.165.51.139 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714332417; cv=none; b=S5lbcbTVf/Q8eZ71xMifipceeX2cRvFWLEmZmh8VBl2ViSGS9HXCih72FVsbAf8t86GksvH6UQReLf7SkN/NRh3O5mGLKqjclMfBc1VPzyqpQUfYQanSGbQQBU7LGAYCp6b+3p+qD0ZNL5f7lSQl8CdSB2+Q1h9n/vHyOuSRwkc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714332417; c=relaxed/simple; bh=7SeU37LkQUjBnW0vKM/OHdQSjwL1fMqh2Dr0tLsHXyE=; h=Date:To:From:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=G+8OYfaMoyhIUtQpGWfznb8hAep2D8P6y6Uy1vA0eU/QzRbcbslyTgXj1zGyKj7JxVdoixg4L+9p1iGf2qNbqdIeysTYt5XSNcZwSvs2LrSzDHI+GTpw+CWAG7hzQxR9Ii8aS5r8iFIeRo6lRv1vYOb/4hkA1xayqdPJPFagcs4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bluemarch.art; spf=pass smtp.mailfrom=bluemarch.art; dkim=pass (2048-bit key) header.d=bluemarch.art header.i=@bluemarch.art header.b=W00eijjg; arc=none smtp.client-ip=188.165.51.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bluemarch.art Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bluemarch.art DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bluemarch.art; s=protonmail2; t=1714332400; x=1714591600; bh=7SeU37LkQUjBnW0vKM/OHdQSjwL1fMqh2Dr0tLsHXyE=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=W00eijjgfJQAt30WGglrJnav/ZykdRkD2O3Uy34DsavAvLMSnYqhVnDjMcvHex67U hihmxA85t8dwNUIpJHX/+/LoHBOtmtvtAxMRN6hylxYGy/FYtTDpkPcvJx1+CV5jiU ifIbYNC0eyFewVrB7THZNOH5QW4uwAgslcK2orVPnLYUEpgoyp6aLu5kmK6rzh4Flw hfoQFYNnv0cVZg6WyQM+28i2DteWtQKJhASRU1stQPdfkNBs86nbdBE7V/lceHBKmP di6hSovs+8YKAQ+TmAzOcZL5ieeG7TCjM7f68ZDDOFp2ncYS/JCVd0rR6Sfmjxcvvs RNkngUjEKoChw== Date: Sun, 28 Apr 2024 19:26:33 +0000 To: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, jwoithe@just42.net, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com From: Szilard Fabian Cc: Szilard Fabian Subject: [PATCH] platform/x86/fujitsu-laptop: Replace sprintf() with sysfs_emit() Message-ID: <20240428192548.113261-1-szfabian@bluemarch.art> Feedback-ID: 87830438:user:proton X-Pm-Message-ID: 91986108e2b793fc817e8c7a9acf033c4c9c77e6 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: quoted-printable As suggested by Documentation/filesystems/sysfs.rst sysfs_emit() should be used when formatting the value to be returned to user space. Signed-off-by: Szilard Fabian --- drivers/platform/x86/fujitsu-laptop.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/f= ujitsu-laptop.c index 94480af49467..968fc91bd5e4 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -386,11 +386,11 @@ static ssize_t lid_show(struct device *dev, struct de= vice_attribute *attr, =09struct fujitsu_laptop *priv =3D dev_get_drvdata(dev); =20 =09if (!(priv->flags_supported & FLAG_LID)) -=09=09return sprintf(buf, "unknown\n"); +=09=09return sysfs_emit(buf, "unknown\n"); =09if (priv->flags_state & FLAG_LID) -=09=09return sprintf(buf, "open\n"); +=09=09return sysfs_emit(buf, "open\n"); =09else -=09=09return sprintf(buf, "closed\n"); +=09=09return sysfs_emit(buf, "closed\n"); } =20 static ssize_t dock_show(struct device *dev, struct device_attribute *attr= , @@ -399,11 +399,11 @@ static ssize_t dock_show(struct device *dev, struct d= evice_attribute *attr, =09struct fujitsu_laptop *priv =3D dev_get_drvdata(dev); =20 =09if (!(priv->flags_supported & FLAG_DOCK)) -=09=09return sprintf(buf, "unknown\n"); +=09=09return sysfs_emit(buf, "unknown\n"); =09if (priv->flags_state & FLAG_DOCK) -=09=09return sprintf(buf, "docked\n"); +=09=09return sysfs_emit(buf, "docked\n"); =09else -=09=09return sprintf(buf, "undocked\n"); +=09=09return sysfs_emit(buf, "undocked\n"); } =20 static ssize_t radios_show(struct device *dev, struct device_attribute *at= tr, @@ -412,11 +412,11 @@ static ssize_t radios_show(struct device *dev, struct= device_attribute *attr, =09struct fujitsu_laptop *priv =3D dev_get_drvdata(dev); =20 =09if (!(priv->flags_supported & FLAG_RFKILL)) -=09=09return sprintf(buf, "unknown\n"); +=09=09return sysfs_emit(buf, "unknown\n"); =09if (priv->flags_state & FLAG_RFKILL) -=09=09return sprintf(buf, "on\n"); +=09=09return sysfs_emit(buf, "on\n"); =09else -=09=09return sprintf(buf, "killed\n"); +=09=09return sysfs_emit(buf, "killed\n"); } =20 static DEVICE_ATTR_RO(lid); --=20 2.44.0