Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3118486rwj; Mon, 19 Dec 2022 13:22:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf5sLb3hwN3GWUShHAD6NEykMYChWDXkEITmfv5+bpzTiUZsJNbgwU3vAzNwYDCDdDBj8RzT X-Received: by 2002:a17:906:af6a:b0:7c1:12ef:bf52 with SMTP id os10-20020a170906af6a00b007c112efbf52mr34742244ejb.3.1671484958922; Mon, 19 Dec 2022 13:22:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671484958; cv=none; d=google.com; s=arc-20160816; b=kuITBxO3DHoep5O4h0iv8OdBYvJokdolMfQcoXnoBrQpuJtgDhOj+b25CvoMFs1V7g 56RcleZOgCv4aZ+zbXXNgtsAWrpcy2FWdZcskUGu05bJDD1fJjsvKbs6Vk/5OUNecxYv Ly5+0pVEu9AH427aDzme8C0zZ7JiFagT1tIBZrGW8Wbktw82s1zO4XwelUQId5c2xQSO PvzP+Hl2IWQwliqQ5OO8POq97LgWjCJpjOwUIMXBRBUggzLwgzxEzERYdHhUPkq60rAH 3Rgm7FxKPNgbUIiD/JODTAatQBJrpIvpCNoTuN6YCcR3xg2CdIqIlMoUN/pZVqN/djz4 qZkQ== 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=nHSot7mgDCc2TNWgPn9hj1kH0X6KVDzlzmmbFRiVvBU=; b=aEcHo72rh5m1v0PHejbw0H8m5G+WNZrMgnZdqgBsL1QkBMZRxQH82c7cG9IPDdNY9X ClrX1FIEMOLp5z8qa+F9umXmj95FvqcPB5QeZaReGpSu6MDH3Q1zLWMrDjBUzedvJQmY 5fD9YD9ggGizbsjQBdyP90btzrVoeXCoCmkHSR1ZxIt+76tLgoxLx3A+r8LOrdu5cQPe ru77dPAPvflowP9jRrUpvYyNAkEoyTvMFVgcHVZKvLkRRh3gAQgzTMAhWfT2ZQiKJX5U HD8crWQqaNA8l92402xziILGDbTvV3MCWR6+9bauRpDJurt9eV9JtOWOVdzLcssdYZlm 8T+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=HoSm133n; 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 o20-20020a17090611d400b007c0fa2e0fa1si8027648eja.888.2022.12.19.13.22.21; Mon, 19 Dec 2022 13:22:38 -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=HoSm133n; 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 S231860AbiLSUx0 (ORCPT + 71 others); Mon, 19 Dec 2022 15:53:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232559AbiLSUxW (ORCPT ); Mon, 19 Dec 2022 15:53:22 -0500 Received: from msg-2.mailo.com (msg-2.mailo.com [213.182.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC5AF95BB; Mon, 19 Dec 2022 12:53:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1671483190; bh=p/gQJhr994QueR5DCQ02g1AeDDewrUyc8tKh6QiFUkY=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=HoSm133nBavBRfcicEpLqQ+jRK961tUApRYIQ8pDgIxxofMXWkygWczd/fJE6+/ic Ddxwd4DaigF7a2OKLqu8uG3DH1G4Ie1WgT5+hTRRZLvzsvoSRcSmrP8ha5J5lGQ0Fz Zro/l0IX/xXdS5Dw+4yxv7SB4K3Yr3LxK9N9dP/M= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Mon, 19 Dec 2022 21:53:10 +0100 (CET) X-EA-Auth: +h2tLTIwcg0ajAKuBXmzbKsnCnk2zDEhM6dJi882wT8DN3KzYR/3+5BACGCSRR5Q+YR5WyE8C8ku02eMcjcEXmrxEU07Owm8 Date: Tue, 20 Dec 2022 02:23:06 +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 , drv@mailo.com 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 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? 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 >