From 481e20799bdcf98fd5a1d829d187239a90b15395 Mon Sep 17 00:00:00 2001 From: Ferenc Wagner Date: Fri, 7 Jan 2011 15:17:47 +0100 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/base') diff --git a/drivers/base/core.c b/drivers/base/core.c index 9cd3b5cfcc42..81b78ede37c4 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1320,7 +1320,10 @@ struct root_device 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) { -- cgit v1.2.3