* [PATCH] arm/komeda: Compile DEFINE_SHOW_ATTRIBUTE() only when CONFIG_DEBUG_FS is enabled @ 2024-06-06 7:58 pengfuyuan 2024-06-06 8:20 ` Jani Nikula 0 siblings, 1 reply; 3+ messages in thread From: pengfuyuan @ 2024-06-06 7:58 UTC (permalink / raw) To: Liviu Dudau Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter, dri-devel, linux-kernel, pengfuyuan, k2ci We do not call komeda_debugfs_init() and the debugfs core function declaration if CONFIG_DEBUG_FS is not defined, but we should not compile it either because the debugfs core function declaration is not included. Reported-by: k2ci <kernel-bot@kylinos.cn> Signed-off-by: pengfuyuan <pengfuyuan@kylinos.cn> --- drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c index 14ee79becacb..7ada8e6f407c 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c @@ -21,6 +21,7 @@ #include "komeda_dev.h" +#ifdef CONFIG_DEBUG_FS static int komeda_register_show(struct seq_file *sf, void *x) { struct komeda_dev *mdev = sf->private; @@ -43,7 +44,6 @@ static int komeda_register_show(struct seq_file *sf, void *x) DEFINE_SHOW_ATTRIBUTE(komeda_register); -#ifdef CONFIG_DEBUG_FS static void komeda_debugfs_init(struct komeda_dev *mdev) { if (!debugfs_initialized()) -- 2.25.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] arm/komeda: Compile DEFINE_SHOW_ATTRIBUTE() only when CONFIG_DEBUG_FS is enabled 2024-06-06 7:58 [PATCH] arm/komeda: Compile DEFINE_SHOW_ATTRIBUTE() only when CONFIG_DEBUG_FS is enabled pengfuyuan @ 2024-06-06 8:20 ` Jani Nikula 2024-06-06 11:18 ` Liviu Dudau 0 siblings, 1 reply; 3+ messages in thread From: Jani Nikula @ 2024-06-06 8:20 UTC (permalink / raw) To: pengfuyuan, Liviu Dudau Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter, dri-devel, linux-kernel, pengfuyuan, k2ci On Thu, 06 Jun 2024, pengfuyuan <pengfuyuan@kylinos.cn> wrote: > We do not call komeda_debugfs_init() and the debugfs core function > declaration if CONFIG_DEBUG_FS is not defined, but we should not > compile it either because the debugfs core function declaration is > not included. > > Reported-by: k2ci <kernel-bot@kylinos.cn> > Signed-off-by: pengfuyuan <pengfuyuan@kylinos.cn> An interesting alternative might actually be to remove *all* the CONFIG_DEBUG_FS conditional compilation from the file. Since the debugfs functions have no-op stubs for CONFIG_DEBUG_FS=n, the compiler will optimize the rest away, because they're no longer referenced. (For the same reason, I don't think this patch has an impact for code size.) The upside for removing conditional compilation is that you'll actually do build testing for both CONFIG_DEBUG_FS config values. Assuming most developers have it enabled, there's not a lot of testing going on for CONFIG_DEBUG_FS=n, and you might introduce build failures with the conditional compilation. Of course, up to Liviu to decide. BR, Jani. > --- > drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c > index 14ee79becacb..7ada8e6f407c 100644 > --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c > @@ -21,6 +21,7 @@ > > #include "komeda_dev.h" > > +#ifdef CONFIG_DEBUG_FS > static int komeda_register_show(struct seq_file *sf, void *x) > { > struct komeda_dev *mdev = sf->private; > @@ -43,7 +44,6 @@ static int komeda_register_show(struct seq_file *sf, void *x) > > DEFINE_SHOW_ATTRIBUTE(komeda_register); > > -#ifdef CONFIG_DEBUG_FS > static void komeda_debugfs_init(struct komeda_dev *mdev) > { > if (!debugfs_initialized()) -- Jani Nikula, Intel ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] arm/komeda: Compile DEFINE_SHOW_ATTRIBUTE() only when CONFIG_DEBUG_FS is enabled 2024-06-06 8:20 ` Jani Nikula @ 2024-06-06 11:18 ` Liviu Dudau 0 siblings, 0 replies; 3+ messages in thread From: Liviu Dudau @ 2024-06-06 11:18 UTC (permalink / raw) To: Jani Nikula Cc: pengfuyuan, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter, dri-devel, linux-kernel, k2ci On Thu, Jun 06, 2024 at 11:20:58AM +0300, Jani Nikula wrote: > On Thu, 06 Jun 2024, pengfuyuan <pengfuyuan@kylinos.cn> wrote: > > We do not call komeda_debugfs_init() and the debugfs core function > > declaration if CONFIG_DEBUG_FS is not defined, but we should not > > compile it either because the debugfs core function declaration is > > not included. > > > > Reported-by: k2ci <kernel-bot@kylinos.cn> Can we see what the bot reported? > > Signed-off-by: pengfuyuan <pengfuyuan@kylinos.cn> > > An interesting alternative might actually be to remove *all* the > CONFIG_DEBUG_FS conditional compilation from the file. Since the debugfs > functions have no-op stubs for CONFIG_DEBUG_FS=n, the compiler will > optimize the rest away, because they're no longer referenced. (For the > same reason, I don't think this patch has an impact for code size.) > > The upside for removing conditional compilation is that you'll actually > do build testing for both CONFIG_DEBUG_FS config values. Assuming most > developers have it enabled, there's not a lot of testing going on for > CONFIG_DEBUG_FS=n, and you might introduce build failures with the > conditional compilation. > > Of course, up to Liviu to decide. Yeah, I quite like the idea of removing the conditional compilation from the file entirely. Pengfuyuan, do you mind sending a new patch removing all the CONFIG_DEBUG_FS from the file, rather than moving things around? Best regards, Liviu > > > BR, > Jani. > > > > --- > > drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c > > index 14ee79becacb..7ada8e6f407c 100644 > > --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c > > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c > > @@ -21,6 +21,7 @@ > > > > #include "komeda_dev.h" > > > > +#ifdef CONFIG_DEBUG_FS > > static int komeda_register_show(struct seq_file *sf, void *x) > > { > > struct komeda_dev *mdev = sf->private; > > @@ -43,7 +44,6 @@ static int komeda_register_show(struct seq_file *sf, void *x) > > > > DEFINE_SHOW_ATTRIBUTE(komeda_register); > > > > -#ifdef CONFIG_DEBUG_FS > > static void komeda_debugfs_init(struct komeda_dev *mdev) > > { > > if (!debugfs_initialized()) > > -- > Jani Nikula, Intel -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯ ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-06 11:18 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-06-06 7:58 [PATCH] arm/komeda: Compile DEFINE_SHOW_ATTRIBUTE() only when CONFIG_DEBUG_FS is enabled pengfuyuan 2024-06-06 8:20 ` Jani Nikula 2024-06-06 11:18 ` Liviu Dudau
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.