Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp703728pxk; Thu, 3 Sep 2020 10:25:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlzieFAfw2ejRu0EUpBaAwlyfxgm6EMA0TqY4dGhsNvDjtZeq5ZPg8LrNiFmjUZrCJ4HTo X-Received: by 2002:a05:6402:ca7:: with SMTP id cn7mr4174613edb.143.1599153927821; Thu, 03 Sep 2020 10:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599153927; cv=none; d=google.com; s=arc-20160816; b=lKk0380jnkr2cUlF7aPe3PXZAo8TNNaklElT7GdzYckfsUNxxVpKwEzSwXwtToD7Yj zpfoRDa8KzMMhqEAp13UqrglbveA82bvl3Wp7hrMKXks/FDE+avTTnr56F4y4NEXHrP2 NTQUT8kSBqrLhTOeazq1RZYQ1djMe7+MFhlU29kv4/G4Z29wfJS/Ap8Vgb+X5UoOxudg 2BJmtwxXrZWPjYTU7YhWbzsyVvFEul+rjRAWL73rKehgaYKo5tmZTVNMVcQMF7SmcmIA 4BNTOToyII2rX2TeDgIHQrMowX/t9Q1MjiaxIKHSAcSJW1C55leG+/S3+hs5CmOQ1xeZ AeaQ== 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:dkim-signature:dkim-filter; bh=gOb+negVkjmzLx4YSk4hHdD/ZClmAxeg30OhEEfJHqA=; b=ug+55rfLyED5Lt2B82C8RVy5/YTMEeJCsjjR7Np1caJuk0TX0ESTco4V+bvn54H5CE NpHYCpPCwbZP9W+YyNdZd9j54h6hDpJB1OZPDFBEuzHEH9Kh4+LP+ARZbW0nR/JeiIw7 jKz5EFCxBWm63CKCx1fcGTl5Cya0jXhn4VEWL8vGpg2JE6a4u7W4rWfK45imWaKAqiwn XZnE7qmo26MU0s3EtC0bhl2RDtMMZlgcNpCSkJZHScGmRKI5waV2uK7/hNlGj3RBkZ1M vBegsARN+PwpFa3V3Bw4iaZ5OSIGOd6d+o/Ryj3ZnYy7uZBOAfk9XcY/+Dq0zMhMxAlW karQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b="Kdx/3Gd+"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id si25si2411245ejb.431.2020.09.03.10.24.49; Thu, 03 Sep 2020 10:25:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b="Kdx/3Gd+"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbgICRYF (ORCPT + 99 others); Thu, 3 Sep 2020 13:24:05 -0400 Received: from mail2.candelatech.com ([208.74.158.173]:42250 "EHLO mail3.candelatech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbgICRYC (ORCPT ); Thu, 3 Sep 2020 13:24:02 -0400 Received: from ben-dt4.candelatech.com (50-251-239-81-static.hfc.comcastbusiness.net [50.251.239.81]) by mail3.candelatech.com (Postfix) with ESMTP id 37DD313C2B0; Thu, 3 Sep 2020 10:24:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com 37DD313C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1599153842; bh=DYRihOm0trFDBL9jAzUYYoS2AyyhAKLXSUkVK31L8qk=; h=From:To:Cc:Subject:Date:From; b=Kdx/3Gd+NzZH0P52SxgHfxQ+n3CM3b+7jhe6hLD1RTflNZ2TbIoDZYC1L6o2/Ma2B 5bTj/yP/pm6d9VEd6XjJnclSl8CggeuTfECTSv94gjH/RmdApDW8htP93QeHbQirJF h9VvMKj3ZGD0bJ0yYqwgNp16vkzPehPFbnuVSO84= From: greearb@candelatech.com To: ath11k@lists.infradead.org Cc: linux-wireless@vger.kernel.org, Ben Greear Subject: [PATCH] ath11k: Allow debugfs to work with 2+ radios installed. Date: Thu, 3 Sep 2020 10:23:59 -0700 Message-Id: <20200903172359.29199-1-greearb@candelatech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Ben Greear The code is trying to create an ath11k directory on debugfs root, but that fails when there is a second radio (and thus second instance of the driver). Work around this by finding a free name. This may fall into the HACK category, I'm not really sure what the original design is supposed to accomplish. Signed-off-by: Ben Greear --- NOTE: A second radio still does not get far enough to fully boot the NIC and create a phy* device, but at least system doesn't crash hard now. drivers/net/wireless/ath/ath11k/core.h | 5 +++-- drivers/net/wireless/ath/ath11k/debug.c | 23 ++++++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index bb22b41fefaa..858dfc700d54 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -707,8 +707,9 @@ struct ath11k_base { /* Current DFS Regulatory */ enum ath11k_dfs_region dfs_region; #ifdef CONFIG_ATH11K_DEBUGFS - struct dentry *debugfs_soc; - struct dentry *debugfs_ath11k; + struct dentry *debugfs_soc; /* child of debugfs_ath11k */ + char debugfs_ath11k_fname[36]; + struct dentry *debugfs_ath11k; /* per driver instance */ #endif struct ath11k_soc_dp_stats soc_stats; diff --git a/drivers/net/wireless/ath/ath11k/debug.c b/drivers/net/wireless/ath/ath11k/debug.c index 31978ef9144e..70b4c4837879 100644 --- a/drivers/net/wireless/ath/ath11k/debug.c +++ b/drivers/net/wireless/ath/ath11k/debug.c @@ -1011,15 +1011,24 @@ void ath11k_debug_pdev_destroy(struct ath11k_base *ab) int ath11k_debug_soc_create(struct ath11k_base *ab) { - ab->debugfs_ath11k = debugfs_create_dir("ath11k", NULL); + /* We need one of these per driver instance, try until we find an un-used name */ + int i; - if (IS_ERR_OR_NULL(ab->debugfs_ath11k)) { - if (IS_ERR(ab->debugfs_ath11k)) - return PTR_ERR(ab->debugfs_ath11k); - return -ENOMEM; + for (i = 0; i<99; i++) { + snprintf(ab->debugfs_ath11k_fname, sizeof(ab->debugfs_ath11k_fname), "ath11k-%d", i); + ab->debugfs_ath11k = debugfs_create_dir(ab->debugfs_ath11k_fname, NULL); + + if (!IS_ERR_OR_NULL(ab->debugfs_ath11k)) { + return 0; + } } - return 0; + /* Couldn't create one */ + ab->debugfs_ath11k_fname[0] = 0; + + if (IS_ERR(ab->debugfs_ath11k)) + return PTR_ERR(ab->debugfs_ath11k); + return -ENOMEM; } void ath11k_debug_soc_destroy(struct ath11k_base *ab) @@ -1228,7 +1237,7 @@ int ath11k_debug_register(struct ath11k *ar) } /* Create a symlink under ieee80211/phy* */ - snprintf(buf, 100, "../../ath11k/%pd2", ar->debug.debugfs_pdev); + snprintf(buf, 100, "../../%s/%pd2", ab->debugfs_ath11k_fname, ar->debug.debugfs_pdev); debugfs_create_symlink("ath11k", ar->hw->wiphy->debugfsdir, buf); ath11k_debug_htt_stats_init(ar); -- 2.26.2