Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 11:26:50 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/include/linux: wait_bit.h
        src/sys/external/bsd/drm2/linux: linux_wait_bit.c

Log Message:
linux: Add clear_and_wake_up_bit.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/wait_bit.h
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/linux/linux_wait_bit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/wait_bit.h
diff -u src/sys/external/bsd/drm2/include/linux/wait_bit.h:1.2 src/sys/external/bsd/drm2/include/linux/wait_bit.h:1.3
--- src/sys/external/bsd/drm2/include/linux/wait_bit.h:1.2	Sun Dec 19 01:42:01 2021
+++ src/sys/external/bsd/drm2/include/linux/wait_bit.h	Sun Dec 19 11:26:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: wait_bit.h,v 1.2 2021/12/19 01:42:01 riastradh Exp $	*/
+/*	$NetBSD: wait_bit.h,v 1.3 2021/12/19 11:26:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
 #ifndef	_LINUX_WAIT_BIT_H_
 #define	_LINUX_WAIT_BIT_H_
 
+#define	clear_and_wake_up_bit	linux_clear_and_wake_up_bit
 #define	wait_on_bit		linux_wait_on_bit
 #define	wait_on_bit_timeout	linux_wait_on_bit_timeout
 #define	wake_up_bit		linux_wake_up_bit
@@ -40,6 +41,7 @@ int	linux_wait_bit_init(void);
 void	linux_wait_bit_fini(void);
 
 void	wake_up_bit(const volatile unsigned long *, unsigned);
+void	clear_and_wake_up_bit(int, volatile unsigned long *);
 int	wait_on_bit(const volatile unsigned long *, unsigned, int);
 int	wait_on_bit_timeout(const volatile unsigned long *, unsigned, int,
 	    unsigned long);

Index: src/sys/external/bsd/drm2/linux/linux_wait_bit.c
diff -u src/sys/external/bsd/drm2/linux/linux_wait_bit.c:1.3 src/sys/external/bsd/drm2/linux/linux_wait_bit.c:1.4
--- src/sys/external/bsd/drm2/linux/linux_wait_bit.c:1.3	Sun Dec 19 01:42:02 2021
+++ src/sys/external/bsd/drm2/linux/linux_wait_bit.c	Sun Dec 19 11:26:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_wait_bit.c,v 1.3 2021/12/19 01:42:02 riastradh Exp $	*/
+/*	$NetBSD: linux_wait_bit.c,v 1.4 2021/12/19 11:26:50 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_wait_bit.c,v 1.3 2021/12/19 01:42:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_wait_bit.c,v 1.4 2021/12/19 11:26:50 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -114,6 +114,17 @@ wake_up_bit(const volatile unsigned long
 	wait_bit_exit(wbe);
 }
 
+void
+clear_and_wake_up_bit(int bit, volatile unsigned long *bitmap)
+{
+	struct waitbitentry *wbe;
+
+	wbe = wait_bit_enter(bitmap, bit);
+	clear_bit(bit, bitmap);
+	cv_broadcast(&wbe->cv);
+	wait_bit_exit(wbe);
+}
+
 int
 wait_on_bit(const volatile unsigned long *bitmap, unsigned bit, int flags)
 {

Reply via email to