From patchwork Fri Oct 22 09:02:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: CGEL X-Patchwork-Id: 1545541 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=E1G3WDLt; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hd3PZ17DFz9sf8 for ; Mon, 25 Oct 2021 16:27:46 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Hd3PZ0JPqz2yJ5 for ; Mon, 25 Oct 2021 16:27:46 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=E1G3WDLt; dkim-atps=neutral X-Original-To: linux-fsi@lists.ozlabs.org Delivered-To: linux-fsi@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::52f; helo=mail-pg1-x52f.google.com; envelope-from=cgel.zte@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=E1G3WDLt; dkim-atps=neutral Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HbJKJ1qNWz2y7V for ; Fri, 22 Oct 2021 20:02:58 +1100 (AEDT) Received: by mail-pg1-x52f.google.com with SMTP id e65so2736297pgc.5 for ; Fri, 22 Oct 2021 02:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=msbDcleCepniN71Jbfw+vut9V5dOaKH1ffaAk/GfhN8=; b=E1G3WDLtdrx5dbmY+vSfucTmKfMrg5MxQhvbBTKQ6bM4w6mkqg0PG+tuPvVjmK1bKV c8XblbLaxCRPdVrGzbnR7lgfNQouMTaCBnht++H7vUh8oCisE6tkA1xjXbiGCGcGxx65 U9td/htxkQDL6Jn7j1cfMKmJcnjzANmZGmsT6WrQ3xlnU9xS2GqUdVSlIBkmmUAHyZIY QSN/tao3ubRqw8A/nbrwpVY80zEyryVq5hLuDDEx5FqKihnw69TxFWbkAi1blAe3IrSd wmc8BY2ahPOkzBIYQahhbzp4RkEDYnCQQc8gq9NTVuzMfSwsqweV5NGiHKni4YuXovi8 i8gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=msbDcleCepniN71Jbfw+vut9V5dOaKH1ffaAk/GfhN8=; b=B4AZF1l1yUj85Hb9tBU2UetoU5AWX5VNM2amCev6REF7I5lvkVjzYz6DV3IFo4EoPa k1gNVxKYY3vBVFimpcuZTIDisrfm9z9p53LYmQlcU2YrmzmJJpE5t0Ti36kSyFce1ane v5MyDU1EyVoDIUH+n/IHRRtuogNh/Wwh4XVgZS3rAVbR7/XNj8HlBbNMfo+DsyLUF9NB X8w4vds98DUXm7c1c17xmwQMZYRDjb15eL3ebK4Mg7qFNUDHezQPbinir+vi3umbTXF4 qtavbfq+vFe+59XSS5xola8xyXihbHQKOknvj4uu6H1xcEClU3lpGDJO6ct+1n7yqOsK qVzA== X-Gm-Message-State: AOAM532w7pK0NhCVvmqfvLQEma9WMFN9UPMxzij6seggXtZIN5zJoZ/D x1gcW6iDfWIJP38Xpwf8WJI= X-Google-Smtp-Source: ABdhPJyUZiwUpwKIodA4Cnad8fN4HiPuttYHQzbicyC6mZFiSw9GIk4Sd+qUfVqsuOYQKnZ1xDyRsQ== X-Received: by 2002:a63:2a88:: with SMTP id q130mr6099149pgq.169.1634893375500; Fri, 22 Oct 2021 02:02:55 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id e9sm9843411pfv.189.2021.10.22.02.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 02:02:54 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: ye.guojin@zte.com.cn To: joe@perches.com Subject: [PATCH v2] fsi: master: replace snprintf in show functions with sysfs_emit Date: Fri, 22 Oct 2021 09:02:48 +0000 Message-Id: <20211022090248.1065217-1-ye.guojin@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 25 Oct 2021 16:27:43 +1100 X-BeenThere: linux-fsi@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair@popple.id.au, zealci@zte.com.cn, linux-kernel@vger.kernel.org, cgel.zte@gmail.com, ye.guojin@zte.com.cn, linux-fsi@lists.ozlabs.org Errors-To: linux-fsi-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "linux-fsi" From: Ye Guojin coccicheck complains about the use of snprintf() in sysfs show functions: WARNING use scnprintf or sprintf Use sysfs_emit instead of scnprintf or sprintf makes more sense. Reported-by: Zeal Robot Signed-off-by: Ye Guojin --- Changes since v1: - remove unnecessary ?: since external_mode is already bool. drivers/fsi/fsi-master-ast-cf.c | 3 +-- drivers/fsi/fsi-master-gpio.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fsi/fsi-master-ast-cf.c b/drivers/fsi/fsi-master-ast-cf.c index 24292acdbaf8..7f3303854e23 100644 --- a/drivers/fsi/fsi-master-ast-cf.c +++ b/drivers/fsi/fsi-master-ast-cf.c @@ -1083,8 +1083,7 @@ static ssize_t external_mode_show(struct device *dev, { struct fsi_master_acf *master = dev_get_drvdata(dev); - return snprintf(buf, PAGE_SIZE - 1, "%u\n", - master->external_mode ? 1 : 0); + return sysfs_emit(buf, "%u\n", master->external_mode); } static ssize_t external_mode_store(struct device *dev, diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c index 7d5f29b4b595..b8538a851675 100644 --- a/drivers/fsi/fsi-master-gpio.c +++ b/drivers/fsi/fsi-master-gpio.c @@ -718,8 +718,7 @@ static ssize_t external_mode_show(struct device *dev, { struct fsi_master_gpio *master = dev_get_drvdata(dev); - return snprintf(buf, PAGE_SIZE - 1, "%u\n", - master->external_mode ? 1 : 0); + return sysfs_emit(buf, "%u\n", master->external_mode); } static ssize_t external_mode_store(struct device *dev,