Pārlūkot izejas kodu

driver core: Replace the dangerous to_root_device macro with an inline function

The original macro worked only when applied to variables named 'dev'.
While this could have been fixed by simply renaming the macro argument,
a more type-safe replacement by an inline function is preferred.

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Ferenc Wagner 14 gadi atpakaļ
vecāks
revīzija
481e20799b
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4 1
      drivers/base/core.c

+ 4 - 1
drivers/base/core.c

@@ -1320,7 +1320,10 @@ struct root_device
 	struct module *owner;
 	struct module *owner;
 };
 };
 
 
-#define to_root_device(dev) container_of(dev, struct root_device, dev)
+inline struct root_device *to_root_device(struct device *d)
+{
+	return container_of(d, struct root_device, dev);
+}
 
 
 static void root_device_release(struct device *dev)
 static void root_device_release(struct device *dev)
 {
 {