public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] Replace the dangerous to_root_device macro with an inline function
@ 2011-01-06 15:24 Ferenc Wagner
  2011-01-06 15:28 ` Ferenc Wagner
  2011-01-06 16:20 ` Greg KH
  0 siblings, 2 replies; 7+ messages in thread
From: Ferenc Wagner @ 2011-01-06 15:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel; +Cc: Ferenc Wagner

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 is preferred.

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
---
 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 6ed6454..742a78a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1283,7 +1283,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)
 {
-- 
1.6.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-07 14:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-06 15:24 [PATCH 2/2] Replace the dangerous to_root_device macro with an inline function Ferenc Wagner
2011-01-06 15:28 ` Ferenc Wagner
2011-01-06 16:20 ` Greg KH
2011-01-06 20:47   ` Ferenc Wagner
2011-01-06 20:52     ` Greg KH
2011-01-07 14:17       ` [PATCH] " Ferenc Wagner
2011-01-07 14:21       ` [PATCH 2/2] " Ferenc Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox