[PATCH 04/33] MFD: mcp-core: fix mcp_priv() to be more type safe
Russell King - ARM Linux
linux at arm.linux.org.uk
Wed Jan 25 09:31:26 EST 2012
mcp_priv() does unexpected things when passed a void pointer. Make it
a typed inline function, which ensures that it works correctly in
these cases.
Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
---
include/linux/mfd/mcp.h | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index ee496708..f88c1cc 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -64,6 +64,9 @@ void mcp_driver_unregister(struct mcp_driver *);
#define mcp_get_drvdata(mcp) dev_get_drvdata(&(mcp)->attached_device)
#define mcp_set_drvdata(mcp,d) dev_set_drvdata(&(mcp)->attached_device, d)
-#define mcp_priv(mcp) ((void *)((mcp)+1))
+static inline void *mcp_priv(struct mcp *mcp)
+{
+ return mcp + 1;
+}
#endif
--
1.7.4.4
More information about the linux-arm-kernel
mailing list