Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp603896rwb; Fri, 23 Sep 2022 01:18:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6B5I5g/KQNUbRCeWHtlpZsnQdYrbu5U/GXBngB9Yo0nyNja2LqfOQsbqp6p1G8xYIPcoLs X-Received: by 2002:a05:6402:27ca:b0:451:7b58:1b01 with SMTP id c10-20020a05640227ca00b004517b581b01mr7393929ede.61.1663921095989; Fri, 23 Sep 2022 01:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663921095; cv=none; d=google.com; s=arc-20160816; b=0kYPdEYxLjtbJRBpILex1Q4c0U3D/4BJ7PnQO//Yr+4dVV0Qwz6pN98BCDtE1dZNar m7wt4qOjfmQx3MpXzsUj3FpxRN3/6I3/xuFAtsMbFmtKlfRQnEB5Q3gOUz0yYDhvkBo8 r1RLbuM2AsYbwQxRDwwhMDwy/8lmCD0b+WK/a5kQ7obd+zjNABzW56yu+wh5kxTD1c/c Cx+pNhN9lYyE27zUiQFsKxUb6nYsH0Fd/D+2Xhw3PbXHj/mCXSiTf/poHZKM4da0Qwt7 GGp/zZDMWIk7qTbh2GoznboJkZT5dGrsP3Nl0JHhUNzTo96Xj2DA4elD2wVBF9u7VuC6 ge7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=tiYHySkSdeoAlPBnug0u1hYYekwMpGDH5K7twPPQeYA=; b=DITQAzrYBDmkLK2yj2DHQjIhjMzhPWjs44lKazmH7KWv/mtJ0fWO/CLGJowWLJObB3 LMjLFbYT8BVitl4v7aXmO/Tx9jFd+bDTuKs+5oQAq68orp5gMg1npCkjFmGy9EE98Vzd Qda1etaWunnoJYb4qV0kSQoECFq3k4C5LOWa1smtEVx48L/0Y1uM75iRMq72XS+bIVpQ 0x5c80ZBA+W97y7SI5AwtBtJpEl8v4RK+G2WaNNXI1ox5Ed+VXMW4T5ixOP6Ati4T5Et XFnklGG0CMO/zHk3c2irdM/TwSCcPm8ai6IeT1B1Md4d7e7rVPdXY0NeAZYncNwgrkEf fUmQ== ARC-Authentication-Results: i=1; mx.google.com; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt8-20020a170907728800b007418a1e877dsi7175905ejc.580.2022.09.23.01.17.49; Fri, 23 Sep 2022 01:18:15 -0700 (PDT) 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; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229991AbiIWIGv (ORCPT + 99 others); Fri, 23 Sep 2022 04:06:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbiIWIGq (ORCPT ); Fri, 23 Sep 2022 04:06:46 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C567D11E0CC; Fri, 23 Sep 2022 01:06:45 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MYl605hsbzpVP8; Fri, 23 Sep 2022 16:03:52 +0800 (CST) Received: from kwepemm600001.china.huawei.com (7.193.23.3) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 23 Sep 2022 16:06:43 +0800 Received: from huawei.com (10.175.113.133) by kwepemm600001.china.huawei.com (7.193.23.3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 23 Sep 2022 16:06:42 +0800 From: Wang Hai To: , , , , , , , CC: , , , Subject: [PATCH -next] SUNRPC: use DEFINE_PROC_SHOW_ATTRIBUTE to define rpc_proc_fops Date: Fri, 23 Sep 2022 16:35:02 +0800 Message-ID: <20220923083502.8722-1-wanghai38@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.113.133] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600001.china.huawei.com (7.193.23.3) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 Use DEFINE_PROC_SHOW_ATTRIBUTE helper macro to simplify the code. Signed-off-by: Wang Hai --- net/sunrpc/stats.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 52908f9e6ea..7b4c42e56cf 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c @@ -34,7 +34,8 @@ /* * Get RPC client stats */ -static int rpc_proc_show(struct seq_file *seq, void *v) { +static int rpc_show(struct seq_file *seq, void *v) +{ const struct rpc_stat *statp = seq->private; const struct rpc_program *prog = statp->program; unsigned int i, j; @@ -64,17 +65,7 @@ static int rpc_proc_show(struct seq_file *seq, void *v) { return 0; } -static int rpc_proc_open(struct inode *inode, struct file *file) -{ - return single_open(file, rpc_proc_show, pde_data(inode)); -} - -static const struct proc_ops rpc_proc_ops = { - .proc_open = rpc_proc_open, - .proc_read = seq_read, - .proc_lseek = seq_lseek, - .proc_release = single_release, -}; +DEFINE_PROC_SHOW_ATTRIBUTE(rpc); /* * Get RPC server stats -- 2.17.1