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

Mukesh Ojha posted 8 patches 1 year, 11 months ago
[PATCH vRFC 5/8] firmware: Convert minor inline function to macro
Posted by Mukesh Ojha 1 year, 11 months ago
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(-)

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 */
-- 
2.43.0.254.ga26002b62827
Re: [PATCH vRFC 5/8] firmware: Convert minor inline function to macro
Posted by Greg KH 1 year, 11 months ago
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