Skip to content

Commit bb74e8c

Browse files
Guenter Roecktorvalds
authored andcommitted
hwmon: (coretemp) Fix compile error if CONFIG_SMP is not defined
cpu_sibling_mask() is not defined unless CONFIG_SMP is defined, so it must not be used directly in the code without ifdef protection. To solve the problem and avoid ifdefs in the code, define for_each_sibling() and use it instead. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Durgadoss R <durgadoss.r@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 30cb6d5 commit bb74e8c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎drivers/hwmon/coretemp.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@
5151
#define TO_PHYS_ID(cpu) cpu_data(cpu).phys_proc_id
5252
#define TO_CORE_ID(cpu) cpu_data(cpu).cpu_core_id
5353
#define TO_ATTR_NO(cpu) (TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO)
54+
#define for_each_sibling(i, cpu) for_each_cpu(i, cpu_sibling_mask(cpu))
5455
#else
5556
#define TO_PHYS_ID(cpu) (cpu)
5657
#define TO_CORE_ID(cpu) (cpu)
5758
#define TO_ATTR_NO(cpu) (cpu)
59+
#define for_each_sibling(i, cpu) for (i = 0; false; )
5860
#endif
5961

6062
/*
@@ -762,7 +764,7 @@ static void __cpuinit put_core_offline(unsigned int cpu)
762764
coretemp_remove_core(pdata, &pdev->dev, indx);
763765

764766
/* Online the HT version of this core, if any */
765-
for_each_cpu(i, cpu_sibling_mask(cpu)) {
767+
for_each_sibling(i, cpu) {
766768
if (i != cpu) {
767769
get_core_online(i);
768770
break;

0 commit comments

Comments
 (0)