Skip to contentSkip to conversation

Staging: android: Remove unneeded definition in header file

PATCH In review Shraddha Barke 4 participants 7 messages Oct 1, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: android: Remove unneeded definition in header file

These struct are globally defined in source file but they have been defined as static in .h file. Remove definition in header file as it is not needed. Also fix the compiler warning.

---
 drivers/staging/android/sw_sync.h | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/staging/android/sw_sync.h +0 -15
index c87ae9e..a671595 100644
@@ -39,21 +39,6 @@ struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
 void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
 
 struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
-#else
-static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
-{
-	return NULL;
-}
-
-static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
-{
-}
-
-static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj,
-						u32 value)
-{
-	return NULL;
-}
 #endif /* IS_ENABLED(CONFIG_SW_SYNC) */
 
 #endif /* _LINUX_SW_SYNC_H */
Signature · 1 line
2.1.4
maintainer
#1 lore raw
Quoted 25 lines · Shraddha Barke

These struct are globally defined in source file but they have been defined as static in .h file. Remove definition in header file as it is not needed. Also fix the compiler warning.

---
 drivers/staging/android/sw_sync.h | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/staging/android/sw_sync.h +0 -8
index c87ae9e..a671595 100644
@@ -39,21 +39,6 @@ struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
 void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
 
 struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
-#else
-static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
-{
-	return NULL;
-}
-
-static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
-{

drivers/staging/android/sw_sync.h struct sw_sync_timeline *sw_sync_timeline_create(const char *name); · line 44

Quoted 10 lines
drivers/staging/android/sw_sync.h +0 -7
-}
-
-static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj,
-						u32 value)
-{
-	return NULL;
-}
 #endif /* IS_ENABLED(CONFIG_SW_SYNC) */
 
 #endif /* _LINUX_SW_SYNC_H */

You just broke the build for systems that don't define CONFIG_SW_SYNC yet still call these functions :(

Yes, it's tricky as there are no in-kernel users of these functions, that's the joy of the android code, external, out-of-tree code depends on the in-kernel code right now due to not everything being merged yet.

So, sorry, I can't take this patch.

greg k-h

#2 lore raw
Quoted 35 lines · Greg KH
Quoted 34 lines · Shraddha Barke

These struct are globally defined in source file but they have been defined as static in .h file. Remove definition in header file as it is not needed. Also fix the compiler warning.

---
 drivers/staging/android/sw_sync.h | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/staging/android/sw_sync.h +0 -15
index c87ae9e..a671595 100644
@@ -39,21 +39,6 @@ struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
 void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
 
 struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
-#else
-static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
-{
-	return NULL;
-}
-
-static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
-{
-}
-
-static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj,
-						u32 value)
-{
-	return NULL;
-}
 #endif /* IS_ENABLED(CONFIG_SW_SYNC) */
 
Quoted 4 lines

drivers/staging/android/sw_sync.h struct sw_sync_timeline *sw_sync_timeline_create(const char *name); · line 44

Quoted 1 line
drivers/staging/android/sw_sync.h +0 -0
 #endif /* _LINUX_SW_SYNC_H */

You just broke the build for systems that don't define CONFIG_SW_SYNC yet still call these functions :(

I had the same doubt so i tested it with CONFIG_SW_SYNC disabled in my .config, but the build didn't break.
Is it because the only use of sw_sync_timeline_inc is from sw_sync.c which will build only if CONFIG_SW_SYNC is defined?

regards
sudip

maintainer
#3 lore raw
Quoted 36 lines · Sudip Mukherjee
Quoted 35 lines · Greg KH
Quoted 34 lines · Shraddha Barke

These struct are globally defined in source file but they have been defined as static in .h file. Remove definition in header file as it is not needed. Also fix the compiler warning.

---
 drivers/staging/android/sw_sync.h | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/staging/android/sw_sync.h +0 -15
index c87ae9e..a671595 100644
@@ -39,21 +39,6 @@ struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
 void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
 
 struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
-#else
-static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
-{
-	return NULL;
-}
-
-static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
-{
-}
-
-static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj,
-						u32 value)
-{
-	return NULL;
-}
 #endif /* IS_ENABLED(CONFIG_SW_SYNC) */
 
Quoted 7 lines
Quoted 4 lines

drivers/staging/android/sw_sync.h struct sw_sync_timeline *sw_sync_timeline_create(const char *name); · line 44

Quoted 1 line
drivers/staging/android/sw_sync.h +0 -0
 #endif /* _LINUX_SW_SYNC_H */

You just broke the build for systems that don't define CONFIG_SW_SYNC yet still call these functions :(

I had the same doubt so i tested it with CONFIG_SW_SYNC disabled in my .config, but the build didn't break.

That is because this code is for out-of-tree code :(

Quoted 2 lines

Is it because the only use of sw_sync_timeline_inc is from sw_sync.c which will build only if CONFIG_SW_SYNC is defined?

Yes, but other files might use those functions and they need to still build if the config option is not enabled.

thanks,

greg k-h

#4 lore raw
Quoted 2 lines

Yes, but other files might use those functions and they need to still build if the config option is not enabled.

Are there some drivers in particular for which one should watch out for this issue?

thanks,
julia

#6 lore raw
In reply to Greg KH
Quoted 35 lines · Greg KH
Quoted 34 lines · Shraddha Barke

These struct are globally defined in source file but they have been defined as static in .h file. Remove definition in header file as it is not needed. Also fix the compiler warning.

---
 drivers/staging/android/sw_sync.h | 15 ---------------
 1 file changed, 15 deletions(-)
drivers/staging/android/sw_sync.h +0 -15
index c87ae9e..a671595 100644
@@ -39,21 +39,6 @@ struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
 void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
 
 struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
-#else
-static inline struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
-{
-	return NULL;
-}
-
-static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
-{
-}
-
-static inline struct sync_pt *sw_sync_pt_create(struct sw_sync_timeline *obj,
-						u32 value)
-{
-	return NULL;
-}
 #endif /* IS_ENABLED(CONFIG_SW_SYNC) */
 
Quoted 8 lines

drivers/staging/android/sw_sync.h struct sw_sync_timeline *sw_sync_timeline_create(const char *name); · line 44

Quoted 1 line
drivers/staging/android/sw_sync.h +0 -0
 #endif /* _LINUX_SW_SYNC_H */

You just broke the build for systems that don't define CONFIG_SW_SYNC yet still call these functions :(

Yes, it's tricky as there are no in-kernel users of these functions, that's the joy of the android code, external, out-of-tree code depends on the in-kernel code right now due to not everything being merged yet.

I'm sorry. I had build tested it by disabling the CONFIG_SW_SYNC option before sending but like you said since it's out of kernel code, couldn't figure out that it's wrong. Is there a way to differentiate such cases?

Thanks,

Shraddha

Quoted 5 lines

So, sorry, I can't take this patch.

greg k-h

maintainer
#5 lore raw
In reply to Julia Lawall
Quoted 5 lines · Julia Lawall
Quoted 2 lines

Yes, but other files might use those functions and they need to still build if the config option is not enabled.

Are there some drivers in particular for which one should watch out for this issue?

drivers/staging/android/ should be the only stuff that has this issue. I'd recommend everyone staying away from drivers/staging/android/ unless you are an Andoid kernel developer, and even those people know to keep away from it :)

thanks,

greg k-h