Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp616539ybt; Mon, 6 Jul 2020 18:18:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/FVTRSgXyi01nqHRZhiyZUSjpg2bMqmdqOj6tur3QnIaRSsBC+z1w43URyMZQqKA87cGV X-Received: by 2002:a17:906:6146:: with SMTP id p6mr39762857ejl.433.1594084718962; Mon, 06 Jul 2020 18:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594084718; cv=none; d=google.com; s=arc-20160816; b=At2udZFDY0n3JLSK0Hek6v8RC5gYExZVBGXzU8w6DjF2/xAWLcLd4nOHUIPqFRC+dZ SVULHv1SXdpjnN39To5AtvLJwrELiD/Q1fJgJ1EaiHQmOeKi5qsB067l0gKVkYaL+TKb T6wxggIZ4D52wo5yhDIIyAPQpt6lSCkY5KAPFuvLnaTuJrN/sKmQOVsURVNdoSmKdyLS oo3mw2YTCSzKiB1N5C1eXutnwxJT7QeluxeoFEsHUGLih6iB9By4jAWsg/haHAc5SLDo VuJqXvfAygsJWe3+IY3O7ppGt64vgoYPRq3v1P8dEtkNPGHPcxGJD8+RlbNOz1rOUsew zHdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=GDOls1/kumVGeuZGDF1bU6iHULv28xsOEefEVYaAU6g=; b=LRH4YF3w7L+ne1pkWiWBnWawNiwfpM5VjcZfNw5LGHMzFnebEJh6KXrTxjvsIoYqh6 ZBXD0R8P9ejAOa3oIpDckcG8VYbFK7qSStwuu30YWvttoLhb2sElcAXgUHfQ9SLamLvs JG0Gew/Vy0FLsNNA4JfVUBnvR1d3Sv3r4oCoTwLoxn82NvxMsKBUE+v/rgmx4FkZ/8rU sqgBrCpXlP4Rn/U+N7GuUwkyA7g4GXfHeLvvFbzC9CFz/4cUHcUvD3Rn+LaMANQezY7c 42uPU8yyWW7Tl6I+pTeqTt0d3rSJmZ0Y+BP3OdveL4m7HcZvwfPiZCTl0px2f3DyMRfP 8pRQ== 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 t19si13075509eju.562.2020.07.06.18.18.15; Mon, 06 Jul 2020 18:18:38 -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 S1725892AbgGGBQ0 (ORCPT + 99 others); Mon, 6 Jul 2020 21:16:26 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:36616 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727079AbgGGBQX (ORCPT ); Mon, 6 Jul 2020 21:16:23 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B760197FD12E96E39DF1 for ; Tue, 7 Jul 2020 09:16:21 +0800 (CST) Received: from huawei.com (10.67.165.24) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Tue, 7 Jul 2020 09:16:16 +0800 From: Longfang Liu To: CC: Subject: [PATCH v2 4/5] crypto: hisilicon/sec2 - update debugfs interface parameters Date: Tue, 7 Jul 2020 09:15:40 +0800 Message-ID: <1594084541-22177-5-git-send-email-liulongfang@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1594084541-22177-1-git-send-email-liulongfang@huawei.com> References: <1594084541-22177-1-git-send-email-liulongfang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Update debugfs interface parameters, and adjust the processing logic inside the corresponding function Signed-off-by: Longfang Liu --- drivers/crypto/hisilicon/sec2/sec_main.c | 54 ++++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c index 0c12987..301f042 100644 --- a/drivers/crypto/hisilicon/sec2/sec_main.c +++ b/drivers/crypto/hisilicon/sec2/sec_main.c @@ -586,16 +586,16 @@ static int sec_debugfs_atomic64_set(void *data, u64 val) DEFINE_DEBUGFS_ATTRIBUTE(sec_atomic64_ops, sec_debugfs_atomic64_get, sec_debugfs_atomic64_set, "%lld\n"); -static int sec_core_debug_init(struct sec_dev *sec) +static int sec_core_debug_init(struct hisi_qm *qm) { - struct hisi_qm *qm = &sec->qm; + struct sec_dev *sec = container_of(qm, struct sec_dev, qm); struct device *dev = &qm->pdev->dev; struct sec_dfx *dfx = &sec->debug.dfx; struct debugfs_regset32 *regset; struct dentry *tmp_d; int i; - tmp_d = debugfs_create_dir("sec_dfx", sec->qm.debug.debug_root); + tmp_d = debugfs_create_dir("sec_dfx", qm->debug.debug_root); regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL); if (!regset) @@ -618,44 +618,44 @@ static int sec_core_debug_init(struct sec_dev *sec) return 0; } -static int sec_debug_init(struct sec_dev *sec) +static int sec_debug_init(struct hisi_qm *qm) { + struct sec_dev *sec = container_of(qm, struct sec_dev, qm); int i; - for (i = SEC_CURRENT_QM; i < SEC_DEBUG_FILE_NUM; i++) { - spin_lock_init(&sec->debug.files[i].lock); - sec->debug.files[i].index = i; - sec->debug.files[i].qm = &sec->qm; - - debugfs_create_file(sec_dbg_file_name[i], 0600, - sec->qm.debug.debug_root, - sec->debug.files + i, - &sec_dbg_fops); + if (qm->pdev->device == SEC_PF_PCI_DEVICE_ID) { + for (i = SEC_CURRENT_QM; i < SEC_DEBUG_FILE_NUM; i++) { + spin_lock_init(&sec->debug.files[i].lock); + sec->debug.files[i].index = i; + sec->debug.files[i].qm = qm; + + debugfs_create_file(sec_dbg_file_name[i], 0600, + qm->debug.debug_root, + sec->debug.files + i, + &sec_dbg_fops); + } } - return sec_core_debug_init(sec); + return sec_core_debug_init(qm); } -static int sec_debugfs_init(struct sec_dev *sec) +static int sec_debugfs_init(struct hisi_qm *qm) { - struct hisi_qm *qm = &sec->qm; struct device *dev = &qm->pdev->dev; int ret; qm->debug.debug_root = debugfs_create_dir(dev_name(dev), sec_debugfs_root); - qm->debug.sqe_mask_offset = SEC_SQE_MASK_OFFSET; qm->debug.sqe_mask_len = SEC_SQE_MASK_LEN; ret = hisi_qm_debug_init(qm); if (ret) goto failed_to_create; - if (qm->pdev->device == SEC_PF_PCI_DEVICE_ID) { - ret = sec_debug_init(sec); - if (ret) - goto failed_to_create; - } + ret = sec_debug_init(qm); + if (ret) + goto failed_to_create; + return 0; @@ -665,9 +665,9 @@ static int sec_debugfs_init(struct sec_dev *sec) return ret; } -static void sec_debugfs_exit(struct sec_dev *sec) +static void sec_debugfs_exit(struct hisi_qm *qm) { - debugfs_remove_recursive(sec->qm.debug.debug_root); + debugfs_remove_recursive(qm->debug.debug_root); } static void sec_log_hw_error(struct hisi_qm *qm, u32 err_sts) @@ -877,7 +877,7 @@ static int sec_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err_probe_uninit; } - ret = sec_debugfs_init(sec); + ret = sec_debugfs_init(qm); if (ret) pci_warn(pdev, "Failed to init debugfs!\n"); @@ -902,7 +902,7 @@ static int sec_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_remove_from_list: hisi_qm_del_from_list(qm, &sec_devices); - sec_debugfs_exit(sec); + sec_debugfs_exit(qm); hisi_qm_stop(qm); err_probe_uninit: @@ -926,7 +926,7 @@ static void sec_remove(struct pci_dev *pdev) if (qm->fun_type == QM_HW_PF && qm->vfs_num) hisi_qm_sriov_disable(pdev); - sec_debugfs_exit(sec); + sec_debugfs_exit(qm); (void)hisi_qm_stop(qm); -- 2.8.1