Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp824384rwb; Thu, 22 Sep 2022 06:56:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7f2x6fZUBZSzFy4UgMEZygCYK2Onr8/tQ6+mJjAvVQHQTsiNmr2hr3sZRmOlzqskAtod0V X-Received: by 2002:a17:907:3d8e:b0:77b:fd55:affe with SMTP id he14-20020a1709073d8e00b0077bfd55affemr2887366ejc.498.1663854971469; Thu, 22 Sep 2022 06:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663854971; cv=none; d=google.com; s=arc-20160816; b=qh1NSQ5khTG+AlkrsAuoloOtO9Czmw6GrrYiYc5QuAWLjiWBU2NGwKJ6Eiw7vAa6Rs WsY5xkLQaH6zg8UFdFQDejL/T1szc1I9f3Bv1wDU7/Du9zYQFutvfmzZ7MJKXMauKspq 7giL9IInZPDk5olYUufNdAkZvwJWRb06RvC0+6yuvWK6fxWGzSqLr8GO95K91MwNP5Uj U3oKsbfdLpCwffqKejPx/BLAJJ1PW+zHk9NvrG6Bj3l9Bao7IQxUWbUKB7gHXOfexAIJ altpv3yt7d97xaokf/wl0ogP6AQE11FwY9diz/Cg5IqYGYbff/fJutitruZ9YWkSP9Cp HPfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=9bEwUj0GC/z0jsPf+qsZUIWC5T2+sdgr85HIYMz0X/s=; b=DkaybLp62JW4va1MjpgyhAf/m9wR489LR79+Ixsi3HYKKkY63Jl3epYkQMDUE9wTRe wVyfqiovqtF9MbdAmNJX0gHhXbPeEQDdLrh5Kf5DinCmqooUFqBWVu368QGbQ58jwWXR 2Nj4lWuaZrc+Ie0YkBjEmbkJDzaFYQN4Dl4W7ZSH/tG1yLg3s8oZ8w/YRfSuCrfXF1ky Bmn1hLyOFyv5pgWFEGCYBnTFIkbsPjk4HQaCsW3vEP0R82gqSIq8RZiF7w+7E4+ffwvu PLQzW9MOgttGBpr7c6FNy9bPA0q0IhbNP4laJrL2H616LsjwjhDrI1r5eHD2kGLPWrj3 3pAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 s29-20020a508d1d000000b004480d6fefe4si5435393eds.239.2022.09.22.06.55.52; Thu, 22 Sep 2022 06:56:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 S231701AbiIVNzS (ORCPT + 63 others); Thu, 22 Sep 2022 09:55:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230365AbiIVNzR (ORCPT ); Thu, 22 Sep 2022 09:55:17 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4AC46BCDE; Thu, 22 Sep 2022 06:55:14 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MYGs42k08z14RgP; Thu, 22 Sep 2022 21:51:04 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 22 Sep 2022 21:55:10 +0800 Received: from huawei.com (10.175.113.32) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 22 Sep 2022 21:55:12 +0800 From: Liu Shixin To: Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" CC: , , Liu Shixin Subject: [PATCH] wifi: wil6210: debugfs: use DEFINE_SHOW_ATTRIBUTE to simplify fw_capabilities/fw_version Date: Thu, 22 Sep 2022 22:28:58 +0800 Message-ID: <20220922142858.3250469-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100009.china.huawei.com (7.185.36.113) 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-wireless@vger.kernel.org Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code. No functional change. Signed-off-by: Liu Shixin --- drivers/net/wireless/ath/wil6210/debugfs.c | 36 ++++------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index 04d1aa0e2d35..c021ebcddee7 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -2154,7 +2154,7 @@ static const struct file_operations fops_led_blink_time = { }; /*---------FW capabilities------------*/ -static int wil_fw_capabilities_debugfs_show(struct seq_file *s, void *data) +static int fw_capabilities_show(struct seq_file *s, void *data) { struct wil6210_priv *wil = s->private; @@ -2163,22 +2163,10 @@ static int wil_fw_capabilities_debugfs_show(struct seq_file *s, void *data) return 0; } - -static int wil_fw_capabilities_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_fw_capabilities_debugfs_show, - inode->i_private); -} - -static const struct file_operations fops_fw_capabilities = { - .open = wil_fw_capabilities_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; +DEFINE_SHOW_ATTRIBUTE(fw_capabilities); /*---------FW version------------*/ -static int wil_fw_version_debugfs_show(struct seq_file *s, void *data) +static int fw_version_show(struct seq_file *s, void *data) { struct wil6210_priv *wil = s->private; @@ -2189,19 +2177,7 @@ static int wil_fw_version_debugfs_show(struct seq_file *s, void *data) return 0; } - -static int wil_fw_version_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_fw_version_debugfs_show, - inode->i_private); -} - -static const struct file_operations fops_fw_version = { - .open = wil_fw_version_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; +DEFINE_SHOW_ATTRIBUTE(fw_version); /*---------suspend_stats---------*/ static ssize_t wil_write_suspend_stats(struct file *file, @@ -2366,8 +2342,8 @@ static const struct { {"recovery", 0644, &fops_recovery}, {"led_cfg", 0644, &fops_led_cfg}, {"led_blink_time", 0644, &fops_led_blink_time}, - {"fw_capabilities", 0444, &fops_fw_capabilities}, - {"fw_version", 0444, &fops_fw_version}, + {"fw_capabilities", 0444, &fw_capabilities_fops}, + {"fw_version", 0444, &fw_version_fops}, {"suspend_stats", 0644, &fops_suspend_stats}, {"compressed_rx_status", 0644, &fops_compressed_rx_status}, {"srings", 0444, &srings_fops}, -- 2.25.1