brcmfmac: merge two brcmf_err macros into one
PATCH v3 1/9 brcmfmac: merge two brcmf_err macros into one
From: Rafał Miłecki <[email protected]>
This allows simplifying the code by adding a simple IS_ENABLED check for CONFIG_BRCMDB symbol.
---
V3: Re-add this patch (it was initially submited as RFC)
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +2 -6
@@ -45,20 +45,16 @@#undef pr_fmt#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#ifndef CONFIG_BRCM_TRACING /* Macro for error messages. net_ratelimit() is used when driver * debugging is not selected. When debugging the driver error * messages are as important as other tracing or even more so. */ -#ifndef CONFIG_BRCM_TRACING -#ifdef CONFIG_BRCMDBG -#define brcmf_err (fmt, ...) pr_err("%s: " fmt, __func__, ##__VA_ARGS__) -#else #define brcmf_err (fmt, ...) \ do { \ - if (net_ratelimit()) \ + if (IS_ENABLED(CONFIG_BRCMDBG) || net_ratelimit()) \ pr_err("%s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) -#endif #else __printf(2, 3)void __brcmf_err (const char *func,const char *fmt, ...);
Signature · 1 line
2.11.0
PATCH v3 2/9 brcmfmac: switch to C function (__brcmf_err) for printing errors
From: Rafał Miłecki <[email protected]>
This will allow extending code and using more detailed messages e.g. with the help of dev_err.
---
V3: Keep IS_ENABLED check in the macro as suggested by Felix
--- .../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 16 ++++++++++++++++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +16 -0
@@ -218,6 +218,22 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)return err; } +#ifndef CONFIG_BRCM_TRACING +void __brcmf_err (const char *func,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +va_start (args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; +pr_err ("%s: %pV" , func, &vaf); + +va_end (args); +} +#endif +#if defined(CONFIG_BRCM_TRACING ) || defined(CONFIG_BRCMDBG )void __brcmf_dbg (u32 level,const char *func,const char *fmt, ...) {
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +3 -3
@@ -45,6 +45,8 @@#undef pr_fmt#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +__printf(2, 3) +void __brcmf_err (const char *func,const char *fmt, ...);#ifndef CONFIG_BRCM_TRACING /* Macro for error messages. net_ratelimit() is used when driver * debugging is not selected. When debugging the driver error
@@ -53,11 +55,9 @@#define brcmf_err (fmt, ...) \ do { \ if (IS_ENABLED(CONFIG_BRCMDBG) || net_ratelimit()) \ - pr_err("%s: " fmt, __func__, ##__VA_ARGS__); \ + __brcmf_err(__func__, fmt, ##__VA_ARGS__); \ } while (0)#else -__printf(2, 3) -void __brcmf_err (const char *func,const char *fmt, ...);#define brcmf_err (fmt, ...) \ __brcmf_err(__func__, fmt, ##__VA_ARGS__)#endif
Signature · 1 line
2.11.0
Re: [PATCH V3 2/9] brcmfmac: switch to C function (__brcmf_err) for printing errors
Quoted 4 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This will allow extending code and using more detailed messages e.g. with the help of
dev_err.
Quoted 62 lines
Signed-off-by Rafał Miłecki <[email protected]>---
V3: KeepIS_ENABLEDcheck in the macro as suggested by Felix--- .../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 16 ++++++++++++++++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-)drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +16
-0@@ -218,6 +218,22 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)return err; } +#ifndef CONFIG_BRCM_TRACING +void __brcmf_err (const char *func,const char *fmt, ...) +{ +struct va_format vaf; +va_list args; + +va_start (args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; +pr_err ("%s: %pV" , func, &vaf); + +va_end (args); +} +#endif +#if defined(CONFIG_BRCM_TRACING ) || defined(CONFIG_BRCMDBG )void __brcmf_dbg (u32 level,const char *func,const char *fmt, ...) {drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +3
-3@@ -45,6 +45,8 @@#undef pr_fmt#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +__printf(2, 3) +void __brcmf_err (const char *func,const char *fmt, ...);#ifndef CONFIG_BRCM_TRACING /* Macro for error messages. net_ratelimit() is used when driver * debugging is not selected. When debugging the driver error @@ -53,11 +55,9 @@#define brcmf_err (fmt, ...) \ do { \ if (IS_ENABLED(CONFIG_BRCMDBG) || net_ratelimit()) \ - pr_err("%s: " fmt, __func__, ##__VA_ARGS__); \ + __brcmf_err(__func__, fmt, ##__VA_ARGS__); \ } while (0)#else -__printf(2, 3) -void __brcmf_err (const char *func,const char *fmt, ...);#define brcmf_err (fmt, ...) \ __brcmf_err(__func__, fmt, ##__VA_ARGS__)#endif
PATCH v3 3/9 brcmfmac: merge two remaining brcmf_err macros
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
Now we always have __brcmf_err function we can do perfectly fine with just one macro.
---
V3: Add this (new) patch
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +5 -9
@@ -47,20 +47,16 @@ __printf(2, 3)void __brcmf_err (const char *func,const char *fmt, ...); -#ifndef CONFIG_BRCM_TRACING -/* Macro for error messages. net_ratelimit() is used when driver -* debugging is not selected. When debugging the driver error -* messages are as important as other tracing or even more so. +/* Macro for error messages. When debugging / tracing the driver all error +* messages are important to us. */ #define brcmf_err (fmt, ...) \ do { \ - if (IS_ENABLED(CONFIG_BRCMDBG) || net_ratelimit()) \ + if (IS_ENABLED(CONFIG_BRCMDBG) || \ + IS_ENABLED(CONFIG_BRCM_TRACING) || \ + net_ratelimit()) \ __brcmf_err(__func__, fmt, ##__VA_ARGS__); \ } while (0) -#else -#define brcmf_err (fmt, ...) \ - __brcmf_err(__func__, fmt, ##__VA_ARGS__) -#endif #if defined(DEBUG ) || defined(CONFIG_BRCM_TRACING )__printf (3 ,4 )
Signature · 1 line
2.11.0
Re: [PATCH V3 3/9] brcmfmac: merge two remaining brcmf_err macros
Quoted 4 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
Now we always have
__brcmf_errfunction we can do perfectly fine with just one macro.
Quoted 38 lines
Signed-off-by Rafał Miłecki <[email protected]>---
V3: Add this (new) patch--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +5
-9@@ -47,20 +47,16 @@ __printf(2, 3)void __brcmf_err (const char *func,const char *fmt, ...); -#ifndef CONFIG_BRCM_TRACING -/* Macro for error messages. net_ratelimit() is used when driver -* debugging is not selected. When debugging the driver error -* messages are as important as other tracing or even more so. +/* Macro for error messages. When debugging / tracing the driver all error +* messages are important to us. */ #define brcmf_err (fmt, ...) \ do { \ - if (IS_ENABLED(CONFIG_BRCMDBG) || net_ratelimit()) \ + if (IS_ENABLED(CONFIG_BRCMDBG) || \ + IS_ENABLED(CONFIG_BRCM_TRACING) || \ + net_ratelimit()) \ __brcmf_err(__func__, fmt, ##__VA_ARGS__); \ } while (0) -#else -#define brcmf_err (fmt, ...) \ - __brcmf_err(__func__, fmt, ##__VA_ARGS__) -#endif #if defined(DEBUG ) || defined(CONFIG_BRCM_TRACING )__printf (3 ,4 )
PATCH v3 4/9 brcmfmac: add struct brcmf_pub parameter to the __brcmf_err
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
This will allow getting struct device reference from the passed brcmf_pub for the needs of dev_err. More detailed messages are really important for home routers which frequently have 2 (or even 3) wireless cards supported by brcmfmac.
Note that all calls are yet to be updated as for now brcmf_err macro always passes NULL. This will be handled in following patch to make this change easier to review.
---
V2: Add missing include
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 ++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 9 +++++---- drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 4 +++- 4 files changed, 11 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +2 -0
@@ -17,6 +17,8 @@#ifndef BRCMFMAC_BUS_H #define BRCMFMAC_BUS_H +#include <linux/device.h> +#include "debug.h" /* IDs of the 6 default common rings of msgbuf protocol */
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +1 -1
@@ -219,7 +219,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) }#ifndef CONFIG_BRCM_TRACING -void __brcmf_err (const char *func,const char *fmt, ...) +void __brcmf_err (struct brcmf_pub *pub,const char *func,const char *fmt, ...) {struct va_format vaf;va_list args;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +5 -4
@@ -19,6 +19,8 @@#include <linux/net.h> /* net_ratelimit() */ +struct brcmf_pub ; +/* message levels */ #define BRCMF_TRACE_VAL 0x00000002#define BRCMF_INFO_VAL 0x00000004
@@ -45,8 +47,8 @@#undef pr_fmt#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -__printf(2, 3) -void __brcmf_err (const char *func,const char *fmt, ...); +__printf(3, 4) +void __brcmf_err (struct brcmf_pub *pub,const char *func,const char *fmt, ...);/* Macro for error messages. When debugging / tracing the driver all error * messages are important to us. */
@@ -55,7 +57,7 @@ void __brcmf_err(const char *func, const char *fmt, ...);if (IS_ENABLED (CONFIG_BRCMDBG ) || \IS_ENABLED (CONFIG_BRCM_TRACING ) || \net_ratelimit ()) \ - __brcmf_err(__func__, fmt, ##__VA_ARGS__); \ + __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\ } while (0)#if defined(DEBUG ) || defined(CONFIG_BRCM_TRACING )
@@ -99,7 +101,6 @@ do { \extern int brcmf_msg_level; -struct brcmf_pub ;#ifdef DEBUG void brcmf_debugfs_init (void );void brcmf_debugfs_exit (void );
drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c +3 -1
@@ -18,10 +18,12 @@ #ifndef __CHECKER__ #define CREATE_TRACE_POINTS +#include "bus.h" +#include "core.h" #include "tracepoint.h" #include "debug.h" -void __brcmf_err(const char *func, const char *fmt, ...) +void __brcmf_err(struct brcmf_pub *pub, const char *func, const char *fmt, ...) { struct va_format vaf = { .fmt = fmt,
Signature · 1 line
2.11.0
Arend Van Spriel
maintainerRe: [PATCH V3 4/9] brcmfmac: add struct brcmf_pub parameter to the __brcmf_err
Quoted 10 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This will allow getting struct device reference from the passed
brcmf_pubfor the needs ofdev_err. More detailed messages are really important for home routers which frequently have 2 (or even 3) wireless cards supported by brcmfmac.Note that all calls are yet to be updated as for now
brcmf_errmacro always passes NULL. This will be handled in following patch to make this change easier to review.
I prefer brcmf_err() to have struct device reference directly instead of using brcmf_pub. That would remove the need for patches 5 till 7 as bus specific code already has struct device. So I have acked the first three patches, but would like to revise 8 and 9.
Kalle,
I acked the first three patches. Can those three still go in for 4.11?
Regards,
Arend
Quoted 96 lines
Signed-off-by Rafał Miłecki <[email protected]>---
V2: Add missing include--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 2 ++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 9 +++++---- drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 4 +++- 4 files changed, 11 insertions(+), 6 deletions(-)drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +2
-0@@ -17,6 +17,8 @@#ifndef BRCMFMAC_BUS_H #define BRCMFMAC_BUS_H +#include <linux/device.h> +#include "debug.h" /* IDs of the 6 default common rings of msgbuf protocol */ drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +1
-1@@ -219,7 +219,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) }#ifndef CONFIG_BRCM_TRACING -void __brcmf_err (const char *func,const char *fmt, ...) +void __brcmf_err (struct brcmf_pub *pub,const char *func,const char *fmt, ...) {struct va_format vaf;va_list args;drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +5
-4@@ -19,6 +19,8 @@#include <linux/net.h> /* net_ratelimit() */ +struct brcmf_pub ; +/* message levels */ #define BRCMF_TRACE_VAL 0x00000002#define BRCMF_INFO_VAL 0x00000004@@ -45,8 +47,8 @@#undef pr_fmt#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -__printf(2, 3) -void __brcmf_err (const char *func,const char *fmt, ...); +__printf(3, 4) +void __brcmf_err (struct brcmf_pub *pub,const char *func,const char *fmt, ...);/* Macro for error messages. When debugging / tracing the driver all error * messages are important to us. */ @@ -55,7 +57,7 @@ void __brcmf_err(const char *func, const char *fmt, ...);if (IS_ENABLED (CONFIG_BRCMDBG ) || \IS_ENABLED (CONFIG_BRCM_TRACING ) || \net_ratelimit ()) \ - __brcmf_err(__func__, fmt, ##__VA_ARGS__); \ + __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\ } while (0)#if defined(DEBUG ) || defined(CONFIG_BRCM_TRACING )@@ -99,7 +101,6 @@ do { \extern int brcmf_msg_level; -struct brcmf_pub ;#ifdef DEBUG void brcmf_debugfs_init (void );void brcmf_debugfs_exit (void );drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c +3
-1@@ -18,10 +18,12 @@ #ifndef __CHECKER__ #define CREATE_TRACE_POINTS +#include "bus.h" +#include "core.h" #include "tracepoint.h" #include "debug.h" -void __brcmf_err(const char *func, const char *fmt, ...) +void __brcmf_err(struct brcmf_pub *pub, const char *func, const char *fmt, ...) { struct va_format vaf = { .fmt = fmt,
Re: [PATCH V3 4/9] brcmfmac: add struct brcmf_pub parameter to the __brcmf_err
Quoted 12 lines · Arend Van Spriel
Quoted 10 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This will allow getting struct device reference from the passed
brcmf_pubfor the needs ofdev_err. More detailed messages are really important for home routers which frequently have 2 (or even 3) wireless cards supported by brcmfmac.Note that all calls are yet to be updated as for now
brcmf_errmacro always passes NULL. This will be handled in following patch to make this change easier to review.
Quoted 8 lines
I prefer
brcmf_err()to have struct device reference directly instead of usingbrcmf_pub. That would remove the need for patches 5 till 7 as bus specific code already has struct device. So I have acked the first three patches, but would like to revise 8 and 9.Kalle,
I acked the first three patches. Can those three still go in for 4.11?
Sounds OK to me. Kalle, I ack Arend's request if it isn't too late.
Re: [PATCH V3 4/9] brcmfmac: add struct brcmf_pub parameter to the __brcmf_err
Quoted 22 lines · Rafa=C5=82 Mi=C5=82ecki <[email protected]> writes:
Quoted 21 lines · Arend Van Spriel
Quoted 8 lines · On 2-2-2017 22:33, Rafa=C5=82 Mi=C5=82ecki wrote:
From: Rafa=C5=82 Mi=C5=82ecki <[email protected]>
This will allow getting struct device reference from the passed
brcmf_pubfor the needs ofdev_err. More detailed messages are really important for home routers which frequently have 2 (or even 3) wireless
cards supported by brcmfmac.Quoted 4 lines
Note that all calls are yet to be updated as for now
brcmf_errmacro always passes NULL. This will be handled in following patch to make this
change easier to review.I prefer
brcmf_err()to have struct device reference directly instead of
usingbrcmf_pub. That would remove the need for patches 5 till 7 as bus specific code already has struct device. So I have acked the first three
patches, but would like to revise 8 and 9.
Quoted 5 lines
Quoted 3 lines
Kalle,
I acked the first three patches. Can those three still go in for 4.11?
Sounds OK to me. Kalle, I ack Arend's request if it isn't too late.
Ok, I'll try. My plan is to get everything ready for linux-next by tomorrow morning (Finland time), let's see how it goes.
Related to this, Rafa=C5=82 are you still deleting the patches from patchwo= rk
which should be dropped? I think you are as I can't see patches 4-9 anymore.
Now that my patchwork setup is much better (compared to how it was over a year ago) I would actually prefer that you don't do that anymore. The problem is that when you delete the patch from patchwork it completely disappears from patchwork and I can't check the patch or discussion anymore. And I'm so accustomed to use patchwork that only seldom I use email to find the patch.
So it would be better to leave the patches as is and let me drop them (=3Dchange the state Changes Requested, Rejected or similar), which is trivial with my script. Otherwise I get this unsure feeling of what happened to the patch :)
--=20
Kalle Valo
Re: [PATCH V3 4/9] brcmfmac: add struct brcmf_pub parameter to the __brcmf_err
Quoted 44 lines · Kalle Valo
Quoted 22 lines · Rafał Miłecki
Quoted 21 lines · Arend Van Spriel
Quoted 8 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This will allow getting struct device reference from the passed
brcmf_pubfor the needs ofdev_err. More detailed messages are really important for home routers which frequently have 2 (or even 3) wireless
cards supported by brcmfmac.Quoted 4 lines
Note that all calls are yet to be updated as for now
brcmf_errmacro always passes NULL. This will be handled in following patch to make this
change easier to review.I prefer
brcmf_err()to have struct device reference directly instead of
usingbrcmf_pub. That would remove the need for patches 5 till 7 as bus specific code already has struct device. So I have acked the first three
patches, but would like to revise 8 and 9.Quoted 5 lines
Quoted 3 lines
Kalle,
I acked the first three patches. Can those three still go in for 4.11?
Sounds OK to me. Kalle, I ack Arend's request if it isn't too late.
Ok, I'll try. My plan is to get everything ready for linux-next by tomorrow morning (Finland time), let's see how it goes.
Related to this, Rafał are you still deleting the patches from patchwork which should be dropped? I think you are as I can't see patches 4-9 anymore.
Now that my patchwork setup is much better (compared to how it was over a year ago) I would actually prefer that you don't do that anymore. The problem is that when you delete the patch from patchwork it completely disappears from patchwork and I can't check the patch or discussion anymore. And I'm so accustomed to use patchwork that only seldom I use email to find the patch.
Quoted 4 lines
So it would be better to leave the patches as is and let me drop them (=change the state Changes Requested, Rejected or similar), which is trivial with my script. Otherwise I get this unsure feeling of what happened to the patch :)
Yeah, that was me (marked 4-9 as Changes Requested), sorry ;) I won't be messing with patches in the future.
Re: [PATCH V3 4/9] brcmfmac: add struct brcmf_pub parameter to the __brcmf_err
In reply to Arend Van SprielQuoted 8 lines · Arend Van Spriel
Quoted 7 lines · On 2-2-2017 22:33, Rafa=C5=82 Mi=C5=82ecki wrote:
From: Rafa=C5=82 Mi=C5=82ecki <[email protected]>
This will allow getting struct device reference from the passed
brcmf_pubfor the needs ofdev_err. More detailed messages are really important for home routers which frequently have 2 (or even 3) wireless cards supported by brcmfmac.
Quoted 8 lines
Quoted 3 lines
Note that all calls are yet to be updated as for now
brcmf_errmacro always passes NULL. This will be handled in following patch to make this change easier to review.I prefer
brcmf_err()to have struct device reference directly instead of usingbrcmf_pub. That would remove the need for patches 5 till 7 as bus specific code already has struct device. So I have acked the first three patches, but would like to revise 8 and 9.
I'm a bit disappointed as this change of mind means I wasted quite some time by reworking all brcmf_err calls :(
I intentionally sent
[PATCH RFC 2/2] brcmfmac: add brcmf_err_pub macro for better error messages 2 weeks before the final patch, to make sure my design is alright & can be accepted :(
I'll work on another version of this patch & will send it as early RFC.
--=20
Rafa=C5=82
Re: [PATCH V3 4/9] brcmfmac: add struct brcmf_pub parameter to the __brcmf_err
In reply to Arend Van SprielHey Arend,
Quoted 8 lines · Arend Van Spriel
Quoted 7 lines · On 2-2-2017 22:33, Rafa=C5=82 Mi=C5=82ecki wrote:
From: Rafa=C5=82 Mi=C5=82ecki <[email protected]>
This will allow getting struct device reference from the passed
brcmf_pubfor the needs ofdev_err. More detailed messages are really important for home routers which frequently have 2 (or even 3) wireless cards supported by brcmfmac.
Quoted 8 lines
Quoted 3 lines
Note that all calls are yet to be updated as for now
brcmf_errmacro always passes NULL. This will be handled in following patch to make this change easier to review.I prefer
brcmf_err()to have struct device reference directly instead of usingbrcmf_pub. That would remove the need for patches 5 till 7 as bus specific code already has struct device. So I have acked the first three patches, but would like to revise 8 and 9.
I wanted to have some better perspective so I analyzed few upstream Linux wireless drivers. It seems to be a pretty common pattern to have one struct describing hardware that gets passed across the whole driver. This way you can access any important info from any place of the driver & some will probably say it also simplifies a driver.
For example following drivers use following struct in almost every part of their code (across multiple files):
ath9k: struct ath_hw
ath10k: struct ath10k
iwlmvm: struct iwl_mvm
mt7601u: struct mt7601u_dev
mwifiex: struct mwifiex_private
rt2x00: struct rt2x00_dev
The most common / generic struct I found in brcmfmac was struct brcmf_pub. That's why I tried to use it for the commonly used brcmf_err.
What's the reason for hiding this struct from few random parts of the code? Is there any real gain from this?
--=20
Rafa=C5=82
Arend Van Spriel
maintainerRe: [PATCH V3 4/9] brcmfmac: add struct brcmf_pub parameter to the __brcmf_err
Quoted 36 lines · Rafał Miłecki
Hey Arend,
Quoted 8 lines · Arend Van Spriel
Quoted 7 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This will allow getting struct device reference from the passed
brcmf_pubfor the needs ofdev_err. More detailed messages are really important for home routers which frequently have 2 (or even 3) wireless cards supported by brcmfmac.Quoted 8 lines
Quoted 3 lines
Note that all calls are yet to be updated as for now
brcmf_errmacro always passes NULL. This will be handled in following patch to make this change easier to review.I prefer
brcmf_err()to have struct device reference directly instead of usingbrcmf_pub. That would remove the need for patches 5 till 7 as bus specific code already has struct device. So I have acked the first three patches, but would like to revise 8 and 9.I wanted to have some better perspective so I analyzed few upstream Linux wireless drivers. It seems to be a pretty common pattern to have one struct describing hardware that gets passed across the whole driver. This way you can access any important info from any place of the driver & some will probably say it also simplifies a driver.
For example following drivers use following struct in almost every part of their code (across multiple files):
ath9k: structath_hw
ath10k: struct ath10k
iwlmvm: structiwl_mvm
mt7601u: structmt7601u_dev
mwifiex: structmwifiex_private
rt2x00: structrt2x00_dev
Quoted 6 lines
The most common / generic struct I found in brcmfmac was struct
brcmf_pub. That's why I tried to use it for the commonly usedbrcmf_err.What's the reason for hiding this struct from few random parts of the code? Is there any real gain from this?
Hi Rafał,
Time flies when you are ... well, me apparently. I realized I did not get back on this and looked at it myself. In brcmfmac we have layering with a common layer and bus specific layer. The interface between those layers is in bus.h, ie. struct brcmf_bus which holds reference to struct device. So I would think using struct brcmf_bus in brcmf_err() would be best fit. I also looked at doing some type introspection using __builtin_types_compatible_p() which is built-in function available in both GCC and Clang. Might be worth exploring.
Regards,
Arend
PATCH v3 5/9 brcmfmac: pcie: store private pointer to struct brcmf_pub
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
Getting this pointer in PCIe code is not trivial and requires using dev_get_drvdata helper which adds extra line of code. Having access to this struct is useful for using generic stuff and e.g. improving logging messages.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +7 -2
@@ -265,6 +265,7 @@ struct brcmf_pciedev_info {void (*write_ptr)(struct brcmf_pciedev_info *devinfo,u32 mem_offset,u16 value);struct brcmf_mp_device *settings; +struct brcmf_pub *pub; };struct brcmf_pcie_ringbuf {
@@ -1564,14 +1565,18 @@ static void brcmf_pcie_release_resource(struct brcmf_pciedev_info *devinfo)static int brcmf_pcie_attach_bus (struct brcmf_pciedev_info *devinfo) { +struct device *dev = &devinfo->pdev->dev; +struct brcmf_bus *bus =dev_get_drvdata (dev);int ret;/* Attach to the common driver interface */ - ret =brcmf_attach (&devinfo->pdev->dev, devinfo->settings); + ret =brcmf_attach (dev, devinfo->settings);if (ret) {brcmf_err ("brcmf_attach failed\n" ); }else { - ret =brcmf_bus_started (&devinfo->pdev->dev); + devinfo->pub = bus->drvr; + + ret =brcmf_bus_started (dev);if (ret)brcmf_err ("dongle is not responding\n" ); }
Signature · 1 line
2.11.0
Arend Van Spriel
maintainerRe: [PATCH V3 5/9] brcmfmac: pcie: store private pointer to struct brcmf_pub
Quoted 6 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
Getting this pointer in PCIe code is not trivial and requires using
dev_get_drvdatahelper which adds extra line of code. Having access to this struct is useful for using generic stuff and e.g. improving logging messages.
It is actually by design that getting the pointer is not trivial. We have made an effort to use struct device pointer as handle between common and bus-specific code. So I have some reservations about the approach in this patch series. I had a few days off so I want to look at it in more detail tomorrow and probably give it a spin.
Regards,
Arend
Quoted 39 lines
Signed-off-by Rafał Miłecki <[email protected]>--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +7
-2@@ -265,6 +265,7 @@ struct brcmf_pciedev_info {void (*write_ptr)(struct brcmf_pciedev_info *devinfo,u32 mem_offset,u16 value);struct brcmf_mp_device *settings; +struct brcmf_pub *pub; };struct brcmf_pcie_ringbuf {@@ -1564,14 +1565,18 @@ static void brcmf_pcie_release_resource(struct brcmf_pciedev_info *devinfo)static int brcmf_pcie_attach_bus (struct brcmf_pciedev_info *devinfo) { +struct device *dev = &devinfo->pdev->dev; +struct brcmf_bus *bus =dev_get_drvdata (dev);int ret;/* Attach to the common driver interface */ - ret =brcmf_attach (&devinfo->pdev->dev, devinfo->settings); + ret =brcmf_attach (dev, devinfo->settings);if (ret) {brcmf_err ("brcmf_attach failed\n" ); }else { - ret =brcmf_bus_started (&devinfo->pdev->dev); + devinfo->pub = bus->drvr; + + ret =brcmf_bus_started (dev);if (ret)brcmf_err ("dongle is not responding\n" ); }
PATCH v3 6/9 brcmfmac: usb: store private pointer to struct brcmf_pub
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
Having access to this struct is useful for using generic stuff and e.g. improving logging messages.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +8 -4
@@ -174,6 +174,7 @@ struct brcmf_usbdev_info {bool wowl_enabled;struct brcmf_mp_device *settings; +struct brcmf_pub *pub; }; static void brcmf_usb_rx_refill(struct brcmf_usbdev_info *devinfo,
@@ -1135,26 +1136,29 @@ static const struct brcmf_bus_ops brcmf_usb_bus_ops = {static int brcmf_usb_bus_setup (struct brcmf_usbdev_info *devinfo) { +struct device *dev = devinfo->dev; +struct brcmf_bus *bus =dev_get_drvdata (dev);int ret;/* Attach to the common driver interface */ - ret =brcmf_attach (devinfo->dev, devinfo->settings); + ret =brcmf_attach (dev, devinfo->settings);if (ret) {brcmf_err ("brcmf_attach failed\n" );return ret; } + devinfo->pub = bus->drvr; - ret =brcmf_usb_up (devinfo->dev); + ret =brcmf_usb_up (dev);if (ret) goto fail; - ret =brcmf_bus_started (devinfo->dev); + ret =brcmf_bus_started (dev);if (ret) goto fail;return 0 ; fail: -brcmf_detach (devinfo->dev); +brcmf_detach (dev);return ret; }
Signature · 1 line
2.11.0
PATCH v3 7/9 brcmfmac: sdio: store private pointer to struct brcmf_pub
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
Having access to this struct is useful for using generic stuff and e.g. improving logging messages.
---
V2: Add this (new) patch
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +2 -0
@@ -434,6 +434,7 @@ struct brcmf_sdio_count {struct brcmf_sdio {struct brcmf_sdio_dev *sdiodev;/* sdio device handler */ struct brcmf_chip *ci;/* Chip info struct */ +struct brcmf_pub *pub;/* Bus generic struct */ u32 hostintmask;/* Copy of Host Interrupt Mask */ atomic_t intstatus;/* Intstatus bits (events) pending */
@@ -4155,6 +4156,7 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)brcmf_err ("brcmf_attach failed\n" ); goto fail; } + bus->pub = sdiodev->bus_if->drvr;/* allocate scatter-gather table. sg support * will be disabled upon allocation failure.
Signature · 1 line
2.11.0
PATCH v3 8/9 brcmfmac: modify all brcmf_err calls adding struct brcmf_pub
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
This finally allows getting extra info from struct brcmf_pub in the brcmf_err and improving error messages. In places where pub struct is not available or hard to obtain NULL is passed instead. Few of these cases could be improved in the future by adding more arguments to various functions.
---
V2: Rebase on the latest tree
Fix pub variable usage in brcmf_cfg80211_vndr_cmds_dcmd_handler
Simplify sdio code thanks to [PATCH V2 5/7] brcmfmac: sdio: store private pointer to struct brcmf_pub
--- .../wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 10 +- .../wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 49 ++- .../wireless/broadcom/brcm80211/brcmfmac/btcoex.c | 5 +- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 452 ++++++++++++--------- .../wireless/broadcom/brcm80211/brcmfmac/chip.c | 26 +- .../wireless/broadcom/brcm80211/brcmfmac/common.c | 22 +- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 45 +- .../wireless/broadcom/brcm80211/brcmfmac/debug.c | 5 +- .../wireless/broadcom/brcm80211/brcmfmac/debug.h | 4 +- .../broadcom/brcm80211/brcmfmac/firmware.c | 2 +- .../broadcom/brcm80211/brcmfmac/flowring.c | 2 +- .../wireless/broadcom/brcm80211/brcmfmac/fweh.c | 16 +- .../wireless/broadcom/brcm80211/brcmfmac/fwil.c | 12 +- .../broadcom/brcm80211/brcmfmac/fwsignal.c | 43 +- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 58 +-- .../net/wireless/broadcom/brcm80211/brcmfmac/of.c | 2 +- .../net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 80 ++-- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 42 +- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 20 +- .../wireless/broadcom/brcm80211/brcmfmac/proto.c | 4 +- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 213 +++++----- .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 70 ++-- .../wireless/broadcom/brcm80211/brcmfmac/vendor.c | 17 +- 23 files changed, 692 insertions(+), 507 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +5 -5
@@ -169,7 +169,7 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, ret =brcmf_proto_bcdc_msg (drvr, ifidx, cmd, buf, len, false);if (ret <0 ) { -brcmf_err ("brcmf_proto_bcdc_msg failed w/status %d\n" , +brcmf_err (drvr,"brcmf_proto_bcdc_msg failed w/status %d\n" , ret); goto done; }
@@ -186,7 +186,7 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,if ((id < bcdc->reqid) && (++retries <RETRIES )) goto retry;if (id != bcdc->reqid) { -brcmf_err ("%s: unexpected request id %d (expected %d)\n" , +brcmf_err (drvr,"%s: unexpected request id %d (expected %d)\n" ,brcmf_ifname (brcmf_get_ifp (drvr, ifidx)), id, bcdc->reqid); ret = -EINVAL ;
@@ -234,7 +234,7 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd, id = (flags &BCDC_DCMD_ID_MASK ) >>BCDC_DCMD_ID_SHIFT ;if (id != bcdc->reqid) { -brcmf_err ("%s: unexpected request id %d (expected %d)\n" , +brcmf_err (drvr,"%s: unexpected request id %d (expected %d)\n" ,brcmf_ifname (brcmf_get_ifp (drvr, ifidx)), id, bcdc->reqid); ret = -EINVAL ;
@@ -299,7 +299,7 @@ brcmf_proto_bcdc_hdrpull(struct brcmf_pub *drvr, bool do_fws, }if (((h->flags &BCDC_FLAG_VER_MASK ) >>BCDC_FLAG_VER_SHIFT ) !=BCDC_PROTO_VER ) { -brcmf_err ("%s: non-BCDC packet received, flags 0x%x\n" , +brcmf_err (drvr,"%s: non-BCDC packet received, flags 0x%x\n" ,brcmf_ifname (tmp_if), h->flags);return -EBADE ; }
@@ -379,7 +379,7 @@ int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr)/* ensure that the msg buf directly follows the cdc msg struct */ if ((unsigned long )(&bcdc->msg +1 ) != (unsigned long )bcdc->buf) { -brcmf_err ("struct brcmf_proto_bcdc is not correctly defined\n" ); +brcmf_err (drvr,"struct brcmf_proto_bcdc is not correctly defined\n" ); goto fail; }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +30 -19
227 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/btcoex.c +3 -2
@@ -215,7 +215,7 @@ static bool brcmf_btcoex_is_sco_active(struct brcmf_if *ifp) ioc_res =brcmf_btcoex_params_read (ifp,27 , ¶m27);if (ioc_res <0 ) { -brcmf_err ("ioc read btc params error\n" ); +brcmf_err (ifp->drvr,"ioc read btc params error\n" );break ; }
@@ -345,7 +345,8 @@ static void brcmf_btcoex_handler(struct work_struct *work) goto idle;default : -brcmf_err ("invalid state=%d !!!\n" , btci->bt_state); +brcmf_err (btci->cfg->pub,"invalid state=%d !!!\n" , + btci->bt_state); goto idle; }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +264 -188
1,886 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c +13 -13
@@ -313,7 +313,7 @@ static void brcmf_chip_sb_coredisable(struct brcmf_core_priv *core, val = ci->ops->read32 (ci->ctx,CORE_SB (base, sbtmstatehigh));if (val &SSB_TMSHIGH_BUSY ) -brcmf_err ("core state still busy\n" ); +brcmf_err (NULL ,"core state still busy\n" ); val = ci->ops->read32 (ci->ctx,CORE_SB (base, sbidlow));if (val &SSB_IDLOW_INITIATOR ) {
@@ -526,12 +526,12 @@ static int brcmf_chip_cores_check(struct brcmf_chip_priv *ci) }if (!cpu_found) { -brcmf_err ("CPU core not detected\n" ); +brcmf_err (NULL ,"CPU core not detected\n" );return -ENXIO ; }/* check RAM core presence for ARM CM3 core */ if (need_socram && !has_socram) { -brcmf_err ("RAM core not provided with ARM CM3 core\n" ); +brcmf_err (NULL ,"RAM core not provided with ARM CM3 core\n" );return -ENODEV ; }return 0 ;
@@ -691,7 +691,7 @@ static u32 brcmf_chip_tcm_rambase(struct brcmf_chip_priv *ci)case BRCM_CC_4366_CHIP_ID :return 0x200000 ;default : -brcmf_err ("unknown chip: %s\n" , ci->pub.name); +brcmf_err (NULL ,"unknown chip: %s\n" , ci->pub.name);break ; }return 0 ;
@@ -708,7 +708,7 @@ static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci) ci->pub.ramsize =brcmf_chip_tcm_ramsize (mem_core); ci->pub.rambase =brcmf_chip_tcm_rambase (ci);if (!ci->pub.rambase) { -brcmf_err ("RAM base not provided with ARM CR4 core\n" ); +brcmf_err (NULL ,"RAM base not provided with ARM CR4 core\n" );return -EINVAL ; } }else {
@@ -719,14 +719,14 @@ static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci) ci->pub.ramsize =brcmf_chip_sysmem_ramsize (mem_core); ci->pub.rambase =brcmf_chip_tcm_rambase (ci);if (!ci->pub.rambase) { -brcmf_err ("RAM base not provided with ARM CA7 core\n" ); +brcmf_err (NULL ,"RAM base not provided with ARM CA7 core\n" );return -EINVAL ; } }else { mem =brcmf_chip_get_core (&ci->pub,BCMA_CORE_INTERNAL_MEM );if (!mem) { -brcmf_err ("No memory cores found\n" ); +brcmf_err (NULL ,"No memory cores found\n" );return -ENOMEM ; } mem_core = container_of(mem, struct brcmf_core_priv,
@@ -740,12 +740,12 @@ static int brcmf_chip_get_raminfo(struct brcmf_chip_priv *ci) ci->pub.srsize, ci->pub.srsize);if (!ci->pub.ramsize) { -brcmf_err ("RAM size is undetermined\n" ); +brcmf_err (NULL ,"RAM size is undetermined\n" );return -ENOMEM ; }if (ci->pub.ramsize >BRCMF_CHIP_MAX_MEMSIZE ) { -brcmf_err ("RAM size is incorrect\n" ); +brcmf_err (NULL ,"RAM size is incorrect\n" );return -ENOMEM ; }
@@ -929,7 +929,7 @@ static int brcmf_chip_recognition(struct brcmf_chip_priv *ci)if (socitype ==SOCI_SB ) {if (ci->pub.chip !=BRCM_CC_4329_CHIP_ID ) { -brcmf_err ("SB chip is not supported\n" ); +brcmf_err (NULL ,"SB chip is not supported\n" );return -ENODEV ; } ci->iscoreup = brcmf_chip_sb_iscoreup;
@@ -958,7 +958,7 @@ static int brcmf_chip_recognition(struct brcmf_chip_priv *ci)brcmf_chip_dmp_erom_scan (ci); }else { -brcmf_err ("chip backplane type %u is not supported\n" , +brcmf_err (NULL ,"chip backplane type %u is not supported\n" , socitype);return -ENODEV ; }
@@ -1007,7 +1007,7 @@ static void brcmf_chip_disable_arm(struct brcmf_chip_priv *chip, u16 id) ARMCR4_BCMA_IOCTL_CPUHALT);break ;default : -brcmf_err ("unknown id: %u\n" , id); +brcmf_err (NULL ,"unknown id: %u\n" , id);break ; } }
@@ -1206,7 +1206,7 @@ static bool brcmf_chip_cm3_set_active(struct brcmf_chip_priv *chip) core =brcmf_chip_get_core (&chip->pub,BCMA_CORE_INTERNAL_MEM );if (!brcmf_chip_iscoreup (core)) { -brcmf_err ("SOCRAM core is down after reset?\n" ); +brcmf_err (NULL ,"SOCRAM core is down after reset?\n" );return false; }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +12 -10
@@ -86,6 +86,7 @@ struct brcmf_mp_global_t brcmf_mp_global;void brcmf_c_set_joinpref_default (struct brcmf_if *ifp) {struct brcmf_join_pref_params join_pref_params[2 ]; +struct brcmf_pub *pub = ifp->drvr;int err;/* Setup join_pref to select target by RSSI (boost on 5GHz) */
@@ -101,13 +102,14 @@ void brcmf_c_set_joinpref_default(struct brcmf_if *ifp) err =brcmf_fil_iovar_data_set (ifp,"join_pref" , join_pref_params,sizeof (join_pref_params));if (err) -brcmf_err ("Set join_pref error (%d)\n" , err); +brcmf_err (pub,"Set join_pref error (%d)\n" , err); }int brcmf_c_preinit_dcmds (struct brcmf_if *ifp) {s8 eventmask[BRCMF_EVENTING_MASK_LEN ];u8 buf[BRCMF_DCMD_SMLEN ]; +struct brcmf_pub *pub = ifp->drvr;struct brcmf_rev_info_le revinfo;struct brcmf_rev_info *ri;char *ptr;
@@ -117,7 +119,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) err =brcmf_fil_iovar_data_get (ifp,"cur_etheraddr" , ifp->mac_addr,sizeof (ifp->mac_addr));if (err <0 ) { -brcmf_err ("Retreiving cur_etheraddr failed, %d\n" , err); +brcmf_err (pub,"Retreiving cur_etheraddr failed, %d\n" , err); goto done; }memcpy (ifp->drvr->mac, ifp->mac_addr,sizeof (ifp->drvr->mac));
@@ -126,7 +128,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) &revinfo, sizeof(revinfo)); ri = &ifp->drvr->revinfo;if (err <0 ) { -brcmf_err ("retrieving revision info failed, %d\n" , err); +brcmf_err (pub,"retrieving revision info failed, %d\n" , err); }else { ri->vendorid =le32_to_cpu (revinfo.vendorid); ri->deviceid =le32_to_cpu (revinfo.deviceid);
@@ -153,7 +155,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)strcpy (buf,"ver" ); err =brcmf_fil_iovar_data_get (ifp,"ver" , buf,sizeof (buf));if (err <0 ) { -brcmf_err ("Retreiving version information failed, %d\n" , +brcmf_err (pub,"Retreiving version information failed, %d\n" , err); goto done; }
@@ -161,7 +163,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)strsep (&ptr,"\n" );/* Print fw version info */ -brcmf_err ("Firmware version = %s\n" , buf); +brcmf_err (pub,"Firmware version = %s\n" , buf);/* locate firmware version number for ethtool */ ptr =strrchr (buf,' ' ) +1 ;
@@ -170,7 +172,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)/* set mpc */ err =brcmf_fil_iovar_int_set (ifp,"mpc" ,1 );if (err) { -brcmf_err ("failed setting mpc\n" ); +brcmf_err (pub,"failed setting mpc\n" ); goto done; }
@@ -180,14 +182,14 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) err =brcmf_fil_iovar_data_get (ifp,"event_msgs" , eventmask,BRCMF_EVENTING_MASK_LEN );if (err) { -brcmf_err ("Get event_msgs error (%d)\n" , err); +brcmf_err (pub,"Get event_msgs error (%d)\n" , err); goto done; }setbit (eventmask,BRCMF_E_IF ); err =brcmf_fil_iovar_data_set (ifp,"event_msgs" , eventmask,BRCMF_EVENTING_MASK_LEN );if (err) { -brcmf_err ("Set event_msgs error (%d)\n" , err); +brcmf_err (pub,"Set event_msgs error (%d)\n" , err); goto done; }
@@ -195,7 +197,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) err =brcmf_fil_cmd_int_set (ifp,BRCMF_C_SET_SCAN_CHANNEL_TIME ,BRCMF_DEFAULT_SCAN_CHANNEL_TIME );if (err) { -brcmf_err ("BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n" , +brcmf_err (pub,"BRCMF_C_SET_SCAN_CHANNEL_TIME error (%d)\n" , err); goto done; }
@@ -204,7 +206,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) err =brcmf_fil_cmd_int_set (ifp,BRCMF_C_SET_SCAN_UNASSOC_TIME ,BRCMF_DEFAULT_SCAN_UNASSOC_TIME );if (err) { -brcmf_err ("BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n" , +brcmf_err (pub,"BRCMF_C_SET_SCAN_UNASSOC_TIME error (%d)\n" , err); goto done; }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +24 -21
182 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +3 -2
@@ -58,16 +58,17 @@ static int brcmf_debug_psm_watchdog_notify(struct brcmf_if *ifp,const struct brcmf_event_msg *evtmsg, void *data) { + struct brcmf_pub *pub = ifp->drvr;int err;brcmf_dbg (TRACE ,"enter: bsscfgidx=%d\n" , ifp->bsscfgidx); -brcmf_err ("PSM's watchdog has fired!\n" ); +brcmf_err (pub,"PSM's watchdog has fired!\n" ); err =brcmf_debug_create_memdump (ifp->drvr->bus_if, data, evtmsg->datalen);if (err) -brcmf_err ("Failed to get memory dump, %d\n" , err); +brcmf_err (pub,"Failed to get memory dump, %d\n" , err);return err; }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +2 -2
@@ -52,12 +52,12 @@ void __brcmf_err(struct brcmf_pub *pub, const char *func, const char *fmt, ...);/* Macro for error messages. When debugging / tracing the driver all error * messages are important to us. */ -#define brcmf_err (fmt, ...) \ +#define brcmf_err (pub, fmt, ...) \ do { \ if (IS_ENABLED(CONFIG_BRCMDBG) || \ IS_ENABLED(CONFIG_BRCM_TRACING) || \ net_ratelimit()) \ - __brcmf_err(NULL, __func__, fmt, ##__VA_ARGS__);\ + __brcmf_err(pub, __func__, fmt, ##__VA_ARGS__); \ } while (0)#if defined(DEBUG ) || defined(CONFIG_BRCM_TRACING )
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +1 -1
@@ -578,7 +578,7 @@ int brcmf_fw_map_chip_to_name(u32 chip, u32 chiprev, }if (i == table_size) { -brcmf_err ("Unknown chipid %d [%d]\n" , chip, chiprev); +brcmf_err (NULL ,"Unknown chipid %d [%d]\n" , chip, chiprev);return -ENODEV ; }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +1 -1
@@ -343,7 +343,7 @@ void brcmf_flowring_open(struct brcmf_flowring *flow, u16 flowid) ring = flow->rings[flowid];if (!ring) { -brcmf_err ("Ring NULL, for flowid %d\n" , flowid); +brcmf_err (NULL ,"Ring NULL, for flowid %d\n" , flowid);return ; }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +9 -7
@@ -107,6 +107,7 @@ static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp,struct brcmf_event_msg *emsg, void *data) { + struct brcmf_pub *pub = ifp->drvr;struct brcmf_fweh_info *fweh;int err = -EINVAL ;
@@ -117,9 +118,9 @@ static int brcmf_fweh_call_event_handler(struct brcmf_if *ifp,if (fweh->evt_handler[code]) err = fweh->evt_handler[code](ifp, emsg, data);else -brcmf_err ("unhandled event %d ignored\n" , code); +brcmf_err (pub,"unhandled event %d ignored\n" , code); }else { -brcmf_err ("no interface object\n" ); +brcmf_err (pub,"no interface object\n" ); }return err; }
@@ -158,7 +159,8 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,return ; }if (ifevent->ifidx >=BRCMF_MAX_IFS ) { -brcmf_err ("invalid interface index: %u\n" , ifevent->ifidx); +brcmf_err (drvr,"invalid interface index: %u\n" , + ifevent->ifidx);return ; }
@@ -258,7 +260,7 @@ static void brcmf_fweh_event_worker(struct work_struct *work)min_t (u32, emsg.datalen,64 ), "event payload, len=%d\n", emsg.datalen);if (emsg.datalen > event->datalen) { -brcmf_err ("event invalid length header=%d, msg=%d\n" , +brcmf_err (drvr,"event invalid length header=%d, msg=%d\n" , event->datalen, emsg.datalen); goto event_free; }
@@ -276,7 +278,7 @@ static void brcmf_fweh_event_worker(struct work_struct *work) err =brcmf_fweh_call_event_handler (ifp, event->code, &emsg, event->data);if (err) { -brcmf_err ("event handler failed (%d)\n" , +brcmf_err (drvr,"event handler failed (%d)\n" , event->code); err =0 ; }
@@ -344,7 +346,7 @@ int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code, brcmf_fweh_handler_t handler) {if (drvr->fweh.evt_handler[code]) { -brcmf_err ("event code %d already registered\n" , code); +brcmf_err (drvr,"event code %d already registered\n" , code);return -ENOSPC ; } drvr->fweh.evt_handler[code] = handler;
@@ -393,7 +395,7 @@ int brcmf_fweh_activate_events(struct brcmf_if *ifp) err =brcmf_fil_iovar_data_set (ifp,"event_msgs" , eventmask,BRCMF_EVENTING_MASK_LEN );if (err) -brcmf_err ("Set event_msgs error (%d)\n" , err); +brcmf_err (ifp->drvr,"Set event_msgs error (%d)\n" , err);return err; }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c +6 -6
@@ -110,7 +110,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)s32 err;if (drvr->bus_if->state !=BRCMF_BUS_UP ) { -brcmf_err ("bus is down. we have nothing to do.\n" ); +brcmf_err (drvr,"bus is down. we have nothing to do.\n" );return -EIO ; }
@@ -236,7 +236,7 @@ brcmf_fil_iovar_data_set(struct brcmf_if *ifp, char *name, const void *data, buflen, true); }else { err = -EPERM ; -brcmf_err ("Creating iovar failed\n" ); +brcmf_err (drvr,"Creating iovar failed\n" ); }mutex_unlock (&drvr->proto_block);
@@ -262,7 +262,7 @@ brcmf_fil_iovar_data_get(struct brcmf_if *ifp, char *name, void *data,memcpy (data, drvr->proto_buf, len); }else { err = -EPERM ; -brcmf_err ("Creating iovar failed\n" ); +brcmf_err (drvr,"Creating iovar failed\n" ); }brcmf_dbg (FIL ,"ifidx=%d, name=%s, len=%d\n" , ifp->ifidx, name, len);
@@ -312,7 +312,7 @@ brcmf_create_bsscfg(s32 bsscfgidx, char *name, char *data, u32 datalen, iolen = prefixlen + namelen +sizeof (bsscfgidx_le) + datalen;if (buflen < iolen) { -brcmf_err ("buffer is too short\n" ); +brcmf_err (NULL ,"buffer is too short\n" );return 0 ; }
@@ -360,7 +360,7 @@ brcmf_fil_bsscfg_data_set(struct brcmf_if *ifp, char *name, buflen, true); }else { err = -EPERM ; -brcmf_err ("Creating bsscfg failed\n" ); +brcmf_err (drvr,"Creating bsscfg failed\n" ); }mutex_unlock (&drvr->proto_block);
@@ -386,7 +386,7 @@ brcmf_fil_bsscfg_data_get(struct brcmf_if *ifp, char *name,memcpy (data, drvr->proto_buf, len); }else { err = -EPERM ; -brcmf_err ("Creating bsscfg failed\n" ); +brcmf_err (drvr,"Creating bsscfg failed\n" ); }brcmf_dbg (FIL ,"ifidx=%d, bsscfgidx=%d, name=%s, len=%d\n" , ifp->ifidx, ifp->bsscfgidx, name, len);
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +24 -19
174 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +34 -24
124 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +48 -32
80 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +26 -16
42 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +12 -8
Lines of this file are not shown. View the raw message.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/proto.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +121 -92
213 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +41 -29
70 lines not on this page · raw message
drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c +10 -7
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.11.0
Part of the diff is not shown here. View the raw message.
PATCH v3 9/9 brcmfmac: use dev_err to print errors
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
This adds a nice prefix to all error messages making it possible to identify device they are related to. It's really useful for e.g. home routers commonly having 2 or even 3 wireless devices.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 3 ++- drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +2 -1
@@ -223,6 +223,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)#ifndef CONFIG_BRCM_TRACING void __brcmf_err (struct brcmf_pub *pub,const char *func,const char *fmt, ...) { +struct device *dev = pub && pub->bus_if ? pub->bus_if->dev :NULL ;struct va_format vaf;va_list args;
@@ -230,7 +231,7 @@ void __brcmf_err(struct brcmf_pub *pub, const char *func, const char *fmt, ...) vaf.fmt = fmt; vaf.va = &args; -pr_err ("%s: %pV" , func, &vaf); +dev_err (dev,"%s: %pV" , func, &vaf);va_end (args); }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/tracepoint.c +2 -1
@@ -25,6 +25,7 @@void __brcmf_err (struct brcmf_pub *pub,const char *func,const char *fmt, ...) { +struct device *dev = pub && pub->bus_if ? pub->bus_if->dev :NULL ;struct va_format vaf = { .fmt = fmt, };
@@ -32,7 +33,7 @@ void __brcmf_err(struct brcmf_pub *pub, const char *func, const char *fmt, ...)va_start (args, fmt); vaf.va = &args; -pr_err ("%s: %pV" , func, &vaf); +dev_err (dev,"%s: %pV" , func, &vaf);trace_brcmf_err (func, &vaf);va_end (args); }
Signature · 1 line
2.11.0
Quoted 4 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This allows simplifying the code by adding a simple
IS_ENABLEDcheck forCONFIG_BRCMDBsymbol.
Quoted 35 lines
Signed-off-by Rafał Miłecki <[email protected]>---
V3: Re-add this patch (it was initially submited as RFC)--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +2
-6@@ -45,20 +45,16 @@#undef pr_fmt#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#ifndef CONFIG_BRCM_TRACING /* Macro for error messages. net_ratelimit() is used when driver * debugging is not selected. When debugging the driver error * messages are as important as other tracing or even more so. */ -#ifndef CONFIG_BRCM_TRACING -#ifdef CONFIG_BRCMDBG -#define brcmf_err (fmt, ...) pr_err("%s: " fmt, __func__, ##__VA_ARGS__) -#else #define brcmf_err (fmt, ...) \ do { \ - if (net_ratelimit()) \ + if (IS_ENABLED(CONFIG_BRCMDBG) || net_ratelimit()) \ pr_err("%s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) -#endif #else __printf(2, 3)void __brcmf_err (const char *func,const char *fmt, ...);
Quoted 7 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This allows simplifying the code by adding a simple
IS_ENABLEDcheck forCONFIG_BRCMDBsymbol.Signed-off-by Rafał Miłecki <[email protected]>Acked-by Arend van Spriel <[email protected]>
3 patches applied to wireless-drivers-next.git, thanks.
9587a01a7ead brcmfmac: merge two brcmf_err macros into one 087fa712a006 brcmfmac: switch to C function (__brcmf_err) for printing errors d0630555650a brcmfmac: merge two remaining brcmf_err macros
Signature · 6 lines
https://patchwork.kernel.org/patch/9553249/ Documentation about submitting wireless patches and checking status from patchwork: https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches