Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp34538pxk; Tue, 15 Sep 2020 19:28:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA2fddX7ZazIGNkRn0jpP2yzUESWFrXkDun6vwK/p/k7K8AIEf9/3JM+fYn70c/qMxk9BC X-Received: by 2002:a17:906:d7ab:: with SMTP id pk11mr22935923ejb.472.1600223315586; Tue, 15 Sep 2020 19:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600223315; cv=none; d=google.com; s=arc-20160816; b=IqotRDbmC3UZBelVtykCI7vZSi8IETL3FeqoD4j+UKd5kzLPIJT7/gfUYXemwgjg5K Iymg7MKoiEbaOBypmeCAssdAxDmaVfkCQR9Z4cyTxjoOzmdJIBZFYlRppbcD5+JPax4B t1d8hV3CPbnd4boLIRTM4xIv2X2mDX3OUUM0G8C6f+oAKTGXcd4boXPLOmYJl580DOE1 oTF3ghOVI0wBiKXZBUcaReE7Wbd3luwafugAMxedAyGqAVyIM2/81ZkGT6Tu8xl8zquN QEmyzepXDzB6qoyApgBcoAA28egmm5ZxMwECY0B8woxz82cBrwrIixFzWQIVRDeIJFAQ Bp+g== 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=Bt/z2E2HDSHwxgknDVEIhTlOBRXuwMpTWF4vyIzlC0s=; b=Z92L1xRONANlpX0yA5I/qtZoXeib5Gg+fkq8tUhRfOcyjDiGOCha0ElSeez8zH2ZQM iA8z3NCd2vwVFv2mehkZmebqjeUzIEKSW3p4Gz23v4bVgXyJp1jLdaiVYwR5lEQBHX0J o7sIVXYX2C4SGckKvHaaMmR2gvnCmoPoVWGs3lBL+J2yUEL2dOuraHUfE6ZKxjf0KUTB jilVPYirUgFcuG3U2sobJpY/xWb0WMjj0A8WxyKTpeqaNfHqzTqDiLJQO0cACTvl/UNe CdvTTKF0ZWs+scthMd8XArSc8uK/s8rXmLXxcLEu2wBaAexCgulVIIRjhggSMbVDB10X BfTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 g10si1397152edv.314.2020.09.15.19.28.00; Tue, 15 Sep 2020 19:28:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726367AbgIPC1v (ORCPT + 99 others); Tue, 15 Sep 2020 22:27:51 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12714 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726168AbgIPC1u (ORCPT ); Tue, 15 Sep 2020 22:27:50 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id B2954665F4AF7498DE7E; Wed, 16 Sep 2020 10:27:48 +0800 (CST) Received: from huawei.com (10.175.113.32) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Wed, 16 Sep 2020 10:27:41 +0800 From: Liu Shixin To: Giovanni Cabiddu , Herbert Xu , "David S . Miller" CC: , , , Liu Shixin Subject: [PATCH -next] crypto: qat - convert to use DEFINE_SEQ_ATTRIBUTE macro Date: Wed, 16 Sep 2020 10:50:17 +0800 Message-ID: <20200916025017.3992367-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-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code. Signed-off-by: Liu Shixin --- drivers/crypto/qat/qat_common/adf_cfg.c | 19 +-------- .../qat/qat_common/adf_transport_debug.c | 42 ++----------------- 2 files changed, 5 insertions(+), 56 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_cfg.c b/drivers/crypto/qat/qat_common/adf_cfg.c index ac462796cefc..22ae32838113 100644 --- a/drivers/crypto/qat/qat_common/adf_cfg.c +++ b/drivers/crypto/qat/qat_common/adf_cfg.c @@ -52,24 +52,7 @@ static const struct seq_operations qat_dev_cfg_sops = { .show = qat_dev_cfg_show }; -static int qat_dev_cfg_open(struct inode *inode, struct file *file) -{ - int ret = seq_open(file, &qat_dev_cfg_sops); - - if (!ret) { - struct seq_file *seq_f = file->private_data; - - seq_f->private = inode->i_private; - } - return ret; -} - -static const struct file_operations qat_dev_cfg_fops = { - .open = qat_dev_cfg_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release -}; +DEFINE_SEQ_ATTRIBUTE(qat_dev_cfg); /** * adf_cfg_dev_add() - Create an acceleration device configuration table. diff --git a/drivers/crypto/qat/qat_common/adf_transport_debug.c b/drivers/crypto/qat/qat_common/adf_transport_debug.c index 2a2eccbf56ec..dac25ba47260 100644 --- a/drivers/crypto/qat/qat_common/adf_transport_debug.c +++ b/drivers/crypto/qat/qat_common/adf_transport_debug.c @@ -77,31 +77,14 @@ static void adf_ring_stop(struct seq_file *sfile, void *v) mutex_unlock(&ring_read_lock); } -static const struct seq_operations adf_ring_sops = { +static const struct seq_operations adf_ring_debug_sops = { .start = adf_ring_start, .next = adf_ring_next, .stop = adf_ring_stop, .show = adf_ring_show }; -static int adf_ring_open(struct inode *inode, struct file *file) -{ - int ret = seq_open(file, &adf_ring_sops); - - if (!ret) { - struct seq_file *seq_f = file->private_data; - - seq_f->private = inode->i_private; - } - return ret; -} - -static const struct file_operations adf_ring_debug_fops = { - .open = adf_ring_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release -}; +DEFINE_SEQ_ATTRIBUTE(adf_ring_debug); int adf_ring_debugfs_add(struct adf_etr_ring_data *ring, const char *name) { @@ -188,31 +171,14 @@ static void adf_bank_stop(struct seq_file *sfile, void *v) mutex_unlock(&bank_read_lock); } -static const struct seq_operations adf_bank_sops = { +static const struct seq_operations adf_bank_debug_sops = { .start = adf_bank_start, .next = adf_bank_next, .stop = adf_bank_stop, .show = adf_bank_show }; -static int adf_bank_open(struct inode *inode, struct file *file) -{ - int ret = seq_open(file, &adf_bank_sops); - - if (!ret) { - struct seq_file *seq_f = file->private_data; - - seq_f->private = inode->i_private; - } - return ret; -} - -static const struct file_operations adf_bank_debug_fops = { - .open = adf_bank_open, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release -}; +DEFINE_SEQ_ATTRIBUTE(adf_bank_debug); int adf_bank_debugfs_add(struct adf_etr_bank_data *bank) { -- 2.25.1