From: David Howells <dhowells@redhat.com>
Date: Tue, 29 Apr 2008 08:01:34 +0000 (-0700)
Subject: keys: make key_serial() a function if CONFIG_KEYS=y
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7249db2c281ac688977ecc6862cdee9969d310e2;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

keys: make key_serial() a function if CONFIG_KEYS=y

Make key_serial() an inline function rather than a macro if CONFIG_KEYS=y.
This prevents double evaluation of the key pointer and also provides better
type checking.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

diff --git a/include/linux/key.h b/include/linux/key.h
index ad02d9cfe170..c45c962d1cc5 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -264,7 +264,10 @@ extern int keyring_add_key(struct key *keyring,
 
 extern struct key *key_lookup(key_serial_t id);
 
-#define key_serial(key) ((key) ? (key)->serial : 0)
+static inline key_serial_t key_serial(struct key *key)
+{
+	return key ? key->serial : 0;
+}
 
 #ifdef CONFIG_SYSCTL
 extern ctl_table key_sysctls[];