.. | .. |
---|
836 | 836 | if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) |
---|
837 | 837 | return 0; |
---|
838 | 838 | |
---|
839 | | - ab->debugfs_soc = debugfs_create_dir(ab->hw_params.name, ab->debugfs_ath11k); |
---|
840 | | - if (IS_ERR(ab->debugfs_soc)) |
---|
841 | | - return PTR_ERR(ab->debugfs_soc); |
---|
842 | | - |
---|
843 | 839 | debugfs_create_file("simulate_fw_crash", 0600, ab->debugfs_soc, ab, |
---|
844 | 840 | &fops_simulate_fw_crash); |
---|
845 | 841 | |
---|
.. | .. |
---|
857 | 853 | |
---|
858 | 854 | int ath11k_debugfs_soc_create(struct ath11k_base *ab) |
---|
859 | 855 | { |
---|
860 | | - ab->debugfs_ath11k = debugfs_create_dir("ath11k", NULL); |
---|
| 856 | + struct dentry *root; |
---|
| 857 | + bool dput_needed; |
---|
| 858 | + char name[64]; |
---|
| 859 | + int ret; |
---|
861 | 860 | |
---|
862 | | - return PTR_ERR_OR_ZERO(ab->debugfs_ath11k); |
---|
| 861 | + root = debugfs_lookup("ath11k", NULL); |
---|
| 862 | + if (!root) { |
---|
| 863 | + root = debugfs_create_dir("ath11k", NULL); |
---|
| 864 | + if (IS_ERR_OR_NULL(root)) |
---|
| 865 | + return PTR_ERR(root); |
---|
| 866 | + |
---|
| 867 | + dput_needed = false; |
---|
| 868 | + } else { |
---|
| 869 | + /* a dentry from lookup() needs dput() after we don't use it */ |
---|
| 870 | + dput_needed = true; |
---|
| 871 | + } |
---|
| 872 | + |
---|
| 873 | + scnprintf(name, sizeof(name), "%s-%s", ath11k_bus_str(ab->hif.bus), |
---|
| 874 | + dev_name(ab->dev)); |
---|
| 875 | + |
---|
| 876 | + ab->debugfs_soc = debugfs_create_dir(name, root); |
---|
| 877 | + if (IS_ERR_OR_NULL(ab->debugfs_soc)) { |
---|
| 878 | + ret = PTR_ERR(ab->debugfs_soc); |
---|
| 879 | + goto out; |
---|
| 880 | + } |
---|
| 881 | + |
---|
| 882 | + ret = 0; |
---|
| 883 | + |
---|
| 884 | +out: |
---|
| 885 | + if (dput_needed) |
---|
| 886 | + dput(root); |
---|
| 887 | + |
---|
| 888 | + return ret; |
---|
863 | 889 | } |
---|
864 | 890 | |
---|
865 | 891 | void ath11k_debugfs_soc_destroy(struct ath11k_base *ab) |
---|
866 | 892 | { |
---|
867 | | - debugfs_remove_recursive(ab->debugfs_ath11k); |
---|
868 | | - ab->debugfs_ath11k = NULL; |
---|
| 893 | + debugfs_remove_recursive(ab->debugfs_soc); |
---|
| 894 | + ab->debugfs_soc = NULL; |
---|
| 895 | + |
---|
| 896 | + /* We are not removing ath11k directory on purpose, even if it |
---|
| 897 | + * would be empty. This simplifies the directory handling and it's |
---|
| 898 | + * a minor cosmetic issue to leave an empty ath11k directory to |
---|
| 899 | + * debugfs. |
---|
| 900 | + */ |
---|
869 | 901 | } |
---|
870 | 902 | |
---|
871 | 903 | void ath11k_debugfs_fw_stats_init(struct ath11k *ar) |
---|