On Tue, Apr 13, 2021 at 02:38:01PM +0300, Andy Shevchenko wrote:
> In some cases the printf() mechanism is too heavy and can't be used.
> For example, when debugging a race condition involving devres API.
> When CONFIG_DEBUG_DEVRES is enabled I can't reproduce an issue, and
> otherwise it's quite visible with a useful information being collected.
> 
> Enable trace events for devres part of the driver core.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevche...@linux.intel.com>
> ---
> v2: fixed compilation error (lkp), elaborate commit message (Greg)
>  drivers/base/Makefile |  3 +++
>  drivers/base/devres.c | 23 +++++++++++-------
>  drivers/base/trace.c  | 10 ++++++++
>  drivers/base/trace.h  | 56 +++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 83 insertions(+), 9 deletions(-)
>  create mode 100644 drivers/base/trace.c
>  create mode 100644 drivers/base/trace.h
> 
> diff --git a/drivers/base/Makefile b/drivers/base/Makefile
> index 8b93a7f291ec..ef8e44a7d288 100644
> --- a/drivers/base/Makefile
> +++ b/drivers/base/Makefile
> @@ -30,3 +30,6 @@ obj-y                       += test/
>  
>  ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
>  
> +# define_trace.h needs to know how to find our header
> +CFLAGS_trace.o               := -I$(src)
> +obj-$(CONFIG_TRACING)        += trace.o
> diff --git a/drivers/base/devres.c b/drivers/base/devres.c
> index db1f3137fc81..a0850bd1eab7 100644
> --- a/drivers/base/devres.c
> +++ b/drivers/base/devres.c
> @@ -14,14 +14,13 @@
>  #include <asm/sections.h>
>  
>  #include "base.h"
> +#include "trace.h"
>  
>  struct devres_node {
>       struct list_head                entry;
>       dr_release_t                    release;
> -#ifdef CONFIG_DEBUG_DEVRES
>       const char                      *name;
>       size_t                          size;
> -#endif

Those ifdefs are still required.

>  };

thanks,

-- 
heikki

Reply via email to