Skip to contentSkip to conversation

cacheinfo: move cache_setup_acpi to header

PATCH In review Rosen Penev 2 participants 4 messages May 5 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cacheinfo: move cache_setup_acpi to header

cacheinfo.h already has handling for acpi_get_cache_info to be a static inline ENOTSUPP function. Move it there as both functions are in the same boat.

---
 drivers/base/cacheinfo.c  | 5 -----
 include/linux/cacheinfo.h | 8 +++++++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/base/cacheinfo.c +0 -5
index 391ac5e3d2f5..ca7f266729d1 100644
@@ -366,11 +366,6 @@ static inline int cache_setup_of_node(unsigned int cpu) { return 0; }
 int init_of_cache_level(unsigned int cpu) { return 0; }
 #endif
 
-int __weak cache_setup_acpi(unsigned int cpu)
-{
-	return -ENOTSUPP;
-}
-
 unsigned int coherency_max_size;
 
 static int cache_setup_properties(unsigned int cpu)
include/linux/cacheinfo.h +7 -1
index c8f4f0a0b874..73ab4a6e3551 100644
@@ -86,7 +86,6 @@ int early_cache_level(unsigned int cpu);
 int init_cache_level(unsigned int cpu);
 int init_of_cache_level(unsigned int cpu);
 int populate_cache_leaves(unsigned int cpu);
-int cache_setup_acpi(unsigned int cpu);
 bool last_level_cache_is_valid(unsigned int cpu);
 bool last_level_cache_is_shared(unsigned int cpu_x, unsigned int cpu_y);
 int fetch_cache_info(unsigned int cpu);
