Message ID | 20240116045151.3940401-32-lizhijian@fujitsu.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-26992-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp56028dye; Mon, 15 Jan 2024 21:07:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUT7QyBEkQBx34jR3aPpz78uJbg/jz/gV6iNDGLqQdqgRWzUkc5tLuYRsgKjFtoHdiZRUN X-Received: by 2002:a05:6808:1a24:b0:3bd:43f4:bcf2 with SMTP id bk36-20020a0568081a2400b003bd43f4bcf2mr6941988oib.54.1705381655310; Mon, 15 Jan 2024 21:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705381655; cv=none; d=google.com; s=arc-20160816; b=iUwmlaKA0niyJVZDeadfjswyQ0mx/eZY4ljzQ/9Ggc33GRoNxatnzL46LZC/ivibNi Z5tDKv8g9fnCSuWcyei86gEAALN8R474s2pEYOW/sj+3yHLgyRTNKFnTxpYloUVQts/d x8HQErqWXrM61LNsInvUXoQFUQHI0QCjBe1mJgfmCo3q5sNKiGHqwY7FT5ZIkRTQttXd td1Up4XiubQyV02HeR1+UtiqojUzTE047ZeQyxNODbBWYq3Y8QQOJFkFmM7I80odh3gH C2wyesd4V4LFgh6zxwhYI/spLDsQwczOoO3PNXHGy+az/75vQLlUO7vT9BTnkjE4LV5O tiSA== ARC-Message-Signature: i=1; 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ZGsFEX+S5U7YqNVvXiaBE8MQViKyHnJpV1eleH2Yxj8=; fh=jd8sKBc+r48QoQHXTX9UooaF8UF7cfTOOGVFI3czz0k=; b=LnF/MFI7g9pEeRI4L7Ln2LN/kOy3MjsOeun9GfI46rCEQIL77jlaW72L3SHl+b0wUo KuKJTwfv9A/hObtbOaIqmTWUGqg8Qsgf4j8/hRLhN27NmeYfn+1dBZt7lPaEvitP6hXT lw5whQl0YsDvPHY5CwwQe433Ti7RrzVH/PflfO8Cj1xZXZd21UGqtNXCihmXpWybIKZn 5vDzXJmheEpBKzCh802Cl2sUi8ZGPJKa6raLmH5m/pG8w3G90var1xACIka67j6X14Ac HtZZQFrQImBoUc9ierr9QYiH4I/JgzI/QrG3v+XOaD4cBQgF1MLnv7vnzp2kXxQCcEMB xKQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26992-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26992-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i7-20020a639d07000000b005bdbd683601si10903866pgd.57.2024.01.15.21.07.34 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 21:07:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26992-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26992-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26992-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com 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 43220B22775 for <ouuuleilei@gmail.com>; Tue, 16 Jan 2024 05:03:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 428DE1E875; Tue, 16 Jan 2024 04:52:44 +0000 (UTC) Received: from esa12.hc1455-7.c3s2.iphmx.com (esa12.hc1455-7.c3s2.iphmx.com [139.138.37.100]) (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 75D591CFBC; Tue, 16 Jan 2024 04:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fujitsu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fujitsu.com X-IronPort-AV: E=McAfee;i="6600,9927,10954"; a="125556497" X-IronPort-AV: E=Sophos;i="6.04,198,1695654000"; d="scan'208";a="125556497" Received: from unknown (HELO oym-r3.gw.nic.fujitsu.com) ([210.162.30.91]) by esa12.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2024 13:52:28 +0900 Received: from oym-m2.gw.nic.fujitsu.com (oym-nat-oym-m2.gw.nic.fujitsu.com [192.168.87.59]) by oym-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id 25237D64AA; Tue, 16 Jan 2024 13:52:26 +0900 (JST) Received: from kws-ab3.gw.nic.fujitsu.com (kws-ab3.gw.nic.fujitsu.com [192.51.206.21]) by oym-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id 460BDBF3FC; Tue, 16 Jan 2024 13:52:25 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by kws-ab3.gw.nic.fujitsu.com (Postfix) with ESMTP id D3095200A7689; Tue, 16 Jan 2024 13:52:24 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 6466F1A0160; Tue, 16 Jan 2024 12:52:24 +0800 (CST) From: Li Zhijian <lizhijian@fujitsu.com> To: linux-kernel@vger.kernel.org Cc: Li Zhijian <lizhijian@fujitsu.com>, Jack Wang <jinpu.wang@cloud.ionos.com>, "James E.J. Bottomley" <jejb@linux.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com>, linux-scsi@vger.kernel.org Subject: [PATCH 34/42] drivers/scsi/pm8001: Convert snprintf to sysfs_emit Date: Tue, 16 Jan 2024 12:51:43 +0800 Message-Id: <20240116045151.3940401-32-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240116045151.3940401-1-lizhijian@fujitsu.com> References: <20240116041129.3937800-1-lizhijian@fujitsu.com> <20240116045151.3940401-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-28122.004 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-28122.004 X-TMASE-Result: 10--10.666000-10.000000 X-TMASE-MatchedRID: 6SYb29c3rTQ4ibokZ3+Q0CoiRKlBVkYIBXngI6jFvpfvd49YGReckE1N J2MN+nPkgxCMf8A0YpR5sRK06wHV4YtkWgmtdunMLdBFrfY9r2n0swHSFcVJ6MC5DTEMxpeQfiq 1gj2xET8vYRhsicUjm796jCH+PpSbpoPHQXywp1fOvXpg7ONnXX0tCKdnhB58I/9UW5M5dRNp7q EhmmPgy46HM5rqDwqtNBJJYdcA4cyfPD3h/iqauXlHsWGeGzKnLiZ8odpWEsdzUPiHs71J0g== X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788222274496297248 X-GMAIL-MSGID: 1788222274496297248 |
Series |
[01/42] coccinelle: device_attr_show.cocci: update description and warning message
|
|
Commit Message
Zhijian Li (Fujitsu)
Jan. 16, 2024, 4:51 a.m. UTC
Per filesystems/sysfs.rst, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. coccinelle complains that there are still a couple of functions that use snprintf(). Convert them to sysfs_emit(). > ./drivers/scsi/pm8001/pm8001_ctl.c:883:8-16: WARNING: please use sysfs_emit No functional change intended CC: Jack Wang <jinpu.wang@cloud.ionos.com> CC: "James E.J. Bottomley" <jejb@linux.ibm.com> CC: "Martin K. Petersen" <martin.petersen@oracle.com> CC: linux-scsi@vger.kernel.org Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> --- drivers/scsi/pm8001/pm8001_ctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On Tue, Jan 16, 2024 at 5:52 AM Li Zhijian <lizhijian@fujitsu.com> wrote: > > Per filesystems/sysfs.rst, show() should only use sysfs_emit() > or sysfs_emit_at() when formatting the value to be returned to user space. > > coccinelle complains that there are still a couple of functions that use > snprintf(). Convert them to sysfs_emit(). > > > ./drivers/scsi/pm8001/pm8001_ctl.c:883:8-16: WARNING: please use sysfs_emit > > No functional change intended > > CC: Jack Wang <jinpu.wang@cloud.ionos.com> > CC: "James E.J. Bottomley" <jejb@linux.ibm.com> > CC: "Martin K. Petersen" <martin.petersen@oracle.com> > CC: linux-scsi@vger.kernel.org > Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> Acked-by: Jack Wang <jinpu.wang@ionos.com> > --- > drivers/scsi/pm8001/pm8001_ctl.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c > index 5c26a13ffbd2..7b27618fd7b2 100644 > --- a/drivers/scsi/pm8001/pm8001_ctl.c > +++ b/drivers/scsi/pm8001/pm8001_ctl.c > @@ -880,9 +880,9 @@ static ssize_t pm8001_show_update_fw(struct device *cdev, > if (pm8001_ha->fw_status != FLASH_IN_PROGRESS) > pm8001_ha->fw_status = FLASH_OK; > > - return snprintf(buf, PAGE_SIZE, "status=%x %s\n", > - flash_error_table[i].err_code, > - flash_error_table[i].reason); > + return sysfs_emit(buf, "status=%x %s\n", > + flash_error_table[i].err_code, > + flash_error_table[i].reason); > } > static DEVICE_ATTR(update_fw, S_IRUGO|S_IWUSR|S_IWGRP, > pm8001_show_update_fw, pm8001_store_update_fw); > -- > 2.29.2 >
diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index 5c26a13ffbd2..7b27618fd7b2 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c @@ -880,9 +880,9 @@ static ssize_t pm8001_show_update_fw(struct device *cdev, if (pm8001_ha->fw_status != FLASH_IN_PROGRESS) pm8001_ha->fw_status = FLASH_OK; - return snprintf(buf, PAGE_SIZE, "status=%x %s\n", - flash_error_table[i].err_code, - flash_error_table[i].reason); + return sysfs_emit(buf, "status=%x %s\n", + flash_error_table[i].err_code, + flash_error_table[i].reason); } static DEVICE_ATTR(update_fw, S_IRUGO|S_IWUSR|S_IWGRP, pm8001_show_update_fw, pm8001_store_update_fw);