* [PATCH v2 -next] hwmon: (pmbus) fix build error unused-function
@ 2022-06-09 12:04 Ren Zhijie
2022-06-09 12:54 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Ren Zhijie @ 2022-06-09 12:04 UTC (permalink / raw)
To: linux, jdelvare, dev_public; +Cc: linux-hwmon, linux-kernel, Ren Zhijie
If CONFIG_PMBUS is y and CONFIG_DEBUG_FS is not set.
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will be failed, like this:
drivers/hwmon/pmbus/pmbus_core.c:593:13: error: ‘pmbus_check_block_register’ defined but not used [-Werror=unused-function]
static bool pmbus_check_block_register(struct i2c_client *client, int page,
^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [drivers/hwmon/pmbus/pmbus_core.o] Error 1
make[2]: *** [drivers/hwmon/pmbus] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [drivers/hwmon] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [drivers] Error 2
To fix building warning, use __maybe_unused to attach this func.
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: c3ffc3a1ff83("hwmon: (pmbus) add a function to check the presence of a block register")
Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
---
v2: use __maybe_unused to attach this function, which Guenter suggested.
---
drivers/hwmon/pmbus/pmbus_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 809e666cb52b..e6d3a1118453 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -590,7 +590,7 @@ bool pmbus_check_word_register(struct i2c_client *client, int page, int reg)
}
EXPORT_SYMBOL_NS_GPL(pmbus_check_word_register, PMBUS);
-static bool pmbus_check_block_register(struct i2c_client *client, int page,
+static bool __maybe_unused pmbus_check_block_register(struct i2c_client *client, int page,
int reg)
{
int rv;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 -next] hwmon: (pmbus) fix build error unused-function
2022-06-09 12:04 [PATCH v2 -next] hwmon: (pmbus) fix build error unused-function Ren Zhijie
@ 2022-06-09 12:54 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2022-06-09 12:54 UTC (permalink / raw)
To: Ren Zhijie; +Cc: jdelvare, dev_public, linux-hwmon, linux-kernel
On Thu, Jun 09, 2022 at 08:04:48PM +0800, Ren Zhijie wrote:
> If CONFIG_PMBUS is y and CONFIG_DEBUG_FS is not set.
>
> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will be failed, like this:
> drivers/hwmon/pmbus/pmbus_core.c:593:13: error: ‘pmbus_check_block_register’ defined but not used [-Werror=unused-function]
> static bool pmbus_check_block_register(struct i2c_client *client, int page,
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[3]: *** [drivers/hwmon/pmbus/pmbus_core.o] Error 1
> make[2]: *** [drivers/hwmon/pmbus] Error 2
> make[2]: *** Waiting for unfinished jobs....
> make[1]: *** [drivers/hwmon] Error 2
> make[1]: *** Waiting for unfinished jobs....
> make: *** [drivers] Error 2
>
> To fix building warning, use __maybe_unused to attach this func.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Fixes: c3ffc3a1ff83("hwmon: (pmbus) add a function to check the presence of a block register")
> Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
Applied.
Thanks,
Guenter
> ---
> v2: use __maybe_unused to attach this function, which Guenter suggested.
> ---
> drivers/hwmon/pmbus/pmbus_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 809e666cb52b..e6d3a1118453 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -590,7 +590,7 @@ bool pmbus_check_word_register(struct i2c_client *client, int page, int reg)
> }
> EXPORT_SYMBOL_NS_GPL(pmbus_check_word_register, PMBUS);
>
> -static bool pmbus_check_block_register(struct i2c_client *client, int page,
> +static bool __maybe_unused pmbus_check_block_register(struct i2c_client *client, int page,
> int reg)
> {
> int rv;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-09 12:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 12:04 [PATCH v2 -next] hwmon: (pmbus) fix build error unused-function Ren Zhijie
2022-06-09 12:54 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).