Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp502323ybt; Fri, 26 Jun 2020 04:54:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZvu6dyzhvQUSQBoQZH4Sgv6OBFQkNP0RLwYbvq40bz7BU6gwksyNsa1z6rVa4210ukf7O X-Received: by 2002:a50:d905:: with SMTP id t5mr2864543edj.344.1593172480141; Fri, 26 Jun 2020 04:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593172480; cv=none; d=google.com; s=arc-20160816; b=hBlBi45jOIzyPZTNVaThb9JZh0RrkB56kzCOT6UhCruZZH4Okcv4GSo6ocZkGJiV6L vKXkPrrLOkjr0QyQlV1Gt6/nP5Genz/Laf283JPrAjq57vasn1Ki+KQVy6WjNjpDHwbh WM6dd5Ms25ASk2HyK3oVK/2hHvz9De93W+fEEVskcTuJKoQMHTPIPEUe//XSDUGYGwsP 4wx+sbLtJHfK1tnpqANcVk/wv8SGdW21hnEsjHKiNk5eTd4cBJ8azWb4aVnz+b+ayA1e 7IrDRTV2GTCdhgB7sDOp6XxwidTon7bWkGByGATq9Rf5M+H/JUEYQPbwXcrf4QDXWGbW hvdA== 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=UUaFEo17QKHU4+Ma6xnukW0/HpKSKEwfZU1Im7DHgJ0=; b=SqXO/7EkWBgQ0RwWIkpS0kxMmdeBOtSsBf38Zujo5sIJ3d7HUqqJ9s1iUPbva1fjPx htYYAvsp7g91Cyg8ZSPQOIrL6KUiHlCyKgyoFFNU1X6if99xC3pnk3k5WVk4DV974T8B EtkqWytFYwsZcFeacUbYyRRojii/DfX26fMoyu78/Jko6dqztwa/qjoRA4086BB4YKBI KrNx6PsD12hRu6r2kix5w5PQMnaCVIYtdhfHyK6/wj1h7YcVA8q4S0EJU2GyC3DjV3rt gp+9PLHp4rV3yi6PN2a4dU5mqSY4e/5TOQ9DSxf241jrB8FyPrmeBh8vLXJoH3OMuvw+ A2fg== 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 mj26si11363110ejb.416.2020.06.26.04.54.16; Fri, 26 Jun 2020 04:54:40 -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 S1727933AbgFZKcq (ORCPT + 99 others); Fri, 26 Jun 2020 06:32:46 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6832 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727870AbgFZKcp (ORCPT ); Fri, 26 Jun 2020 06:32:45 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 980232EFFCD9929409C7 for ; Fri, 26 Jun 2020 18:32:43 +0800 (CST) Received: from huawei.com (10.67.165.24) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Fri, 26 Jun 2020 18:32:40 +0800 From: Longfang Liu To: CC: Subject: [PATCH 4/5] crypto: hisilicon/sec2 - update debugfs interface parameters Date: Fri, 26 Jun 2020 18:32:08 +0800 Message-ID: <1593167529-22463-5-git-send-email-liulongfang@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1593167529-22463-1-git-send-email-liulongfang@huawei.com> References: <1593167529-22463-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 16bb3d7..5bef3d8 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