From patchwork Fri Dec 3 11:51:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yihao Han X-Patchwork-Id: 12654983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 510FDC43217 for ; Fri, 3 Dec 2021 11:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380594AbhLCLzi (ORCPT ); Fri, 3 Dec 2021 06:55:38 -0500 Received: from mail-sgaapc01on2091.outbound.protection.outlook.com ([40.107.215.91]:18273 "EHLO APC01-SG2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231944AbhLCLzi (ORCPT ); Fri, 3 Dec 2021 06:55:38 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cU9RdnS2OJ5zQOMukaclIk7zfJBw5b//JqnTfE1VxXwvrfRig6N4UL4VbOwqD9c5FCnaLdnhHIpHatLxFKqQfrgadGMqCmxsX6cYAM0x1hXvV28R7cwm8iQNEls/OpDpTWJuPGkQC8896ogziihzBuWpzupbQ7JaZ3YJk70yDGKuOsoFg31ND8BjJdMipGDqJYBEHwaSAeRnMEqf7BriP3XfrGVImySuU9YnfsKQ4Bd788RRD3kAlBnJsks7jL+To71ft2ussN7N5Ol7wPTgHDsb2P5fxLukQX9EVEKCesWtBJphzsK2Zuk3Vs1amTT5MEEZjzn97y5DOBrp44T4cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6kIe+6COFQgX+amb2vkkwfLrTAVEzrOMhmj7JepZGiE=; b=IeDvjJVpeFbxgDQEHH1D/utPbxV5qiaZg7OJ7KfDwMVeTCwUQWGUvVPp+kjGjI+YP/H1d0VczKtSkxVOTZlFo9p+7KRk+U4RRl2Jyup6JVgu0jbM+F2CDqfUO28AEwr08MWdIy7+jnOtC3sRDhOa98Jjcl8y3sx2E0pIl439GTau2kWVlxaE/zgCbPsbMWrRRbbex56cwDq0UEVAecjNM6SqNr1Xvqkrh+KbjRQPXUy/i1perHjrmr7o/kEdhnkCUM2NKvWr3ebs8nfe45j78WMz1UDI82o0Du1wgDxcCCtAPCsOnhTvFkZHs79qcAebZK2+wnM9xsHndomVxv4HXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo0.onmicrosoft.com; s=selector2-vivo0-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6kIe+6COFQgX+amb2vkkwfLrTAVEzrOMhmj7JepZGiE=; b=fPq5G3bhDvjNOf4hdinfIH6PssvoNbKltxZYnVwBs4JCLzJE7B5rZyeqIP39XCew2yGfSj0YzqTrFmR5zeF2ihNiNDiynhT4pz64QAJySBKvlmYDXO9JLBqAqE26VHQ4DnVkXp0I5+uCBHnYuWaHJFtfey56lBC1f6cdtpBUolY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB4173.apcprd06.prod.outlook.com (2603:1096:400:26::14) by TY2PR06MB2894.apcprd06.prod.outlook.com (2603:1096:404:37::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.28; Fri, 3 Dec 2021 11:52:11 +0000 Received: from TYZPR06MB4173.apcprd06.prod.outlook.com ([fe80::6093:831:2123:6092]) by TYZPR06MB4173.apcprd06.prod.outlook.com ([fe80::6093:831:2123:6092%5]) with mapi id 15.20.4734.027; Fri, 3 Dec 2021 11:52:10 +0000 From: Yihao Han To: "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel@vivo.com, Yihao Han Subject: [PATCH] scsi: pmcraid: Replace snprintf in show functions with sysfs_emit Date: Fri, 3 Dec 2021 03:51:58 -0800 Message-Id: <20211203115158.6022-1-hanyihao@vivo.com> X-Mailer: git-send-email 2.17.1 X-ClientProxiedBy: HK0PR01CA0056.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::20) To TYZPR06MB4173.apcprd06.prod.outlook.com (2603:1096:400:26::14) MIME-Version: 1.0 Received: from ubuntu.vivo.xyz (218.213.202.189) by HK0PR01CA0056.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23 via Frontend Transport; Fri, 3 Dec 2021 11:52:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 115e682f-2c15-4597-dbff-08d9b65356e9 X-MS-TrafficTypeDiagnostic: TY2PR06MB2894: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:85; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BczyF0WRrMXZdgLSAIvytiVOrN5MQ+GhcgPPMjU3nKC5IrKqKtAyvzAWDdy8OI+gEUUyuUS787ApAVBXZUs4FUplrVYPzt7ykJ4XLFuhe9Lm6KwrbSKWH3QH/DoFGs8Q+/Br3dA4N6vgOW20T+R7sCzfsbUhH8VKuHHKl5IDNuvYC0eY6P6W+2OqisZT0Q7Fw69S0HfreJrNL3UVRmndUzLy6QYVTYcceeO9WyFguvBZ+Aq1dhp9OirbEL7eTEKUiOyO5IzlhJx0hLwFlNmhrkj76SbEzfhUnJUwO7SXjZM8OnFvowBxIH6Iba07/+SUoRIlnNXvwZS/txcxTdGk0YsMjATsfhKHVuWKZYpf3q/1UnDfNVdU24zWlpuMPd4l8uBVP6T7d846u3s6p34CZcw6f1LK5ipIRvN31kTIaznALknaCc/EiR18nTADgA80SM4TyaZgUEW/yCNWE7oA8WJ7H8mEn3Wx0iBFgxvtKplI/J7y1CrAbtkITCxplepXOSzZK7qyUVfls+DBHfZbBR/xE4bx1CdIf4D/F8hC4sJgJCoSzDTOTirphP819cSuj64mP50KnfNd9PjmEr7y7E5c2z7I/LDP2XwkWdQxiO5B4M2Qfyy82D1NyjmSYpJUfooKBhP+VJ7/UiF2I0AzDaw/crAsJb105YLwZ7oh46HQHiAwSqb9sIRTCOfu565HhaO7VujefQHtUz+hAUySteZGP4U4q1MA4QGq7U7Oz6U= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB4173.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(508600001)(5660300002)(6486002)(38350700002)(26005)(38100700002)(2906002)(36756003)(66476007)(83380400001)(66556008)(66946007)(86362001)(956004)(6666004)(110136005)(2616005)(107886003)(1076003)(8676002)(8936002)(52116002)(6512007)(316002)(6506007)(4326008)(182500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Et3QULSHEOlxKKDBTKll27e++/N0XvU5dpYUOzq/7Kn5hwDlYmVYhGEE8OxkPOn3gn70ZVi9kd0RHey1sonjTh8BpkYll3vguYKRrSD45XrsVccILHzSdHhVwmyqx2yZMZTp91jf9NkhTjgXYd0VoMou1EN0ARzOPU9K/2txrXIhuFHm9wNvZu3U2MSdMgQgn5NB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aAuCEMMgEbKllW0mGGBYnNYWYRugzIujYyPt3xmkufacYXhXpWg6GQRyX8TtTx8ydpgm+8cdas5UZZqGXWhjWxIzmQ8wcA6EmIriA224moMljYEfOog6P+kI1jdBIYk+L3u7vhiX9EqB/KamXFbE7Fco3FKGJb+PMN/9L5qY+5nJkPsDcVwxgDJtI59+Sz7VqRckobM0VKq8l9mbc2M153nZzY+/IuMldOwg8v2/SiuK6dCf56q96EHQqD+9RPOgiQgX7CCOOkWCHT/tsw0wGfAk3tWXyDM58sVMYlKs/9wcspnS11O0rCiy0je+8kFCzyOxupykI47MtEIbmh1pnMtOuJm2WbAg6q9mgA6E0z8yM= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 115e682f-2c15-4597-dbff-08d9b65356e9 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB4173.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2021 11:52:10.7806 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hbkOe7IecyIDUbz7iNle+VET0fxan6Txj9Nmr6XSFiByl8AJk+AtfXC/EOXzCgp7pKT4WqpGXuX2tJwaGXez7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR06MB2894 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use sysfs_emit instead of scnprintf or sprintf makes more sense. Signed-off-by: Yihao Han --- drivers/scsi/pmcraid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 2fe7a0019fff..551713d33838 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -3984,7 +3984,7 @@ static ssize_t pmcraid_show_log_level( struct Scsi_Host *shost = class_to_shost(dev); struct pmcraid_instance *pinstance = (struct pmcraid_instance *)shost->hostdata; - return snprintf(buf, PAGE_SIZE, "%d\n", pinstance->current_log_level); + return sysfs_emit(buf, "%d\n", pinstance->current_log_level); } /** @@ -4045,7 +4045,7 @@ static ssize_t pmcraid_show_drv_version( char *buf ) { - return snprintf(buf, PAGE_SIZE, "version: %s\n", + return sysfs_emit(buf, "version: %s\n", PMCRAID_DRIVER_VERSION); } @@ -4079,7 +4079,7 @@ static ssize_t pmcraid_show_adapter_id( pinstance->pdev->devfn; u32 aen_group = pmcraid_event_family.id; - return snprintf(buf, PAGE_SIZE, + return sysfs_emit(buf, "adapter id: %d\nminor: %d\naen group: %d\n", adapter_id, MINOR(pinstance->cdev.dev), aen_group); }