[vRFC,5/8] firmware: Convert minor inline function to macro

Message ID 20240222180033.23775-6-quic_mojha@quicinc.com
State New
Headers
Series Refactor and rename request firmware API |

Commit Message

Mukesh Ojha Feb. 22, 2024, 6 p.m. UTC
  Convert to_fw_priv() inline function to macro.
No functional change.

Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
---
 drivers/base/firmware_loader/main.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
  

Comments

Greg KH Feb. 23, 2024, 6:22 a.m. UTC | #1
On Thu, Feb 22, 2024 at 11:30:30PM +0530, Mukesh Ojha wrote:
> Convert to_fw_priv() inline function to macro.

Why?

> No functional change.

You lost good error messages if you pass in the wrong pointer :(

There is a good reason to convert this type of function to a macro, but
you aren't using that here, so I'm not going to tell you why it would be
ok :)

thanks,

greg k-h
  

Patch

diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
index 2823dcd7153a..642b4d5c4375 100644
--- a/drivers/base/firmware_loader/main.c
+++ b/drivers/base/firmware_loader/main.c
@@ -80,13 +80,9 @@  struct fw_name_devm {
 	const char *name;
 };
 
-static inline struct fw_priv *to_fw_priv(struct kref *ref)
-{
-	return container_of(ref, struct fw_priv, ref);
-}
-
 #define	FW_LOADER_NO_CACHE	0
 #define	FW_LOADER_START_CACHE	1
+#define to_fw_priv(d)		container_of(d, struct fw_priv, d)
 
 /* fw_lock could be moved to 'struct fw_sysfs' but since it is just
  * guarding for corner cases a global lock should be OK */