@@ -106,7 +105,14 @@ int acpi_get_cache_info(unsigned int cpu,
 {
 	return -ENOENT;
 }
+
+static inline
+int cache_setup_acpi(unsigned int cpu) {
+	return -ENOTSUPP;
+};
+
 #else
+int cache_setup_acpi(unsigned int cpu);
 int acpi_get_cache_info(unsigned int cpu,
 			unsigned int *levels, unsigned int *split_levels);
 #endif
Signature · 1 line
2.54.0
#1 lore raw
Quoted 57 lines · Rosen Penev

cacheinfo.h already has handling for acpi_get_cache_info to be a static inline ENOTSUPP function. Move it there as both functions are in the same boat.

---
 drivers/base/cacheinfo.c  | 5 -----
 include/linux/cacheinfo.h | 8 +++++++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/base/cacheinfo.c +0 -5
index 391ac5e3d2f5..ca7f266729d1 100644
@@ -366,11 +366,6 @@ static inline int cache_setup_of_node(unsigned int cpu) { return 0; }
 int init_of_cache_level(unsigned int cpu) { return 0; }
 #endif
 
-int __weak cache_setup_acpi(unsigned int cpu)
-{
-	return -ENOTSUPP;
-}
-
 unsigned int coherency_max_size;
 
 static int cache_setup_properties(unsigned int cpu)
include/linux/cacheinfo.h +7 -1
index c8f4f0a0b874..73ab4a6e3551 100644
@@ -86,7 +86,6 @@ int early_cache_level(unsigned int cpu);
 int init_cache_level(unsigned int cpu);
 int init_of_cache_level(unsigned int cpu);
 int populate_cache_leaves(unsigned int cpu);
-int cache_setup_acpi(unsigned int cpu);
 bool last_level_cache_is_valid(unsigned int cpu);
 bool last_level_cache_is_shared(unsigned int cpu_x, unsigned int cpu_y);
 int fetch_cache_info(unsigned int cpu);
@@ -106,7 +105,14 @@ int acpi_get_cache_info(unsigned int cpu,
 {
 	return -ENOENT;
 }
+
+static inline
+int cache_setup_acpi(unsigned int cpu) {
+	return -ENOTSUPP;
+};
+
 #else
+int cache_setup_acpi(unsigned int cpu);
 int acpi_get_cache_info(unsigned int cpu,
 			unsigned int *levels, unsigned int *split_levels);
 #endif
Signature · 1 line
2.54.0

Didn't checkpatch complain about this change?

And why get rid of the weak symbol, this should break some arch builds, right?

thanks,

greg k-h

#2 lore raw
Quoted 53 lines · Greg Kroah-Hartman
Quoted 51 lines · Rosen Penev

cacheinfo.h already has handling for acpi_get_cache_info to be a static inline ENOTSUPP function. Move it there as both functions are in the same boat.

---
 drivers/base/cacheinfo.c  | 5 -----
 include/linux/cacheinfo.h | 8 +++++++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/base/cacheinfo.c +0 -5
index 391ac5e3d2f5..ca7f266729d1 100644
@@ -366,11 +366,6 @@ static inline int cache_setup_of_node(unsigned int cpu) { return 0; }
 int init_of_cache_level(unsigned int cpu) { return 0; }
 #endif
 
-int __weak cache_setup_acpi(unsigned int cpu)
-{
-     return -ENOTSUPP;
-}
-
 unsigned int coherency_max_size;
 
 static int cache_setup_properties(unsigned int cpu)
include/linux/cacheinfo.h +7 -1
index c8f4f0a0b874..73ab4a6e3551 100644
@@ -86,7 +86,6 @@ int early_cache_level(unsigned int cpu);
 int init_cache_level(unsigned int cpu);
 int init_of_cache_level(unsigned int cpu);
 int populate_cache_leaves(unsigned int cpu);
-int cache_setup_acpi(unsigned int cpu);
 bool last_level_cache_is_valid(unsigned int cpu);
 bool last_level_cache_is_shared(unsigned int cpu_x, unsigned int cpu_y);
 int fetch_cache_info(unsigned int cpu);
@@ -106,7 +105,14 @@ int acpi_get_cache_info(unsigned int cpu,
 {
      return -ENOENT;
 }
+
+static inline
+int cache_setup_acpi(unsigned int cpu) {
+     return -ENOTSUPP;
+};
+
 #else
+int cache_setup_acpi(unsigned int cpu);
 int acpi_get_cache_info(unsigned int cpu,
Quoted 8 lines
Quoted 6 lines
include/linux/cacheinfo.h +0 -1
                      unsigned int *levels, unsigned int *split_levels);
 #endif
--

2.54.0

Didn't checkpatch complain about this change?

Hrm looks like it. I just matched the style of surrounding code.

Not sure about this though:
WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP

Quoted 3 lines

And why get rid of the weak symbol, this should break some arch builds, right?

The contrary. Fixes compilation with

make LLVM=1 ARCH=mips

Quoted 4 lines

thanks,

greg k-h

#3 lore raw
Quoted 63 lines · Rosen Penev
Quoted 53 lines · Greg Kroah-Hartman
Quoted 51 lines · Rosen Penev

cacheinfo.h already has handling for acpi_get_cache_info to be a static inline ENOTSUPP function. Move it there as both functions are in the same boat.

---
 drivers/base/cacheinfo.c  | 5 -----
 include/linux/cacheinfo.h | 8 +++++++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/base/cacheinfo.c +0 -5
index 391ac5e3d2f5..ca7f266729d1 100644
@@ -366,11 +366,6 @@ static inline int cache_setup_of_node(unsigned int cpu) { return 0; }
 int init_of_cache_level(unsigned int cpu) { return 0; }
 #endif
 
-int __weak cache_setup_acpi(unsigned int cpu)
-{
-     return -ENOTSUPP;
-}
-
 unsigned int coherency_max_size;
 
 static int cache_setup_properties(unsigned int cpu)
include/linux/cacheinfo.h +7 -1
index c8f4f0a0b874..73ab4a6e3551 100644
@@ -86,7 +86,6 @@ int early_cache_level(unsigned int cpu);
 int init_cache_level(unsigned int cpu);
 int init_of_cache_level(unsigned int cpu);
 int populate_cache_leaves(unsigned int cpu);
-int cache_setup_acpi(unsigned int cpu);
 bool last_level_cache_is_valid(unsigned int cpu);
 bool last_level_cache_is_shared(unsigned int cpu_x, unsigned int cpu_y);
 int fetch_cache_info(unsigned int cpu);
@@ -106,7 +105,14 @@ int acpi_get_cache_info(unsigned int cpu,
 {
      return -ENOENT;
 }
+
+static inline
+int cache_setup_acpi(unsigned int cpu) {
+     return -ENOTSUPP;
+};
+
 #else
+int cache_setup_acpi(unsigned int cpu);
 int acpi_get_cache_info(unsigned int cpu,
Quoted 8 lines
Quoted 6 lines
include/linux/cacheinfo.h +0 -1
                      unsigned int *levels, unsigned int *split_levels);
 #endif
--

2.54.0

Didn't checkpatch complain about this change?

Quoted 1 line

Hrm looks like it. I just matched the style of surrounding code.

Nope, look at the style of the inline function just above the one you added. You used a totally different (i.e. not kernel) style.

Quoted 2 lines

Not sure about this though:
WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP

That's not the issue here.

Quoted 5 lines
Quoted 2 lines

And why get rid of the weak symbol, this should break some arch builds, right?

The contrary. Fixes compilation with

make LLVM=1 ARCH=mips

So what commit caused this to break? Is this a new issue or something that has always been present?

thanks,

greg k-h