aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/debugobjects.h
diff options
context:
space:
mode:
authorDu, Changbin <changbin.du@intel.com>2016-05-19 20:09:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-19 22:12:14 -0400
commitb1e4d9d82df8ab9097f80aa208c40eab6fc29858 (patch)
treeb62106f744b91e4851dc50059ed5ce5f19ead66e /include/linux/debugobjects.h
parentb21e91c305bcebf55b7a34638e5885528f3fb453 (diff)
debugobjects: make fixup functions return bool instead of int
I am going to introduce debugobjects infrastructure to USB subsystem. But before this, I found the code of debugobjects could be improved. This patchset will make fixup functions return bool type instead of int. Because fixup only need report success or no. boolean is the 'real' type. This patch (of 7): The object debugging infrastructure core provides some fixup callbacks for the subsystem who use it. These callbacks are called from the debug code whenever a problem in debug_object_init is detected. And debugobjects core suppose them returns 1 when the fixup was successful, otherwise 0. So the return type is boolean. A bad thing is that debug_object_fixup use the return value for arithmetic operation. It confused me that what is the reall return type. Reading over the whole code, I found some place do use the return value incorrectly(see next patch). So why use bool type instead? Signed-off-by: Du, Changbin <changbin.du@intel.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Josh Triplett <josh@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tejun Heo <tj@kernel.org> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/debugobjects.h')
-rw-r--r--include/linux/debugobjects.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 98ffcbd4888e..a899f10c9365 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -39,7 +39,8 @@ struct debug_obj {
39 * @debug_hint: function returning address, which have associated 39 * @debug_hint: function returning address, which have associated
40 * kernel symbol, to allow identify the object 40 * kernel symbol, to allow identify the object
41 * @fixup_init: fixup function, which is called when the init check 41 * @fixup_init: fixup function, which is called when the init check
42 * fails 42 * fails. All fixup functions must return true if fixup
43 * was successful, otherwise return false
43 * @fixup_activate: fixup function, which is called when the activate check 44 * @fixup_activate: fixup function, which is called when the activate check
44 * fails 45 * fails
45 * @fixup_destroy: fixup function, which is called when the destroy check 46 * @fixup_destroy: fixup function, which is called when the destroy check
@@ -51,12 +52,12 @@ struct debug_obj {
51 */ 52 */
52struct debug_obj_descr { 53struct debug_obj_descr {
53 const char *name; 54 const char *name;
54 void *(*debug_hint) (void *addr); 55 void *(*debug_hint)(void *addr);
55 int (*fixup_init) (void *addr, enum debug_obj_state state); 56 bool (*fixup_init)(void *addr, enum debug_obj_state state);
56 int (*fixup_activate) (void *addr, enum debug_obj_state state); 57 bool (*fixup_activate)(void *addr, enum debug_obj_state state);
57 int (*fixup_destroy) (void *addr, enum debug_obj_state state); 58 bool (*fixup_destroy)(void *addr, enum debug_obj_state state);
58 int (*fixup_free) (void *addr, enum debug_obj_state state); 59 bool (*fixup_free)(void *addr, enum debug_obj_state state);
59 int (*fixup_assert_init)(void *addr, enum debug_obj_state state); 60 bool (*fixup_assert_init)(void *addr, enum debug_obj_state state);
60}; 61};
61 62
62#ifdef CONFIG_DEBUG_OBJECTS 63#ifdef CONFIG_DEBUG_OBJECTS