xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 1/3] xen/err: Use static inlines and boolean types
Date: Tue, 1 Nov 2016 10:46:08 +0000	[thread overview]
Message-ID: <1477997170-7795-2-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1477997170-7795-1-git-send-email-andrew.cooper3@citrix.com>

IS_ERR() and IS_ERR_OR_NULL() both return boolean values.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
 xen/include/xen/err.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/include/xen/err.h b/xen/include/xen/err.h
index 2f29b57..ef77992 100644
--- a/xen/include/xen/err.h
+++ b/xen/include/xen/err.h
@@ -2,6 +2,7 @@
 #define __XEN_ERR_H__
 
 #include <xen/compiler.h>
+#include <xen/stdbool.h>
 #include <xen/errno.h>
 
 /*
@@ -14,7 +15,10 @@
  */
 #define MAX_ERRNO	4095
 
-#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
+static inline bool IS_ERR_VALUE(unsigned long x)
+{
+	return x >= (unsigned long)-MAX_ERRNO;
+}
 
 static inline void *__must_check ERR_PTR(long error)
 {
@@ -26,12 +30,12 @@ static inline long __must_check PTR_ERR(const void *ptr)
 	return (long)ptr;
 }
 
-static inline long __must_check IS_ERR(const void *ptr)
+static inline bool __must_check IS_ERR(const void *ptr)
 {
 	return IS_ERR_VALUE((unsigned long)ptr);
 }
 
-static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
+static inline bool __must_check IS_ERR_OR_NULL(const void *ptr)
 {
 	return !ptr || IS_ERR_VALUE((unsigned long)ptr);
 }
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-11-01 10:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 10:46 [PATCH for-4.9 0/3] Improvements to ERR_PTR() infrastructure Andrew Cooper
2016-11-01 10:46 ` Andrew Cooper [this message]
2016-11-02 11:33   ` [PATCH 1/3] xen/err: Use static inlines and boolean types Jan Beulich
2016-11-01 10:46 ` [PATCH 2/3] xen/err: Support an optional per-arch slide for the error region Andrew Cooper
2016-11-02 11:37   ` Jan Beulich
2016-11-01 10:46 ` [PATCH 3/3] xen/x86: Use non-canonical pointers for ERR_PTR() errors Andrew Cooper
2016-11-02 11:47   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477997170-7795-2-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).