Skip to contentSkip to conversation

firmware_loader: simplfy builtin or module check

PATCH Superseded Luis Chamberlain 3 participants 5 messages Jan 12, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Luis Chamberlain

author maintainer
#0 lore raw

PATCH 1/1 firmware_loader: simplfy builtin or module check

The existing check is outdated and confuses developers. Use the already existing IS_ENABLED() defined on kconfig.h which makes the intention much clearer.

---
 include/linux/firmware.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/firmware.h +1 -1
index 3b057dfc8284..fa3493dbe84a 100644
@@ -34,7 +34,7 @@ static inline bool firmware_request_builtin(struct firmware *fw,
 }
 #endif
 
-#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))
+#if IS_ENABLED(CONFIG_FW_LOADER)
 int request_firmware(const struct firmware **fw, const char *name,
 		     struct device *device);
 int firmware_request_nowarn(const struct firmware **fw, const char *name,
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Luis Chamberlain

The existing check is outdated and confuses developers. Use the already existing IS_ENABLED() defined on kconfig.h which makes the intention much clearer.

Thanks.

include/linux/firmware.h static inline bool firmware_request_builtin(struct firmware *fw, · line 37

Quoted 13 lines
---
 include/linux/firmware.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/firmware.h +0 -1
index 3b057dfc8284..fa3493dbe84a 100644
@@ -34,7 +34,7 @@ static inline bool firmware_request_builtin(struct firmware *fw,
 }
 #endif
 
-#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))

The "defined(MODULE)" part wasn't needed here. :)

Quoted 4 lines
include/linux/firmware.h +1 -0
+#if IS_ENABLED(CONFIG_FW_LOADER)
 int request_firmware(const struct firmware **fw, const char *name,
 		     struct device *device);
 int firmware_request_nowarn(const struct firmware **fw, const char *name,
Signature · 1 line
~Randy
#2 lore raw
Quoted 28 lines · Randy Dunlap
Quoted 7 lines · Luis Chamberlain

The existing check is outdated and confuses developers. Use the already existing IS_ENABLED() defined on kconfig.h which makes the intention much clearer.

Thanks.

Quoted 12 lines
---
 include/linux/firmware.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/firmware.h +0 -0
index 3b057dfc8284..fa3493dbe84a 100644
@@ -34,7 +34,7 @@ static inline bool firmware_request_builtin(struct firmware *fw,
 }
 #endif
 
Quoted 3 lines

include/linux/firmware.h static inline bool firmware_request_builtin(struct firmware *fw, · line 37

Quoted 1 line
include/linux/firmware.h +0 -1
-#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))

The "defined(MODULE)" part wasn't needed here. :)

It _is_ needed.

This seems to be equivalent to IS_REACHABLE(CONFIG_FW_LOADER), not IS_ENABLE(CONFIG_FW_LOADER).

Quoted 8 lines

include/linux/firmware.h static inline bool firmware_request_builtin(struct firmware *fw, · line 40

Quoted 5 lines
include/linux/firmware.h +1 -0
+#if IS_ENABLED(CONFIG_FW_LOADER)
 int request_firmware(const struct firmware **fw, const char *name,
                   struct device *device);
 int firmware_request_nowarn(const struct firmware **fw, const char *name,

--
~Randy

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw
Quoted 35 lines · Masahiro Yamada
Quoted 28 lines · Randy Dunlap
Quoted 7 lines · Luis Chamberlain

The existing check is outdated and confuses developers. Use the already existing IS_ENABLED() defined on kconfig.h which makes the intention much clearer.

Thanks.

Quoted 12 lines
---
 include/linux/firmware.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/firmware.h +0 -0
index 3b057dfc8284..fa3493dbe84a 100644
@@ -34,7 +34,7 @@ static inline bool firmware_request_builtin(struct firmware *fw,
 }
 #endif
 
Quoted 3 lines

include/linux/firmware.h static inline bool firmware_request_builtin(struct firmware *fw, · line 37

Quoted 1 line
include/linux/firmware.h +0 -1
-#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))

The "defined(MODULE)" part wasn't needed here. :)

Quoted 5 lines

It _is_ needed.

This seems to be equivalent to IS_REACHABLE(CONFIG_FW_LOADER), not IS_ENABLE(CONFIG_FW_LOADER).

Hm, /me confused.

How can CONFIG_FW_LOADER_MODULE be =y when MODULE is not defined?

Quoted 13 lines
Quoted 10 lines

include/linux/firmware.h static inline bool firmware_request_builtin(struct firmware *fw, · line 40

Quoted 7 lines
include/linux/firmware.h +1 -0
+#if IS_ENABLED(CONFIG_FW_LOADER)
 int request_firmware(const struct firmware **fw, const char *name,
                   struct device *device);
 int firmware_request_nowarn(const struct firmware **fw, const char *name,

--
~Randy

Signature · 1 line
~Randy
#4 lore raw
Quoted 38 lines · Randy Dunlap
Quoted 35 lines · Masahiro Yamada
Quoted 31 lines · Randy Dunlap
Quoted 7 lines · Luis Chamberlain

The existing check is outdated and confuses developers. Use the already existing IS_ENABLED() defined on kconfig.h which makes the intention much clearer.

Thanks.

include/linux/firmware.h static inline bool firmware_request_builtin(struct firmware *fw, · line 37

Quoted 13 lines
---
 include/linux/firmware.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/firmware.h +0 -1
index 3b057dfc8284..fa3493dbe84a 100644
@@ -34,7 +34,7 @@ static inline bool firmware_request_builtin(struct firmware *fw,
 }
 #endif
 
-#if defined(CONFIG_FW_LOADER) || (defined(CONFIG_FW_LOADER_MODULE) && defined(MODULE))

The "defined(MODULE)" part wasn't needed here. :)

Quoted 9 lines
Quoted 4 lines

It _is_ needed.

This seems to be equivalent to IS_REACHABLE(CONFIG_FW_LOADER), not IS_ENABLE(CONFIG_FW_LOADER).>>

Hm, /me confused.

How can CONFIG_FW_LOADER_MODULE be =y when MODULE is not defined?

OK, I get it now. Thanks for correcting me.

Quoted 14 lines
Quoted 13 lines
Quoted 10 lines

include/linux/firmware.h static inline bool firmware_request_builtin(struct firmware *fw, · line 40

Quoted 7 lines
include/linux/firmware.h +1 -0
+#if IS_ENABLED(CONFIG_FW_LOADER)
 int request_firmware(const struct firmware **fw, const char *name,
                   struct device *device);
 int firmware_request_nowarn(const struct firmware **fw, const char *name,

--
~Randy

Signature · 1 line
~Randy