Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1080132lqa; Sun, 28 Apr 2024 18:19:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWupFakaGDwzg/irgv6ATJ332Z54eiKpGdKswaq1V4O0HqYwPwoRHjwMfRYaDUipZo7cEia7YTyMjlROf+w1fk4PmvuQBHbnxpjmMr/Q== X-Google-Smtp-Source: AGHT+IHC8e7uge1wUPNl+qyB6BDoUJ2Z3XXsB9xBP/px7DFqiIG3IZHRCppM0mPkJXGQUr4+Nw9Z X-Received: by 2002:a17:902:e806:b0:1e2:81c1:b35e with SMTP id u6-20020a170902e80600b001e281c1b35emr12127194plg.54.1714353555401; Sun, 28 Apr 2024 18:19:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714353555; cv=pass; d=google.com; s=arc-20160816; b=BOn8f0e0kevWtkKnDWjyELhbmW7B+z3e47d5PM/WY5kiRyUbpcj9RKISoSPJr/VSlF CLjodZDSWpwgbO5QxFCyy7fmhM/pH7y/cS4cczlKgzU8eCubyUr0uffOpepiuKeUfnTP 8P3b3vChp3lCDNylDVD5INlGeAQIIJJky82Ui/w+RCOiXObd1wy4ykPZkoN8XwGAV0RT RFlO/qcE+3JHUHx4CWW3Zv9HTT2EorCGR5M6pxlwwOlSYq9zbcZV+LjzNpZ+HNQWK365 h4HQCu34adBzqWKhqRnfUiPrRtWL7sbtL7oGneFhDlFrh8eXZBGerJf9PmyT80g9sNSk CZ6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=t1IxUSVj34/cVgHLqyoD9CJBzbEofaDRtDV584u06jY=; fh=JGRrJhu11w4vUanznfCoKUw0OTMDMtaYE9boz13bSHU=; b=R6m8DScowenpF9EpxCVF1FyEzQpImF6DNxx1z08uH7YEEc8mJRdKsyz5nPuhXuoHQz lsU/opqS1lhoucQbYmEJmottqOk/PbqMHYIxWwwRFZTfWLPiw9Jj3qalV/JzGS1e8vs8 jtOx2ll85ITXP19vbJlOYq1hd/m2q/fQMpfEKankFjU//dPscAra9pr5Ye4ZtqVI501o AzrzuBjB4XuWbKMHIYRRmBUNM5mgtaSu7Oe28ckZcnIFuA2ubx7JZ5x/ftP36ZxFZuxn JdmIOG/dY8UIjcQdi29AMOyUKh2t5FhYEV59FnkXqMtxg6nYq9yKFB1maRjVY+SFtxTr Mk/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=just42.net); spf=pass (google.com: domain of linux-kernel+bounces-161664-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161664-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n13-20020a170902e54d00b001e5075f1344si19937151plf.579.2024.04.28.18.19.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Apr 2024 18:19:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161664-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=just42.net); spf=pass (google.com: domain of linux-kernel+bounces-161664-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161664-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F10D62821EC for ; Mon, 29 Apr 2024 01:19:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D74A7F9; Mon, 29 Apr 2024 01:19:09 +0000 (UTC) Received: from server.atrad.com.au (server.atrad.com.au [150.101.241.2]) (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 6BDD57F; Mon, 29 Apr 2024 01:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.101.241.2 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714353548; cv=none; b=t2AUDE1KW4aZIX3py7FTrowlnCG6Fa20PZ7dh4dA5efjyn8vTAI3pjI5U9uQS7bX3BJ9QJR3SrR+x+ZTEIEOmkRMf8LW5eYwwMkp+2FpmSilQqbUeKNWGcYGdDqwJ8Pem4GtrG3pMBmqWNQBphcy9S3OOKQn6k6gJrLr1Hk2GqU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714353548; c=relaxed/simple; bh=CKS3du/7e+GPCqzNT8eSGOvRiJ/GyU/R+Cz7M5rCuiE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y8CZujzCRQKEV+Pbi+PR3ZUc5vyxrB5ykttw/yIIzkmUUYKkcZzd0LM2SQ1mB6UV1JHg6fdpRSrNS3DFA5TR5b2jbIbTUqDnZf0UlgZK3/5a0FK0GhukW+8N2Y3pkJAmQP3f/ztqlZfi1netBduOW8quFhJ/3qdD2wIen5tadEA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=just42.net; spf=pass smtp.mailfrom=just42.net; arc=none smtp.client-ip=150.101.241.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=just42.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=just42.net Received: from marvin.atrad.com.au (marvin.atrad.com.au [192.168.0.2]) by server.atrad.com.au (8.18.1/8.18.1) with ESMTPS id 43T102D7008874 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 29 Apr 2024 10:30:03 +0930 Date: Mon, 29 Apr 2024 10:30:02 +0930 From: Jonathan Woithe To: Szilard Fabian Cc: linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com Subject: Re: [PATCH] platform/x86/fujitsu-laptop: Replace sprintf() with sysfs_emit() Message-ID: References: <20240428192548.113261-1-szfabian@bluemarch.art> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240428192548.113261-1-szfabian@bluemarch.art> X-MIMEDefang-action: accept X-Scanned-By: MIMEDefang 2.86 on 192.168.0.1 On Sun, Apr 28, 2024 at 07:26:33PM +0000, Szilard Fabian wrote: > 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 This seems entirely reasonable. Acked-by: Jonathan Woithe > --- > 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/fujitsu-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 device_attribute *attr, > struct fujitsu_laptop *priv = dev_get_drvdata(dev); > > if (!(priv->flags_supported & FLAG_LID)) > - return sprintf(buf, "unknown\n"); > + return sysfs_emit(buf, "unknown\n"); > if (priv->flags_state & FLAG_LID) > - return sprintf(buf, "open\n"); > + return sysfs_emit(buf, "open\n"); > else > - return sprintf(buf, "closed\n"); > + return sysfs_emit(buf, "closed\n"); > } > > 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 device_attribute *attr, > struct fujitsu_laptop *priv = dev_get_drvdata(dev); > > if (!(priv->flags_supported & FLAG_DOCK)) > - return sprintf(buf, "unknown\n"); > + return sysfs_emit(buf, "unknown\n"); > if (priv->flags_state & FLAG_DOCK) > - return sprintf(buf, "docked\n"); > + return sysfs_emit(buf, "docked\n"); > else > - return sprintf(buf, "undocked\n"); > + return sysfs_emit(buf, "undocked\n"); > } > > static ssize_t radios_show(struct device *dev, struct device_attribute *attr, > @@ -412,11 +412,11 @@ static ssize_t radios_show(struct device *dev, struct device_attribute *attr, > struct fujitsu_laptop *priv = dev_get_drvdata(dev); > > if (!(priv->flags_supported & FLAG_RFKILL)) > - return sprintf(buf, "unknown\n"); > + return sysfs_emit(buf, "unknown\n"); > if (priv->flags_state & FLAG_RFKILL) > - return sprintf(buf, "on\n"); > + return sysfs_emit(buf, "on\n"); > else > - return sprintf(buf, "killed\n"); > + return sysfs_emit(buf, "killed\n"); > } > > static DEVICE_ATTR_RO(lid); > -- > 2.44.0 > >