diff mbox series

[RFC,BlueZ] adapter: Introduce BTD_ADAPTER_DBG

Message ID 20220323224003.3736525-1-luiz.dentz@gmail.com
State Superseded
Headers show
Series [RFC,BlueZ] adapter: Introduce BTD_ADAPTER_DBG | expand

Commit Message

Luiz Augusto von Dentz March 23, 2022, 10:39 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This introduces BTD_ADAPTER_DBG which includes the controller index
when using DBG_IDX, in addition to it also add similar macro for
devices in the form of BTD_DEVICE_DBG which resolves the adapter and
before calling BTD_ADAPTER_DBG.
---
 src/adapter.h | 4 ++++
 src/device.h  | 4 ++++
 2 files changed, 8 insertions(+)

Comments

bluez.test.bot@gmail.com March 24, 2022, 2:49 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=625872

---Test result---

Test Summary:
CheckPatch                    FAIL      12.99 seconds
GitLint                       PASS      8.66 seconds
Prep - Setup ELL              PASS      40.22 seconds
Build - Prep                  PASS      0.68 seconds
Build - Configure             PASS      8.17 seconds
Build - Make                  PASS      1211.61 seconds
Make Check                    PASS      10.97 seconds
Make Check w/Valgrind         PASS      417.60 seconds
Make Distcheck                PASS      222.33 seconds
Build w/ext ELL - Configure   PASS      8.66 seconds
Build w/ext ELL - Make        PASS      1243.22 seconds
Incremental Build with patchesPASS      11501.91 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[RFC,BlueZ] adapter: Introduce BTD_ADAPTER_DBG
ERROR:SPACING: space prohibited before that ',' (ctx:WxW)
#99: FILE: src/adapter.h:28:
+							__func__ , ## arg)
 							         ^

ERROR:SPACING: space prohibited before that ',' (ctx:WxW)
#114: FILE: src/device.h:16:
+							__func__ , ## arg)
 							         ^

/github/workspace/src/12790172.patch total: 2 errors, 0 warnings, 20 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12790172.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.

[BlueZ,v4,3/9] mgmt: Introduce mgmt_set_verbose
WARNING:REPEATED_WORD: Possible repeated word: 'the'
#83: 
the the likes hexdump of packets, by default it is disabled since in

/github/workspace/src/12790175.patch total: 0 errors, 1 warnings, 61 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12790175.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org March 24, 2022, 7:50 p.m. UTC | #2
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 23 Mar 2022 15:39:54 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This introduces BTD_ADAPTER_DBG which includes the controller index
> when using DBG_IDX, in addition to it also add similar macro for
> devices in the form of BTD_DEVICE_DBG which resolves the adapter and
> before calling BTD_ADAPTER_DBG.
> 
> [...]

Here is the summary with links:
  - [RFC,BlueZ] adapter: Introduce BTD_ADAPTER_DBG
    (no matching commit)
  - [BlueZ,v4,2/9] mgmt: Add DBG macro
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f9cb7c802f27
  - [BlueZ,v4,3/9] mgmt: Introduce mgmt_set_verbose
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b7c807269f1f
  - [BlueZ,v4,4/9] adapter: Don't use DBG in mgmt_debug
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=62c6037ea02b
  - [BlueZ,v4,5/9] att: Log file and function names
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8039d42687fd
  - [BlueZ,v4,6/9] gatt-client: Add DBG macro
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e0870ce5e1fe
  - [BlueZ,v4,7/9] gatt-server: Add DBG macro
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=55c25d91e4d6
  - [BlueZ,v4,8/9] att: Rename att_debug and att_verbose to DBG and VERBOSE
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e1b808c128fa
  - [BlueZ,v4,9/9] device: Don't use DBG in gatt_debug
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=71cec503c8da

You are awesome, thank you!
Marcel Holtmann March 25, 2022, 2:57 p.m. UTC | #3
Hi Luiz,

