319-0005-brcmfmac-switch-to-C-function-__brcmf_err-for-printi.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. From 087fa712a00685dac4bcc64b7c3dc8ae6bee8026 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Thu, 2 Feb 2017 22:33:14 +0100
  4. Subject: [PATCH] brcmfmac: switch to C function (__brcmf_err) for printing
  5. errors
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. This will allow extending code and using more detailed messages e.g.
  10. with the help of dev_err.
  11. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  12. Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  13. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  14. ---
  15. .../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 16 ++++++++++++++++
  16. drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h | 6 +++---
  17. 2 files changed, 19 insertions(+), 3 deletions(-)
  18. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  19. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
  20. @@ -218,6 +218,22 @@ done:
  21. return err;
  22. }
  23. +#ifndef CPTCFG_BRCM_TRACING
  24. +void __brcmf_err(const char *func, const char *fmt, ...)
  25. +{
  26. + struct va_format vaf;
  27. + va_list args;
  28. +
  29. + va_start(args, fmt);
  30. +
  31. + vaf.fmt = fmt;
  32. + vaf.va = &args;
  33. + pr_err("%s: %pV", func, &vaf);
  34. +
  35. + va_end(args);
  36. +}
  37. +#endif
  38. +
  39. #if defined(CPTCFG_BRCM_TRACING) || defined(CPTCFG_BRCMDBG)
  40. void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...)
  41. {
  42. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
  43. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h
  44. @@ -45,6 +45,8 @@
  45. #undef pr_fmt
  46. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  47. +__printf(2, 3)
  48. +void __brcmf_err(const char *func, const char *fmt, ...);
  49. #ifndef CPTCFG_BRCM_TRACING
  50. /* Macro for error messages. net_ratelimit() is used when driver
  51. * debugging is not selected. When debugging the driver error
  52. @@ -53,11 +55,9 @@
  53. #define brcmf_err(fmt, ...) \
  54. do { \
  55. if (IS_ENABLED(CPTCFG_BRCMDBG) || net_ratelimit()) \
  56. - pr_err("%s: " fmt, __func__, ##__VA_ARGS__); \
  57. + __brcmf_err(__func__, fmt, ##__VA_ARGS__); \
  58. } while (0)
  59. #else
  60. -__printf(2, 3)
  61. -void __brcmf_err(const char *func, const char *fmt, ...);
  62. #define brcmf_err(fmt, ...) \
  63. __brcmf_err(__func__, fmt, ##__VA_ARGS__)
  64. #endif