diff options
author | Ferenc Wagner <wferi@niif.hu> | 2011-01-07 09:17:47 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-03 19:36:40 -0500 |
commit | 481e20799bdcf98fd5a1d829d187239a90b15395 (patch) | |
tree | 70e2560564252c84edf64ff3822d4ac9702a9b5a /drivers/base | |
parent | 6add7cd618b4d4dc525731beb539c5e06e891855 (diff) |
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>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/core.c | 5 |
1 files changed, 4 insertions, 1 deletions
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 | |||
1320 | struct module *owner; | 1320 | struct module *owner; |
1321 | }; | 1321 | }; |
1322 | 1322 | ||
1323 | #define to_root_device(dev) container_of(dev, struct root_device, dev) | 1323 | inline struct root_device *to_root_device(struct device *d) |
1324 | { | ||
1325 | return container_of(d, struct root_device, dev); | ||
1326 | } | ||
1324 | 1327 | ||
1325 | static void root_device_release(struct device *dev) | 1328 | static void root_device_release(struct device *dev) |
1326 | { | 1329 | { |