Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4369117rwl; Wed, 28 Dec 2022 03:12:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXtWIMdjRp/5SbozSwAsu9bv7qY9mWK6XFu5aXrOclVOoVZvl5RrCEadHVgcg6lYAPmJ8WeO X-Received: by 2002:a17:902:b70a:b0:192:96ed:6462 with SMTP id d10-20020a170902b70a00b0019296ed6462mr1010525pls.52.1672225931741; Wed, 28 Dec 2022 03:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672225931; cv=none; d=google.com; s=arc-20160816; b=UWS984r9GEwGlAHEygp9wLfaw3FmNdxe2KlJ3B7Yi6rT+ZR6mhsXuIDWnpx5hxiJIg u7g+aWtog6O4ri6s3+6uI9w1jIMHLhhLjNmsfEa3Wf/0j7DFj/BFMSddRviWMjpM9NXG gIoYje06/KAeuK5UNjn/oLHN/PLN972iIxKHx6CVMyS/7/1JL+zYSoie4tGeOgFXUdr4 oNppxkR5iPTRNVJwImHU7k+0/zmT5oItSKxjUPBJVxOTbxaF/OfFFDSvcyZq/GagQwDl ldzn/zTV4DPbjeD+j4hQ8tKh1h3movIB99Az8TjnV1fe7sLmg1f0ZxwN2NCb3qieVxJ8 9oag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=K8bHwouibOz9SbW/sJx0l3wtuIaz7e5GK4yX2yMg8c8=; b=YUDgnaoT6a2VFRdPRcY6HReNYmWtPZh87zXXFOEaYrLIVh8t896XiR3jicn8R5dj1R Z2wNOgEASoYZvD9qmtO5BJyO/X/Lv3YXPq1rjTq1Vn7SELtlFLEqRQFCcTeIr6m21Rvg eHYdRfHQqRzMCshyMuvldq4//ZR+zq33Vte+BySliXCcsQdhjmsALXCRzfojqg00U098 r+Wu1+w1j3Hf4V73FJrVnAvQbnp7ZNaFWpC5mtsFd/jly8huG4N3BFtzXH42Fc4RpPnJ TTekblQ2gu52j5GHJ8r4I8EFzjlSe/BhS3TCBg2BEGCOGt4VcMgKrPPN4wAiOrHBIhGc XPIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=iPsbC208; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a170902758400b00186dcc37df6si11572042pll.616.2022.12.28.03.12.02; Wed, 28 Dec 2022 03:12:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=iPsbC208; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232733AbiL1KQV (ORCPT + 64 others); Wed, 28 Dec 2022 05:16:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbiL1KQT (ORCPT ); Wed, 28 Dec 2022 05:16:19 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA6DE120; Wed, 28 Dec 2022 02:16:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1672222569; bh=KE0lBfKTFaOiQJ09ag9/+CSPiwxMIgnNmASY7Qrk4F4=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=iPsbC20881d4itO252qjVjpMQWdUQrjWkz6ew4/WU5+pMTcpeASyqNFLNCeyQvKet KpeB093ZLxcZwcxAqAtFAEdyY656nPSYwGN6PFtH7Pr5Bhddbhij197aI/0AgruyKk LkOYwadEwLQZoXSDbohs4ei3JcuaL0R3PaIt4m5c= Received: by b-6.in.mailobj.net [192.168.90.16] with ESMTP via ip-206.mailobj.net [213.182.55.206] Wed, 28 Dec 2022 11:16:09 +0100 (CET) X-EA-Auth: EUYTIluwwGcxYCcnMCEx5HMuTzuulED8BsHgOtBH4xIEJJ79HyPbrh049Hxn/9dtntSlTSv9lWzIvXBMQSUYgRBjVYYykkn6 Date: Wed, 28 Dec 2022 15:45:59 +0530 From: Deepak R Varma To: Nilesh Javali , Manish Rangankar , GR-QLogic-Storage-Upstream@marvell.com, "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: Re: [PATCH] scsi: qla4xxx: Use sysfs_emit in show function callsbacks Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 20, 2022 at 02:23:06AM +0530, Deepak R Varma wrote: > On Sat, Dec 10, 2022 at 02:10:24PM +0530, Deepak R Varma wrote: > > According to Documentation/filesystems/sysfs.rst, the show() callback > > function of kobject attributes should strictly use sysfs_emit instead > > of sprintf family functions. > > Issue identified using the coccinelle device_attr_show.cocci script. > > > > Signed-off-by: Deepak R Varma > > Hello, > May I please request a review and feedback on this patch? Hello, Requesting a review and feedback on this patch proposal please. Thank you, ./drv > > Thank you, > ./drv > > > --- > > drivers/scsi/qla4xxx/ql4_attr.c | 32 ++++++++++++++++---------------- > > 1 file changed, 16 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/scsi/qla4xxx/ql4_attr.c b/drivers/scsi/qla4xxx/ql4_attr.c > > index abfa6ef60480..773b8dbe1121 100644 > > --- a/drivers/scsi/qla4xxx/ql4_attr.c > > +++ b/drivers/scsi/qla4xxx/ql4_attr.c > > @@ -156,11 +156,11 @@ qla4xxx_fw_version_show(struct device *dev, > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > > > if (is_qla80XX(ha)) > > - return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n", > > + return sysfs_emit(buf, "%d.%02d.%02d (%x)\n", > > ha->fw_info.fw_major, ha->fw_info.fw_minor, > > ha->fw_info.fw_patch, ha->fw_info.fw_build); > > else > > - return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n", > > + return sysfs_emit(buf, "%d.%02d.%02d.%02d\n", > > ha->fw_info.fw_major, ha->fw_info.fw_minor, > > ha->fw_info.fw_patch, ha->fw_info.fw_build); > > } > > @@ -170,7 +170,7 @@ qla4xxx_serial_num_show(struct device *dev, struct device_attribute *attr, > > char *buf) > > { > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > - return snprintf(buf, PAGE_SIZE, "%s\n", ha->serial_number); > > + return sysfs_emit(buf, "%s\n", ha->serial_number); > > } > > > > static ssize_t > > @@ -178,7 +178,7 @@ qla4xxx_iscsi_version_show(struct device *dev, struct device_attribute *attr, > > char *buf) > > { > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > - return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fw_info.iscsi_major, > > + return sysfs_emit(buf, "%d.%02d\n", ha->fw_info.iscsi_major, > > ha->fw_info.iscsi_minor); > > } > > > > @@ -187,7 +187,7 @@ qla4xxx_optrom_version_show(struct device *dev, struct device_attribute *attr, > > char *buf) > > { > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > - return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n", > > + return sysfs_emit(buf, "%d.%02d.%02d.%02d\n", > > ha->fw_info.bootload_major, ha->fw_info.bootload_minor, > > ha->fw_info.bootload_patch, ha->fw_info.bootload_build); > > } > > @@ -197,7 +197,7 @@ qla4xxx_board_id_show(struct device *dev, struct device_attribute *attr, > > char *buf) > > { > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > - return snprintf(buf, PAGE_SIZE, "0x%08X\n", ha->board_id); > > + return sysfs_emit(buf, "0x%08X\n", ha->board_id); > > } > > > > static ssize_t > > @@ -207,7 +207,7 @@ qla4xxx_fw_state_show(struct device *dev, struct device_attribute *attr, > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > > > qla4xxx_get_firmware_state(ha); > > - return snprintf(buf, PAGE_SIZE, "0x%08X%8X\n", ha->firmware_state, > > + return sysfs_emit(buf, "0x%08X%8X\n", ha->firmware_state, > > ha->addl_fw_state); > > } > > > > @@ -220,7 +220,7 @@ qla4xxx_phy_port_cnt_show(struct device *dev, struct device_attribute *attr, > > if (is_qla40XX(ha)) > > return -ENOSYS; > > > > - return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_cnt); > > + return sysfs_emit(buf, "0x%04X\n", ha->phy_port_cnt); > > } > > > > static ssize_t > > @@ -232,7 +232,7 @@ qla4xxx_phy_port_num_show(struct device *dev, struct device_attribute *attr, > > if (is_qla40XX(ha)) > > return -ENOSYS; > > > > - return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->phy_port_num); > > + return sysfs_emit(buf, "0x%04X\n", ha->phy_port_num); > > } > > > > static ssize_t > > @@ -244,7 +244,7 @@ qla4xxx_iscsi_func_cnt_show(struct device *dev, struct device_attribute *attr, > > if (is_qla40XX(ha)) > > return -ENOSYS; > > > > - return snprintf(buf, PAGE_SIZE, "0x%04X\n", ha->iscsi_pci_func_cnt); > > + return sysfs_emit(buf, "0x%04X\n", ha->iscsi_pci_func_cnt); > > } > > > > static ssize_t > > @@ -253,7 +253,7 @@ qla4xxx_hba_model_show(struct device *dev, struct device_attribute *attr, > > { > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > > > - return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_name); > > + return sysfs_emit(buf, "%s\n", ha->model_name); > > } > > > > static ssize_t > > @@ -261,7 +261,7 @@ qla4xxx_fw_timestamp_show(struct device *dev, struct device_attribute *attr, > > char *buf) > > { > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > - return snprintf(buf, PAGE_SIZE, "%s %s\n", ha->fw_info.fw_build_date, > > + return sysfs_emit(buf, "%s %s\n", ha->fw_info.fw_build_date, > > ha->fw_info.fw_build_time); > > } > > > > @@ -270,7 +270,7 @@ qla4xxx_fw_build_user_show(struct device *dev, struct device_attribute *attr, > > char *buf) > > { > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > - return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.fw_build_user); > > + return sysfs_emit(buf, "%s\n", ha->fw_info.fw_build_user); > > } > > > > static ssize_t > > @@ -278,7 +278,7 @@ qla4xxx_fw_ext_timestamp_show(struct device *dev, struct device_attribute *attr, > > char *buf) > > { > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > - return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.extended_timestamp); > > + return sysfs_emit(buf, "%s\n", ha->fw_info.extended_timestamp); > > } > > > > static ssize_t > > @@ -300,7 +300,7 @@ qla4xxx_fw_load_src_show(struct device *dev, struct device_attribute *attr, > > break; > > } > > > > - return snprintf(buf, PAGE_SIZE, "%s\n", load_src); > > + return sysfs_emit(buf, "%s\n", load_src); > > } > > > > static ssize_t > > @@ -309,7 +309,7 @@ qla4xxx_fw_uptime_show(struct device *dev, struct device_attribute *attr, > > { > > struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev)); > > qla4xxx_about_firmware(ha); > > - return snprintf(buf, PAGE_SIZE, "%u.%u secs\n", ha->fw_uptime_secs, > > + return sysfs_emit(buf, "%u.%u secs\n", ha->fw_uptime_secs, > > ha->fw_uptime_msecs); > > } > > > > -- > > 2.34.1 > >