lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <773a2199a5f4230db73dc77c0000e645e3d035c5.1499988064.git.sathyanarayanan.kuppuswamy@linux.intel.com>
Date:   Thu, 13 Jul 2017 16:52:40 -0700
From:   sathyanarayanan.kuppuswamy@...ux.intel.com
To:     peda@...ntia.se
Cc:     linux-kernel@...r.kernel.org, sathyaosid@...il.com,
        andy@...radead.org,
        Kuppuswamy Sathyanarayanan 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>
Subject: [PATCH v3 1/1] mux: consumer: Add dummy functions for !CONFIG_MULTIPLEXER case

From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>

Add dummy functions to avoid compile time issues when CONFIG_MULTIPLEXER
is not enabled.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
---
 include/linux/mux/consumer.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

Changes since v1: 
 * Changed #ifdef to #if IS_ENABLED.

Changes since v2:
 * Addressed issues reported by Peter and Andy.
 * Return 0 for mux_control_states().
 * Return -EINVAL for control select()/deselect() calls.
 * Added static inline for all dummy functions.

diff --git a/include/linux/mux/consumer.h b/include/linux/mux/consumer.h
index 5577e1b..dc0cb7d 100644
--- a/include/linux/mux/consumer.h
+++ b/include/linux/mux/consumer.h
@@ -16,6 +16,8 @@
 struct device;
 struct mux_control;
 
+#if IS_ENABLED(CONFIG_MULTIPLEXER)
+
 unsigned int mux_control_states(struct mux_control *mux);
 int __must_check mux_control_select(struct mux_control *mux,
 				    unsigned int state);
@@ -29,4 +31,44 @@ void mux_control_put(struct mux_control *mux);
 struct mux_control *devm_mux_control_get(struct device *dev,
 					 const char *mux_name);
 
+#else
+
+static inline unsigned int mux_control_states(struct mux_control *mux)
+{
+	return 0;
+}
+
+static inline int __must_check mux_control_select(struct mux_control *mux,
+						  unsigned int state)
+{
+	return -EINVAL;
+}
+
+static inline int __must_check mux_control_try_select(struct mux_control *mux,
+						      unsigned int state)
+{
+	return -EINVAL;
+}
+
+static inline int mux_control_deselect(struct mux_control *mux)
+{
+	return -EINVAL;
+}
+
+static inline struct mux_control *mux_control_get(struct device *dev,
+						  const char *mux_name)
+{
+	return ERR_PTR(-ENODEV);
+}
+
+static inline void mux_control_put(struct mux_control *mux) {}
+
+static inline struct mux_control *devm_mux_control_get(struct device *dev,
+						       const char *mux_name)
+{
+	return ERR_PTR(-ENODEV);
+}
+
+#endif /* CONFIG_MULTIPLEXER */
+
 #endif /* _LINUX_MUX_CONSUMER_H */
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