mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ren Zhijie <renzhijie2@huawei.com>
To: Guenter Roeck <linux@roeck-us.net>, <jdelvare@suse.com>,
	<dev_public@wujek.eu>
Cc: <linux-hwmon@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] hwmon: (pmbus) fix build error unused-function
Date: Thu, 9 Jun 2022 19:47:53 +0800	[thread overview]
Message-ID: <90d8eeb7-e114-3689-02b5-54f503452100@huawei.com> (raw)
In-Reply-To: <76e05a85-b8c3-eaa5-727e-d8dc8f1c0672@roeck-us.net>

在 2022/6/8 21:35, Guenter Roeck 写道:
> On 6/8/22 01:49, 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, wrap all related code with CONFIG_DEBUG_F.
>
> Please use __maybe_unused for the affected functions instead.
>
sure. will do that in patch v2.


Thanks,

Ren Zhijie

> Thanks,
> Guenter
>
>>
>> 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>
>> ---
>>   drivers/hwmon/pmbus/pmbus_core.c | 56 ++++++++++++++++----------------
>>   1 file changed, 28 insertions(+), 28 deletions(-)
>>
>> diff --git a/drivers/hwmon/pmbus/pmbus_core.c 
>> b/drivers/hwmon/pmbus/pmbus_core.c
>> index 809e666cb52b..2c68ab1fe697 100644
>> --- a/drivers/hwmon/pmbus/pmbus_core.c
>> +++ b/drivers/hwmon/pmbus/pmbus_core.c
>> @@ -441,18 +441,6 @@ int pmbus_update_byte_data(struct i2c_client 
>> *client, int page, u8 reg,
>>   }
>>   EXPORT_SYMBOL_NS_GPL(pmbus_update_byte_data, PMBUS);
>>   -static int pmbus_read_block_data(struct i2c_client *client, int 
>> page, u8 reg,
>> -                 char *data_buf)
>> -{
>> -    int rv;
>> -
>> -    rv = pmbus_set_page(client, page, 0xff);
>> -    if (rv < 0)
>> -        return rv;
>> -
>> -    return i2c_smbus_read_block_data(client, reg, data_buf);
>> -}
>> -
>>   static struct pmbus_sensor *pmbus_find_sensor(struct pmbus_data 
>> *data, int page,
>>                             int reg)
>>   {
>> @@ -590,22 +578,6 @@ 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,
>> -                       int reg)
>> -{
>> -    int rv;
>> -    struct pmbus_data *data = i2c_get_clientdata(client);
>> -    char data_buf[I2C_SMBUS_BLOCK_MAX + 2];
>> -
>> -    rv = pmbus_read_block_data(client, page, reg, data_buf);
>> -    if (rv >= 0 && !(data->flags & PMBUS_SKIP_STATUS_CHECK))
>> -        rv = pmbus_check_status_cml(client);
>> -    if (rv < 0 && (data->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK))
>> -        data->read_status(client, -1);
>> -    pmbus_clear_fault_page(client, -1);
>> -    return rv >= 0;
>> -}
>> -
>>   const struct pmbus_driver_info *pmbus_get_driver_info(struct 
>> i2c_client *client)
>>   {
>>       struct pmbus_data *data = i2c_get_clientdata(client);
>> @@ -2961,6 +2933,34 @@ static int pmbus_regulator_register(struct 
>> pmbus_data *data)
>>   static struct dentry *pmbus_debugfs_dir;    /* pmbus debugfs 
>> directory */
>>     #if IS_ENABLED(CONFIG_DEBUG_FS)
>> +static int pmbus_read_block_data(struct i2c_client *client, int 
>> page, u8 reg,
>> +                 char *data_buf)
>> +{
>> +    int rv;
>> +
>> +    rv = pmbus_set_page(client, page, 0xff);
>> +    if (rv < 0)
>> +        return rv;
>> +
>> +    return i2c_smbus_read_block_data(client, reg, data_buf);
>> +}
>> +
>> +static bool pmbus_check_block_register(struct i2c_client *client, 
>> int page,
>> +                       int reg)
>> +{
>> +    int rv;
>> +    struct pmbus_data *data = i2c_get_clientdata(client);
>> +    char data_buf[I2C_SMBUS_BLOCK_MAX + 2];
>> +
>> +    rv = pmbus_read_block_data(client, page, reg, data_buf);
>> +    if (rv >= 0 && !(data->flags & PMBUS_SKIP_STATUS_CHECK))
>> +        rv = pmbus_check_status_cml(client);
>> +    if (rv < 0 && (data->flags & PMBUS_READ_STATUS_AFTER_FAILED_CHECK))
>> +        data->read_status(client, -1);
>> +    pmbus_clear_fault_page(client, -1);
>> +    return rv >= 0;
>> +}
>> +
>>   static int pmbus_debugfs_get(void *data, u64 *val)
>>   {
>>       int rc;
>
> .


      reply	other threads:[~2022-06-09 11:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08  8:49 Ren Zhijie
2022-06-08 13:35 ` Guenter Roeck
2022-06-09 11:47   ` Ren Zhijie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=90d8eeb7-e114-3689-02b5-54f503452100@huawei.com \
    --to=renzhijie2@huawei.com \
    --cc=dev_public@wujek.eu \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®