Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp35040pxk; Tue, 15 Sep 2020 19:29:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvSxQZ7oyYnE7pIzrkg93zXmajGeysEV/etju2qruIrP98TEnZja75DMpLW+g/pPOMXuHP X-Received: by 2002:a17:907:6f6:: with SMTP id yh22mr23142248ejb.268.1600223392388; Tue, 15 Sep 2020 19:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600223392; cv=none; d=google.com; s=arc-20160816; b=dK7iWIUSZzSQjLJrauYA56RtKBcXgDk5s49mCAaKoEzzN1/OS/SZXnbvrV/eWpAryd KzZlTRPACAqVYBEKH44EtjpK1DvT39762Yf8m1MI/fvF17faICwA38ND7e5E3d0d/HyC Xga+AGTMPw38yUTr+vuyGZsy/TVtIZmX95zEpBN45tXJsoNPibqem9pVp03+nUa7h2zO F97g7G63w5HhioKyTesNVDQx9iOi/Vatkxr6id8FczJ6s2qyWCxhj8cPITGLUiCSNL7L WDPxn1/uQ/kMLIbv+oiuQXET8PYGcCJ4wyF9b+BmafVs3NB5GANqTG3Ax6tCeTlZLxYs 4+Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=XEoDyL947jpwR67hVtkA5+ds4Zj2BphoGDDH+AyeyaI=; b=qnIjU28wqxky/odfeTqGt/BLbMVaFKX1gI5kKhfezT2cZQ6+1wwPBpj8dGCd2Z7pYg sope5vudfJl4wwncQnt3ptWweFMSrt7kvK2ASOl67h1VOBz2+4DMqNpiLEz9LaONA1v0 T6P3nKtnX/w1AOa3VRV90y173Kds9qpa2aqdr3q1AcHV4Ljav1OHKDWdupOrNGJpIRNI BgcLLdDuOAQU/xZbNreKnauyv5p9Fd9aHlVd9rCx6pEbaLoGN7t8sW/Iw5/KzXGVzjvU WMoVZx2vATAhFmXkzhztzEVYbFvrKp6kvpZhieq/XtCrp8zJBQtn74q8GKg98wkBwcr/ WPcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj23si11329033ejb.419.2020.09.15.19.29.30; Tue, 15 Sep 2020 19:29:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726412AbgIPC2I (ORCPT + 99 others); Tue, 15 Sep 2020 22:28:08 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12715 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726269AbgIPC1v (ORCPT ); Tue, 15 Sep 2020 22:27:51 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 18E7FC10482E2933FAB9; Wed, 16 Sep 2020 10:27:49 +0800 (CST) Received: from huawei.com (10.175.113.32) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Wed, 16 Sep 2020 10:27:40 +0800 From: Liu Shixin To: Jiri Slaby , Nick Kossifidis , Luis Chamberlain , Kalle Valo , "David S . Miller" , Jakub Kicinski CC: , , , Liu Shixin Subject: [PATCH -next] ath5k: convert to use DEFINE_SEQ_ATTRIBUTE macro Date: Wed, 16 Sep 2020 10:50:15 +0800 Message-ID: <20200916025015.3992315-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-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code. Signed-off-by: Liu Shixin --- drivers/net/wireless/ath/ath5k/debug.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c index 2eaba1ccab20..4b41160e5d38 100644 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ b/drivers/net/wireless/ath/ath5k/debug.c @@ -161,33 +161,14 @@ static int reg_show(struct seq_file *seq, void *p) return 0; } -static const struct seq_operations register_seq_ops = { +static const struct seq_operations registers_sops = { .start = reg_start, .next = reg_next, .stop = reg_stop, .show = reg_show }; -static int open_file_registers(struct inode *inode, struct file *file) -{ - struct seq_file *s; - int res; - res = seq_open(file, ®ister_seq_ops); - if (res == 0) { - s = file->private_data; - s->private = inode->i_private; - } - return res; -} - -static const struct file_operations fops_registers = { - .open = open_file_registers, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release, - .owner = THIS_MODULE, -}; - +DEFINE_SEQ_ATTRIBUTE(registers); /* debugfs: beacons */ @@ -1005,7 +986,7 @@ ath5k_debug_init_device(struct ath5k_hw *ah) return; debugfs_create_file("debug", 0600, phydir, ah, &fops_debug); - debugfs_create_file("registers", 0400, phydir, ah, &fops_registers); + debugfs_create_file("registers", 0400, phydir, ah, ®isters_fops); debugfs_create_file("beacon", 0600, phydir, ah, &fops_beacon); debugfs_create_file("reset", 0200, phydir, ah, &fops_reset); debugfs_create_file("antenna", 0600, phydir, ah, &fops_antenna); -- 2.25.1