Skip to contentSkip to conversation

shared/util: Add MIN/MAX implementations

PATCH Applied Bastien Nocera 3 participants 5 messages Mar 31 – Apr 1 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

v2 cover shared/util: Add MIN/MAX implementations

Changes since v1:
- Fix MIN/MAX implementation (tests all pass...)

Bastien Nocera (2):
shared/util: Add MIN/MAX implementations
emulator: Remove compile-time header only glib dep

 emulator/btdev.c   | 2 --
 src/sdpd-request.c | 2 --
 src/shared/util.h  | 6 ++++++
 3 files changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH v2 1/2 shared/util: Add MIN/MAX implementations

And remove it from src/sdpd-request.c to avoid a redefinition warning at compile-time.

---
 src/sdpd-request.c | 2 --
 src/shared/util.h  | 6 ++++++
 2 files changed, 6 insertions(+), 2 deletions(-)
src/sdpd-request.c +0 -2
index 1fc07e97bfe0..7c632c2aaf62 100644
@@ -40,8 +40,6 @@ typedef struct {
 
 #define SDP_CONT_STATE_SIZE (sizeof(uint8_t) + sizeof(sdp_cont_state_t))
 
-#define MIN(x, y) ((x) < (y)) ? (x): (y)
-
 typedef struct sdp_cont_info sdp_cont_info_t;
 
 struct sdp_cont_info {
src/shared/util.h +6 -0
index c480351d6e9f..67629dddfaa9 100644
@@ -22,6 +22,12 @@
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 #define BIT(n)  (1 << (n))
 
+#undef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+#undef MAX
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define le16_to_cpu(val) (val)
 #define le32_to_cpu(val) (val)
Signature · 1 line
2.53.0
#2 lore raw

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=1075447

---Test result---

Test Summary:

CheckPatch                    PENDING   0.36 seconds
GitLint                       PENDING   0.33 seconds
BuildEll                      PASS      20.71 seconds
BluezMake                     PASS      651.49 seconds
MakeCheck                     PASS      18.40 seconds
MakeDistcheck                 PASS      247.42 seconds
CheckValgrind                 PASS      296.12 seconds
CheckSmatch                   WARNING   357.45 seconds
bluezmakeextell               PASS      184.81 seconds
IncrementalBuild              PENDING   0.64 seconds
ScanBuild                     PASS      1027.89 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:468:29: warning: Variable length array is used.
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

https://github.com/bluez/bluez/pull/1996/checks

---
Regards,
Linux Bluetooth

#3 lore raw

PATCH v2 2/2 emulator: Remove compile-time header only glib dep

In reply to Bastien Nocera

btvirt relied on a glib header macro to use MIN/MAX, but didn't link against it, meaning that it was dependent on other programs in the project using glib to compile correctly.

Remove the include and use our own implementation instead.

---
 emulator/btdev.c | 2 --
 1 file changed, 2 deletions(-)
emulator/btdev.c +0 -2
index d3a9c6735ff1..3a295b679f34 100644
@@ -25,8 +25,6 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-#include <glib.h>
-
 #include "bluetooth/bluetooth.h"
 #include "bluetooth/hci.h"
 
Signature · 1 line
2.53.0
#4 lore raw
In reply to Bastien Nocera
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Tue, 31 Mar 2026 23:36:35 +0200 you wrote:

Changes since v1:
- Fix MIN/MAX implementation (tests all pass...)

Bastien Nocera (2):
shared/util: Add MIN/MAX implementations
emulator: Remove compile-time header only glib dep

[...]

Here is the summary with links:
- [BlueZ,v2,1/2] shared/util: Add MIN/MAX implementations

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=023e57342a07
  - [BlueZ,v2,2/2] emulator: Remove compile-time header only glib dep
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=dbbfffe2c323

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html