> This removes __FILE__ and __func__ from DBG_IDX since users of it may
> already contain such information embedded in the format.
> ---
> src/log.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/log.h b/src/log.h
> index 74941beb2..1ed742a0d 100644
> --- a/src/log.h
> +++ b/src/log.h
> @@ -9,6 +9,7 @@
>  */
> 
> #include <stdint.h>
> +#include <stdbool.h>

seems to have nothing to do with the change here.

> void info(const char *format, ...) __attribute__((format(printf, 1, 2)));
> 
> @@ -52,10 +53,11 @@ void __btd_enable_debug(struct btd_debug_desc *start,
> 		.file = __FILE__, .flags = BTD_DEBUG_FLAG_DEFAULT, \
> 	}; \
> 	if (__btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \
> -		btd_debug(idx, "%s:%s() " fmt, __FILE__, __func__ , ## arg); \
> +		btd_debug(idx, fmt, ## arg); \
> } while (0)
> 
> -#define DBG(fmt, arg...) DBG_IDX(0xffff, fmt, ## arg)
> +#define DBG(fmt, arg...) \
> +	DBG_IDX(0xffff, "%s:%s() " fmt, __FILE__, __func__, ## arg)
> #define error(fmt, arg...) \
> 	btd_error(0xffff, "%s:%s() " fmt, __FILE__, __func__, ## arg)
> #define warn(fmt, arg...) \

I am still failing to see why this is better.

Regards

Marcel
Marcel Holtmann March 25, 2022, 3 p.m. UTC | #4
Hi Luiz,

> This introduces mgmt_set_verbose which can be used to enable printing
> the the likes hexdump of packets, by default it is disabled since in
> most cases the hexdump is not very useful and there are better tools
> to collect the hexdumo like btmon.
> ---
> src/shared/mgmt.c | 24 ++++++++++++++++++++----
> src/shared/mgmt.h |  1 +
> 2 files changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/src/shared/mgmt.c b/src/shared/mgmt.c
> index c7e6a6c1d..cf518cc2b 100644
> --- a/src/shared/mgmt.c
> +++ b/src/shared/mgmt.c
> @@ -50,6 +50,7 @@ struct mgmt {
> 	mgmt_debug_func_t debug_callback;
> 	mgmt_destroy_func_t debug_destroy;
> 	void *debug_data;
> +	bool verbose;
> };
> 
> struct mgmt_request {
> @@ -192,6 +193,15 @@ static void mgmt_log(struct mgmt *mgmt, const char *format, ...)
> 	va_end(ap);
> }
> 
> +static void mgmt_hexdump(struct mgmt *mgmt, char dir, const void *data,
> +							size_t len)
> +{
> +	if (!mgmt->verbose)
> +		return;
> +
> +	util_hexdump(dir, data, len, mgmt->debug_callback, mgmt->debug_data);
> +}
> +

this is stupid, lets just remove the support for hexdump altogether here. This code was written when mgmt tracing via btmon was not available, but since it is now, there is really no point.

Regards

Marcel
diff mbox series

Patch

diff --git a/src/adapter.h b/src/adapter.h
index 35deb1d11..515be3210 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -23,6 +23,10 @@ 
 /* Invalid SSP passkey value used to indicate negative replies */
 #define INVALID_PASSKEY		0xffffffff
 
+#define BTD_ADAPTER_DBG(adapter, fmt, arg...) \
+	DBG_IDX(btd_adapter_get_index(adapter), "%s:%s() " fmt, __FILE__, \
+							__func__ , ## arg)
+
 struct btd_adapter;
 struct btd_device;
 struct queue;
diff --git a/src/device.h b/src/device.h
index 071576d6b..4d40d1d22 100644
--- a/src/device.h
+++ b/src/device.h
@@ -11,6 +11,10 @@ 
 
 #define DEVICE_INTERFACE	"org.bluez.Device1"
 
+#define BTD_DEVICE_DBG(device, fmt, arg...) \
+	BTD_ADAPTER_DBG(device_get_adapter(device), "%s:%s() " fmt, __FILE__, \
+							__func__ , ## arg)
+
 struct btd_device;
 
 struct btd_device *device_create(struct btd_adapter *adapter,