diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-10-20 22:07:53 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-12 11:39:24 +0100 |
commit | e641c92fd2ae2c4a54810cae66c161c9cc5b06a4 (patch) | |
tree | 7b3354cf048b877838fd7bd92c56bedb0caba9ce /include/linux/clkdev.h | |
parent | 629138cd28becfed37527a02219150e1c2aa580a (diff) | |
download | linux-stable-e641c92fd2ae2c4a54810cae66c161c9cc5b06a4.tar.gz linux-stable-e641c92fd2ae2c4a54810cae66c161c9cc5b06a4.tar.bz2 linux-stable-e641c92fd2ae2c4a54810cae66c161c9cc5b06a4.zip |
debugfs: improve DEFINE_DEBUGFS_ATTRIBUTE for !CONFIG_DEBUG_FS
commit 7f847dd31736f1284538e54f46cf10e63929eb7f upstream.
The slp_s0_residency_usec debugfs file currently uses
DEFINE_DEBUGFS_ATTRIBUTE(), but that macro cannot really be used to
define files outside of the debugfs code, as it has no reference to
the get/set functions if CONFIG_DEBUG_FS is not defined:
drivers/platform/x86/intel_pmc_core.c:80:12: error: ‘pmc_core_dev_state_get’ defined but not used [-Werror=unused-function]
This fixes the macro to always contain the reference, and instead rely
on the stubbed-out debugfs_create_file to not actually refer to
its arguments so the compiler can still drop the reference.
This works because the attribute definition is always 'static',
and the dead-code removal silently drops all static symbols
that are not used.
Fixes: c64688081490 ("debugfs: add support for self-protecting attribute file fops")
Fixes: df2294fb6428 ("intel_pmc_core: Convert to DEFINE_DEBUGFS_ATTRIBUTE")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[nicstange@gmail.com: Add dummy implementations of debugfs_attr_read() and
debugfs_attr_write() in order to protect against possibly broken dead
code elimination and to improve readability.
Correct CONFIG_DEBUGFS_FS -> CONFIG_DEBUG_FS typo in changelog.]
Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/clkdev.h')
0 files changed, 0 insertions, 0 deletions