Skip to contentSkip to conversation

: Mark a few functions static inline

PATCH In review Andy Shevchenko 2 participants 2 messages Oct 21, 2024 – Oct 24, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Mark a few functions static inline

The function prototypes that are defined in the header most likely has to be marked as static inline. This helps avoiding the compiler warnings:

include/mux.h:120:14: warning: no previous prototype for ‘mux_control_states’ [-Wmissing-prototypes] include/mux.h:125:18: warning: no previous prototype for ‘mux_control_select’ [-Wmissing-prototypes] include/mux.h:133:5: warning: no previous prototype for ‘mux_control_deselect’ [-Wmissing-prototypes] include/mux.h:138:21: warning: no previous prototype for ‘mux_control_get’ [-Wmissing-prototypes] include/mux.h:143:6: warning: no previous prototype for ‘mux_control_put’ [-Wmissing-prototypes] include/mux.h:147:21: warning: no previous prototype for ‘devm_mux_control_get’ [-Wmissing-prototypes] include/mux.h:153:5: warning: no previous prototype for ‘dm_mux_init’ [-Wmissing-prototype ]

---
 include/mux.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
include/mux.h +9 -9
index e5deaba66f44..cbb1c331db83 100644
@@ -117,40 +117,40 @@ struct mux_control *devm_mux_control_get(struct udevice *dev,
 int dm_mux_init(void);
 
 #else
-unsigned int mux_control_states(struct mux_control *mux)
+static inline unsigned int mux_control_states(struct mux_control *mux)
 {
 	return -ENOSYS;
 }
 
-int __must_check mux_control_select(struct mux_control *mux,
-				    unsigned int state)
+static inline int __must_check mux_control_select(struct mux_control *mux,
+						  unsigned int state)
 {
 	return -ENOSYS;
 }
 
 #define mux_control_try_select(mux, state) mux_control_select(mux, state)
 
-int mux_control_deselect(struct mux_control *mux)
+static inline int mux_control_deselect(struct mux_control *mux)
 {
 	return -ENOSYS;
 }
 
-struct mux_control *mux_control_get(struct udevice *dev, const char *mux_name)
+static inline struct mux_control *mux_control_get(struct udevice *dev, const char *mux_name)
 {
 	return NULL;
 }
 
-void mux_control_put(struct mux_control *mux)
+static inline void mux_control_put(struct mux_control *mux)
 {
 }
 
-struct mux_control *devm_mux_control_get(struct udevice *dev,
-					 const char *mux_name)
+static inline struct mux_control *devm_mux_control_get(struct udevice *dev,
+						       const char *mux_name)
 {
 	return NULL;
 }
 
-int dm_mux_init(void)
+static inline int dm_mux_init(void)
 {
 	return -ENOSYS;
 }
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#1 lore raw
Quoted 11 lines · Andy Shevchenko

The function prototypes that are defined in the header most likely has to be marked as static inline. This helps avoiding the compiler warnings:

include/mux.h:120:14: warning: no previous prototype for ‘mux_control_states’ [-Wmissing-prototypes] include/mux.h:125:18: warning: no previous prototype for ‘mux_control_select’ [-Wmissing-prototypes] include/mux.h:133:5: warning: no previous prototype for ‘mux_control_deselect’ [-Wmissing-prototypes] include/mux.h:138:21: warning: no previous prototype for ‘mux_control_get’ [-Wmissing-prototypes] include/mux.h:143:6: warning: no previous prototype for ‘mux_control_put’ [-Wmissing-prototypes] include/mux.h:147:21: warning: no previous prototype for ‘devm_mux_control_get’ [-Wmissing-prototypes] include/mux.h:153:5: warning: no previous prototype for ‘dm_mux_init’ [-Wmissing-prototype ]

Quoted 1 line

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom