| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: ISC |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2010 Broadcom Corporation |
|---|
| 3 | | - * |
|---|
| 4 | | - * Permission to use, copy, modify, and/or distribute this software for any |
|---|
| 5 | | - * purpose with or without fee is hereby granted, provided that the above |
|---|
| 6 | | - * copyright notice and this permission notice appear in all copies. |
|---|
| 7 | | - * |
|---|
| 8 | | - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|---|
| 9 | | - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|---|
| 10 | | - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
|---|
| 11 | | - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|---|
| 12 | | - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
|---|
| 13 | | - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
|---|
| 14 | | - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|---|
| 15 | 4 | */ |
|---|
| 16 | 5 | |
|---|
| 17 | 6 | #ifndef BRCMFMAC_DEBUG_H |
|---|
| .. | .. |
|---|
| 45 | 34 | #undef pr_fmt |
|---|
| 46 | 35 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| 47 | 36 | |
|---|
| 48 | | -__printf(2, 3) |
|---|
| 49 | | -void __brcmf_err(const char *func, const char *fmt, ...); |
|---|
| 37 | +struct brcmf_bus; |
|---|
| 38 | + |
|---|
| 39 | +__printf(3, 4) |
|---|
| 40 | +void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...); |
|---|
| 50 | 41 | /* Macro for error messages. When debugging / tracing the driver all error |
|---|
| 51 | 42 | * messages are important to us. |
|---|
| 52 | 43 | */ |
|---|
| 44 | +#ifndef brcmf_err |
|---|
| 53 | 45 | #define brcmf_err(fmt, ...) \ |
|---|
| 54 | 46 | do { \ |
|---|
| 55 | 47 | if (IS_ENABLED(CONFIG_BRCMDBG) || \ |
|---|
| 56 | 48 | IS_ENABLED(CONFIG_BRCM_TRACING) || \ |
|---|
| 57 | 49 | net_ratelimit()) \ |
|---|
| 58 | | - __brcmf_err(__func__, fmt, ##__VA_ARGS__); \ |
|---|
| 50 | + __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\ |
|---|
| 51 | + } while (0) |
|---|
| 52 | +#endif |
|---|
| 53 | + |
|---|
| 54 | +#define bphy_err(drvr, fmt, ...) \ |
|---|
| 55 | + do { \ |
|---|
| 56 | + if (IS_ENABLED(CONFIG_BRCMDBG) || \ |
|---|
| 57 | + IS_ENABLED(CONFIG_BRCM_TRACING) || \ |
|---|
| 58 | + net_ratelimit()) \ |
|---|
| 59 | + wiphy_err((drvr)->wiphy, "%s: " fmt, __func__, \ |
|---|
| 60 | + ##__VA_ARGS__); \ |
|---|
| 59 | 61 | } while (0) |
|---|
| 60 | 62 | |
|---|
| 61 | 63 | #if defined(DEBUG) || defined(CONFIG_BRCM_TRACING) |
|---|
| .. | .. |
|---|
| 114 | 116 | struct brcmf_pub; |
|---|
| 115 | 117 | #ifdef DEBUG |
|---|
| 116 | 118 | struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr); |
|---|
| 117 | | -int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, |
|---|
| 118 | | - int (*read_fn)(struct seq_file *seq, void *data)); |
|---|
| 119 | +void brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, |
|---|
| 120 | + int (*read_fn)(struct seq_file *seq, void *data)); |
|---|
| 119 | 121 | int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, |
|---|
| 120 | 122 | size_t len); |
|---|
| 121 | 123 | #else |
|---|
| 122 | | -static inline |
|---|
| 123 | | -int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, |
|---|
| 124 | | - int (*read_fn)(struct seq_file *seq, void *data)) |
|---|
| 124 | +static inline struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) |
|---|
| 125 | 125 | { |
|---|
| 126 | | - return 0; |
|---|
| 126 | + return ERR_PTR(-ENOENT); |
|---|
| 127 | 127 | } |
|---|
| 128 | 128 | static inline |
|---|
| 129 | +void brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, |
|---|
| 130 | + int (*read_fn)(struct seq_file *seq, void *data)) |
|---|
| 131 | +{ } |
|---|
| 132 | +static inline |
|---|
| 129 | 133 | int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, |
|---|
| 130 | 134 | size_t len) |
|---|
| 131 | 135 | { |
|---|