• Kalle Valo's avatar
    wifi: ath11k: debugfs: fix to work with multiple PCI devices · 323d91d4
    Kalle Valo authored
    ath11k fails to load if there are multiple ath11k PCI devices with same name:
    
     ath11k_pci 0000:01:00.0: Hardware name qcn9074 hw1.0
     debugfs: Directory 'ath11k' with parent '/' already present!
     ath11k_pci 0000:01:00.0: failed to create ath11k debugfs
     ath11k_pci 0000:01:00.0: failed to create soc core: -17
     ath11k_pci 0000:01:00.0: failed to init core: -17
     ath11k_pci: probe of 0000:01:00.0 failed with error -17
    
    Fix this by creating a directory for each ath11k device using schema
    <bus>-<devname>, for example "pci-0000:06:00.0". This directory created under
    the top-level ath11k directory, for example /sys/kernel/debug/ath11k.
    
    The reference to the toplevel ath11k directory is not stored anymore within ath11k, instead
    it's retrieved using debugfs_lookup(). If the directory does not exist it will
    be created. After the last directory from the ath11k directory is removed, for
    example when doing rmmod ath11k, the empty ath11k directory is left in place,
    it's a minor cosmetic issue anyway.
    
    Here's an example hierarchy with one WCN6855:
    
    ath11k
    `-- pci-0000:06:00.0
        |-- mac0
        |   |-- dfs_block_radar_events
        |   |-- dfs_simulate_radar
        |   |-- ext_rx_stats
        |   |-- ext_tx_stats
        |   |-- fw_dbglog_config
        |   |-- fw_stats
        |   |   |-- beacon_stats
        |   |   |-- pdev_stats
        |   |   `-- vdev_stats
        |   |-- htt_stats
        |   |-- htt_stats_reset
        |   |-- htt_stats_type
        |   `-- pktlog_filter
        |-- simulate_fw_crash
        `-- soc_dp_stats
    
    I didn't have a test setup where I could connect multiple ath11k devices to the
    same the host, so I have only tested this with one device.
    
    Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.9
    Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
    Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
    Tested-by: default avatarRobert Marko <robert.marko@sartura.hr>
    Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
    Link: https://lore.kernel.org/r/20221220121231.20120-1-kvalo@kernel.org
    323d91d4
debugfs.c 47.7 KB