Skip to contentSkip to conversation

scripts/checkpatch: Avoid recommending legacy qemu_bh_new_guarded()

PATCH In review Philippe Mathieu-Daudé 1 participant 3 messages Sep 24, 2025 – Oct 6, 2025 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/checkpatch: Avoid recommending legacy qemu_bh_new_guarded()

qemu_bh_new_guarded() is considered legacy since commit 9c86c97f12c ("async: Add an optional reentrancy guard to the BH API"); recommend the new API: aio_bh_new_guarded().

---
 scripts/checkpatch.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +3 -3
index 91616c974f2..6a0c06bebb9 100755
@@ -3197,9 +3197,9 @@ sub process {
 		if ($line =~ /\bsignal\s*\(/ && !($line =~ /SIG_(?:IGN|DFL)/)) {
 			ERROR("use sigaction to establish signal handlers; signal is not portable\n" . $herecurr);
 		}
-# recommend qemu_bh_new_guarded instead of qemu_bh_new
-        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\bqemu_bh_new\s*\(/) {
-			ERROR("use qemu_bh_new_guarded() instead of qemu_bh_new() to avoid reentrancy problems\n" . $herecurr);
+# recommend aio_bh_new_guarded instead of legacy qemu_bh_new / qemu_bh_new_guarded
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\bqemu_bh_new(_guarded)?\s*\(/) {
+			ERROR("use aio_bh_new_guarded() instead of qemu_bh_new*() to avoid reentrancy problems\n" . $herecurr);
 		}
 # recommend aio_bh_new_guarded instead of aio_bh_new
         if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\baio_bh_new\s*\(/) {
Signature · 1 line
2.51.0
#1 lore raw

(forgot to Cc [email protected])

Quoted 26 lines · Philippe Mathieu-Daudé

qemu_bh_new_guarded() is considered legacy since commit 9c86c97f12c ("async: Add an optional reentrancy guard to the BH API"); recommend the new API: aio_bh_new_guarded().

---
  scripts/checkpatch.pl | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +3 -3
index 91616c974f2..6a0c06bebb9 100755
@@ -3197,9 +3197,9 @@ sub process {
  		if ($line =~ /\bsignal\s*\(/ && !($line =~ /SIG_(?:IGN|DFL)/)) {
  			ERROR("use sigaction to establish signal handlers; signal is not portable\n" . $herecurr);
  		}
-# recommend qemu_bh_new_guarded instead of qemu_bh_new
-        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\bqemu_bh_new\s*\(/) {
-			ERROR("use qemu_bh_new_guarded() instead of qemu_bh_new() to avoid reentrancy problems\n" . $herecurr);
+# recommend aio_bh_new_guarded instead of legacy qemu_bh_new / qemu_bh_new_guarded
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\bqemu_bh_new(_guarded)?\s*\(/) {
+			ERROR("use aio_bh_new_guarded() instead of qemu_bh_new*() to avoid reentrancy problems\n" . $herecurr);
  		}
  # recommend aio_bh_new_guarded instead of aio_bh_new
          if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\baio_bh_new\s*\(/) {
#2 lore raw

ping?

Quoted 35 lines · Philippe Mathieu-Daudé

(forgot to Cc [email protected])

Quoted 31 lines · Philippe Mathieu-Daudé

qemu_bh_new_guarded() is considered legacy since commit 9c86c97f12c ("async: Add an optional reentrancy guard to the BH API"); recommend the new API: aio_bh_new_guarded().

---
  scripts/checkpatch.pl | 6 +++---

  1 file changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +1 -3
index 91616c974f2..6a0c06bebb9 100755
@@ -3197,9 +3197,9 @@ sub process {
           if ($line =~ /\bsignal\s*\(/ && !($line =~ /SIG_(?:IGN| DFL)/)) {
               ERROR("use sigaction to establish signal handlers; signal is not portable\n" . $herecurr);
           }
-# recommend qemu_bh_new_guarded instead of qemu_bh_new
-        if ($realfile =~ /.*\/hw\/.*/ && $line =~ / 
 \bqemu_bh_new\s*\(/) {
-            ERROR("use qemu_bh_new_guarded() instead of qemu_bh_new() 
 to avoid reentrancy problems\n" . $herecurr);
+# recommend aio_bh_new_guarded instead of legacy qemu_bh_new / 

qemu_bh_new_guarded
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ / \bqemu_bh_new(_guarded)?\s*\(/) {
+            ERROR("use aio_bh_new_guarded() instead of qemu_bh_new*() to avoid reentrancy problems\n" . $herecurr);
          }

  # recommend aio_bh_new_guarded instead of aio_bh_new
          if ($realfile =~ /.*\/hw\/.*/ && $line =~ / \baio_bh_new\s*\(/) {