From patchwork Sun Dec 25 08:44:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 36461 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp448375wrt; Sun, 25 Dec 2022 00:52:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXurCFsDwZug0XFvvmUL5uVqPm8jk5sJxk2sAtOBFBx/zPC01GspMGgSmwckEKn4mvGZ8zUD X-Received: by 2002:a05:6a00:410b:b0:57a:9482:843b with SMTP id bu11-20020a056a00410b00b0057a9482843bmr17715114pfb.5.1671958370552; Sun, 25 Dec 2022 00:52:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671958370; cv=none; d=google.com; s=arc-20160816; b=dfFf7wENG8nTN2uRA1rb8ETuTQDwrYnDxmXpPW3xSOQ8g5wA96vMO8ps/MyqfIgAZ8 dgZisEQptQxxr2+feXh/z/ZAxpatOgjP7PHrDEHgSfENhPLZJyAZYdfz0mKDHaIB11EG jHbFX6Irw/Gw4/2OgbQ8n+KNMycj2y1vDyoSG/1+Z8TaKw+fhe3FEMpN68ieSZ4e7vdH 4I6jqkKOmBWYYkTS15BCvatASn2y/IRKUCAXRRUH95onqx8CK5q2XVJcDzwZrl9+H9OI dWqNZGCHU3xRGZC8q00ifVc6POR8PhyyUMH6Mtv8TaGnXFUZe+yVRZroSvNj7wSvXpsp rhbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=x59mv799Que+ZWKhqgHax9Ms/ULyxF1ENNoPjX3FzuY=; b=N+sw1cP7PVPjDBiVnEgYWgI/LEd5qB4HV0wVraVTOu5qsxroEZsm3pJogBszRqJvaU wAsyZx/JWcNTwGuzBH8JAIWj92Mc8POS+PwTQuG4fEyT6I2vxTDZO/yB1llrsjNCIbsd 3HkAAnovKDYrIjnCFLGqsSC1WjXnzo4sjSwh9I+iiLGqxEMb98vc7ILw4ZsFuUQbVplG mJYSlgj6aUZarocK+kRON6dmiKTursRnk+vXzOhnNt+P4GkCEY954Hc4EMq51X/TZMLN ztvoBzSW2AmJj6LvsZLcNZPxrDiJKVjuGL3xXDSZdhe9B8J1EWRq3NGpglQlPEPzyLuP qMzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=PxSVgo0h; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a056a000b4900b0056e2b0193bdsi8840303pfo.141.2022.12.25.00.52.37; Sun, 25 Dec 2022 00:52:50 -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=PxSVgo0h; 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 S230372AbiLYIoP (ORCPT + 99 others); Sun, 25 Dec 2022 03:44:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbiLYIoO (ORCPT ); Sun, 25 Dec 2022 03:44:14 -0500 Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F37F7FDF; Sun, 25 Dec 2022 00:44:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1671957848; bh=AMAL+pQujTNRvofLMFa9MGgUi+tA4aWwIHE47oA9prE=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=PxSVgo0h3Xzy4ccwggXXlLG/nwyR2YVIm8kAQH/IdgXHat1GTBNGr9l3vUszgGHzX etU0my3OO/7FnLhHz2miierbRNHjd17yWwJ7BX+1keKJW8CuzkaTXKcJl5s9eSeaGQ T3b7mfu9mPvPnd0aUrquoiVwJIyA2KYMkcDKOMuw= Received: by b-3.in.mailobj.net [192.168.90.13] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sun, 25 Dec 2022 09:44:08 +0100 (CET) X-EA-Auth: vHquZMvShtGA9OOi8DYdIs5bFVmiLvpnxf7YEH5FgtlCrcHcoWP3KtKhvYtISKOSdmU+xTPk74IbmnCXAa6WRuvZ+BrfpVoQ Date: Sun, 25 Dec 2022 14:14:03 +0530 From: Deepak R Varma To: Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , Deepak R Varma Subject: [PATCH] scsi: message: fusion: Use sysfs_emit in show function callsbacks Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753175420374439010?= X-GMAIL-MSGID: =?utf-8?q?1753175420374439010?= According to Documentation/filesystems/sysfs.rst, the show() callback function of kobject attributes should strictly use sysfs_emit() instead of sprintf() family functions. So, make this change. Issue identified using the coccinelle device_attr_show.cocci script. Signed-off-by: Deepak R Varma --- drivers/message/fusion/mptscsih.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) -- 2.34.1 diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 276084ed04a6..9ccefeb11661 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -3046,7 +3046,7 @@ mptscsih_version_fw_show(struct device *dev, struct device_attribute *attr, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%02d.%02d.%02d.%02d\n", + return sysfs_emit(buf, "%02d.%02d.%02d.%02d\n", (ioc->facts.FWVersion.Word & 0xFF000000) >> 24, (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16, (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8, @@ -3062,7 +3062,7 @@ mptscsih_version_bios_show(struct device *dev, struct device_attribute *attr, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x.%02x\n", + return sysfs_emit(buf, "%02x.%02x.%02x.%02x\n", (ioc->biosVersion & 0xFF000000) >> 24, (ioc->biosVersion & 0x00FF0000) >> 16, (ioc->biosVersion & 0x0000FF00) >> 8, @@ -3078,7 +3078,7 @@ mptscsih_version_mpi_show(struct device *dev, struct device_attribute *attr, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%03x\n", ioc->facts.MsgVersion); + return sysfs_emit(buf, "%03x\n", ioc->facts.MsgVersion); } static DEVICE_ATTR(version_mpi, S_IRUGO, mptscsih_version_mpi_show, NULL); @@ -3091,7 +3091,7 @@ char *buf) MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%s\n", ioc->prod_name); + return sysfs_emit(buf, "%s\n", ioc->prod_name); } static DEVICE_ATTR(version_product, S_IRUGO, mptscsih_version_product_show, NULL); @@ -3105,7 +3105,7 @@ mptscsih_version_nvdata_persistent_show(struct device *dev, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%02xh\n", + return sysfs_emit(buf, "%02xh\n", ioc->nvdata_version_persistent); } static DEVICE_ATTR(version_nvdata_persistent, S_IRUGO, @@ -3119,7 +3119,7 @@ mptscsih_version_nvdata_default_show(struct device *dev, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%02xh\n",ioc->nvdata_version_default); + return sysfs_emit(buf, "%02xh\n", ioc->nvdata_version_default); } static DEVICE_ATTR(version_nvdata_default, S_IRUGO, mptscsih_version_nvdata_default_show, NULL); @@ -3132,7 +3132,7 @@ mptscsih_board_name_show(struct device *dev, struct device_attribute *attr, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_name); + return sysfs_emit(buf, "%s\n", ioc->board_name); } static DEVICE_ATTR(board_name, S_IRUGO, mptscsih_board_name_show, NULL); @@ -3144,7 +3144,7 @@ mptscsih_board_assembly_show(struct device *dev, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_assembly); + return sysfs_emit(buf, "%s\n", ioc->board_assembly); } static DEVICE_ATTR(board_assembly, S_IRUGO, mptscsih_board_assembly_show, NULL); @@ -3157,7 +3157,7 @@ mptscsih_board_tracer_show(struct device *dev, struct device_attribute *attr, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_tracer); + return sysfs_emit(buf, "%s\n", ioc->board_tracer); } static DEVICE_ATTR(board_tracer, S_IRUGO, mptscsih_board_tracer_show, NULL); @@ -3170,7 +3170,7 @@ mptscsih_io_delay_show(struct device *dev, struct device_attribute *attr, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->io_missing_delay); + return sysfs_emit(buf, "%02d\n", ioc->io_missing_delay); } static DEVICE_ATTR(io_delay, S_IRUGO, mptscsih_io_delay_show, NULL); @@ -3183,7 +3183,7 @@ mptscsih_device_delay_show(struct device *dev, struct device_attribute *attr, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->device_missing_delay); + return sysfs_emit(buf, "%02d\n", ioc->device_missing_delay); } static DEVICE_ATTR(device_delay, S_IRUGO, mptscsih_device_delay_show, NULL); @@ -3196,7 +3196,7 @@ mptscsih_debug_level_show(struct device *dev, struct device_attribute *attr, MPT_SCSI_HOST *hd = shost_priv(host); MPT_ADAPTER *ioc = hd->ioc; - return snprintf(buf, PAGE_SIZE, "%08xh\n", ioc->debug_level); + return sysfs_emit(buf, "%08xh\n", ioc->debug_level); } static ssize_t mptscsih_debug_level_store(struct device *dev, struct device_attribute *attr,