Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Sep 2022 11:58:47 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 7ea1cac24857 - main - systm.h: change pause from #define to inline function
Message-ID:  <202209091158.289BwlV9044717@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=7ea1cac248574ed06c7823ffbfb9a60157240e57

commit 7ea1cac248574ed06c7823ffbfb9a60157240e57
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-09-08 00:04:42 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-09-09 11:54:59 +0000

    systm.h: change pause from #define to inline function
    
    There are drivers are using (*pause)(x, y) function pointers and depending
    on how "pause" is used it gets replaced by pause_sbt causing compile time
    failures.
    Given "pause" is a generic enough name change it from a #define to an
    inline function to avoid replacements where it should not.
    
    MFC after:      2 weeks
    Reviewed by:    kib
    Differential Revision: https://reviews.freebsd.org/D36489
---
 sys/sys/systm.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 52ee592e9e4a..9673d7e93ab5 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -448,8 +448,11 @@ int	msleep_spin_sbt(const void * _Nonnull chan, struct mtx *mtx,
 	    0, C_HARDCLOCK)
 int	pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr,
 	    int flags);
-#define	pause(wmesg, timo)						\
-	pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK)
+static __inline int
+pause(const char *wmesg, int timo)
+{
+	return (pause_sbt(wmesg, tick_sbt * timo, 0, C_HARDCLOCK));
+}
 #define	pause_sig(wmesg, timo)						\
 	pause_sbt((wmesg), tick_sbt * (timo), 0, C_HARDCLOCK | C_CATCH)
 #define	tsleep(chan, pri, wmesg, timo)					\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202209091158.289BwlV9044717>