]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
MFD: mcp-core: fix mcp_priv() to be more type safe
authorRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 21 Jan 2012 09:28:53 +0000 (09:28 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 21 Jan 2012 15:46:25 +0000 (15:46 +0000)
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@arm.linux.org.uk>
include/linux/mfd/mcp.h

index ee496708e38b9a0de245a3c9f59d67377dc6fd59..f88c1cc0cb0f24bfda24e69f63cb728a923d5d45 100644 (file)
@@ -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