* [PATCH -next] hwmon: (amd_energy) Fix build error
@ 2020-05-27 13:02 YueHaibing
2020-05-27 13:22 ` Guenter Roeck
0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2020-05-27 13:02 UTC (permalink / raw)
To: nchatrad, jdelvare, linux, yuehaibing; +Cc: linux-hwmon, linux-kernel
If CONFIG_NEED_MULTIPLE_NODES is n, building fails:
drivers/hwmon/amd_energy.c: In function ‘amd_energy_read’:
./include/asm-generic/topology.h:51:36: error: void value not ignored as it ought to be
#define cpumask_of_node(node) ((void)node, cpu_online_mask)
./include/linux/cpumask.h:618:72: note: in definition of macro ‘cpumask_first_and’
#define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))
^~~~~
drivers/hwmon/amd_energy.c:194:6: note: in expansion of macro ‘cpumask_of_node’
cpumask_of_node
^~~~~~~~~~~~~~~
./include/asm-generic/topology.h:51:46: warning: left-hand operand of comma expression has no effect [-Wunused-value]
#define cpumask_of_node(node) ((void)node, cpu_online_mask)
^
./include/linux/cpumask.h:618:72: note: in definition of macro ‘cpumask_first_and’
#define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))
^~~~~
drivers/hwmon/amd_energy.c:194:6: note: in expansion of macro ‘cpumask_of_node’
cpumask_of_node
^~~~~~~~~~~~~~~
Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/hwmon/amd_energy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c
index bc8b643a37d5..9d5cd3057866 100644
--- a/drivers/hwmon/amd_energy.c
+++ b/drivers/hwmon/amd_energy.c
@@ -192,7 +192,7 @@ static int amd_energy_read(struct device *dev,
if (channel >= data->nr_cpus) {
cpu = cpumask_first_and(cpu_online_mask,
cpumask_of_node
- (channel - data->nr_cpus));
+ ((channel - data->nr_cpus)));
amd_add_delta(data, channel, cpu, val, false);
} else {
cpu = channel;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] hwmon: (amd_energy) Fix build error
2020-05-27 13:02 [PATCH -next] hwmon: (amd_energy) Fix build error YueHaibing
@ 2020-05-27 13:22 ` Guenter Roeck
2020-05-28 1:10 ` Yuehaibing
0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2020-05-27 13:22 UTC (permalink / raw)
To: YueHaibing, nchatrad, jdelvare; +Cc: linux-hwmon, linux-kernel
On 5/27/20 6:02 AM, YueHaibing wrote:
> If CONFIG_NEED_MULTIPLE_NODES is n, building fails:
>
> drivers/hwmon/amd_energy.c: In function ‘amd_energy_read’:
> ./include/asm-generic/topology.h:51:36: error: void value not ignored as it ought to be
> #define cpumask_of_node(node) ((void)node, cpu_online_mask)
> ./include/linux/cpumask.h:618:72: note: in definition of macro ‘cpumask_first_and’
> #define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))
> ^~~~~
> drivers/hwmon/amd_energy.c:194:6: note: in expansion of macro ‘cpumask_of_node’
> cpumask_of_node
> ^~~~~~~~~~~~~~~
> ./include/asm-generic/topology.h:51:46: warning: left-hand operand of comma expression has no effect [-Wunused-value]
> #define cpumask_of_node(node) ((void)node, cpu_online_mask)
> ^
> ./include/linux/cpumask.h:618:72: note: in definition of macro ‘cpumask_first_and’
> #define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))
> ^~~~~
> drivers/hwmon/amd_energy.c:194:6: note: in expansion of macro ‘cpumask_of_node’
> cpumask_of_node
> ^~~~~~~~~~~~~~~
>
> Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/hwmon/amd_energy.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c
> index bc8b643a37d5..9d5cd3057866 100644
> --- a/drivers/hwmon/amd_energy.c
> +++ b/drivers/hwmon/amd_energy.c
> @@ -192,7 +192,7 @@ static int amd_energy_read(struct device *dev,
> if (channel >= data->nr_cpus) {
> cpu = cpumask_first_and(cpu_online_mask,
> cpumask_of_node
> - (channel - data->nr_cpus));
> + ((channel - data->nr_cpus)));
Wrong fix. The correct fix is to fix the macro, not its caller.
A patch to fix the macro has been submitted.
Guenter
> amd_add_delta(data, channel, cpu, val, false);
> } else {
> cpu = channel;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] hwmon: (amd_energy) Fix build error
2020-05-27 13:22 ` Guenter Roeck
@ 2020-05-28 1:10 ` Yuehaibing
0 siblings, 0 replies; 3+ messages in thread
From: Yuehaibing @ 2020-05-28 1:10 UTC (permalink / raw)
To: Guenter Roeck, nchatrad, jdelvare; +Cc: linux-hwmon, linux-kernel
On 2020/5/27 21:22, Guenter Roeck wrote:
> On 5/27/20 6:02 AM, YueHaibing wrote:
>> If CONFIG_NEED_MULTIPLE_NODES is n, building fails:
>>
>> drivers/hwmon/amd_energy.c: In function ‘amd_energy_read’:
>> ./include/asm-generic/topology.h:51:36: error: void value not ignored as it ought to be
>> #define cpumask_of_node(node) ((void)node, cpu_online_mask)
>> ./include/linux/cpumask.h:618:72: note: in definition of macro ‘cpumask_first_and’
>> #define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))
>> ^~~~~
>> drivers/hwmon/amd_energy.c:194:6: note: in expansion of macro ‘cpumask_of_node’
>> cpumask_of_node
>> ^~~~~~~~~~~~~~~
>> ./include/asm-generic/topology.h:51:46: warning: left-hand operand of comma expression has no effect [-Wunused-value]
>> #define cpumask_of_node(node) ((void)node, cpu_online_mask)
>> ^
>> ./include/linux/cpumask.h:618:72: note: in definition of macro ‘cpumask_first_and’
>> #define cpumask_first_and(src1p, src2p) cpumask_next_and(-1, (src1p), (src2p))
>> ^~~~~
>> drivers/hwmon/amd_energy.c:194:6: note: in expansion of macro ‘cpumask_of_node’
>> cpumask_of_node
>> ^~~~~~~~~~~~~~~
>>
>> Fixes: 8abee9566b7e ("hwmon: Add amd_energy driver to report energy counters")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>> drivers/hwmon/amd_energy.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwmon/amd_energy.c b/drivers/hwmon/amd_energy.c
>> index bc8b643a37d5..9d5cd3057866 100644
>> --- a/drivers/hwmon/amd_energy.c
>> +++ b/drivers/hwmon/amd_energy.c
>> @@ -192,7 +192,7 @@ static int amd_energy_read(struct device *dev,
>> if (channel >= data->nr_cpus) {
>> cpu = cpumask_first_and(cpu_online_mask,
>> cpumask_of_node
>> - (channel - data->nr_cpus));
>> + ((channel - data->nr_cpus)));
>
> Wrong fix. The correct fix is to fix the macro, not its caller.
> A patch to fix the macro has been submitted.
>
Thanks, missing that.
> Guenter
>
>
>> amd_add_delta(data, channel, cpu, val, false);
>> } else {
>> cpu = channel;
>>
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-28 1:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 13:02 [PATCH -next] hwmon: (amd_energy) Fix build error YueHaibing
2020-05-27 13:22 ` Guenter Roeck
2020-05-28 1:10 ` Yuehaibing
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.