summaryrefslogtreecommitdiff
path: root/include/linux/mfd/mcp.h
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-20 22:51:07 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-03 17:37:48 +0000
commit30816ac0495cb4f33fc8d748f64ac3cc880cb3c1 (patch)
tree689f82c11f0a1097bbd0e715178f94aa345fcebf /include/linux/mfd/mcp.h
parent0af5e4c36e70cfd4ae96d3704a425c414f530f2a (diff)
downloadlwn-30816ac0495cb4f33fc8d748f64ac3cc880cb3c1.tar.gz
lwn-30816ac0495cb4f33fc8d748f64ac3cc880cb3c1.zip
MFD: mcp-core: sanitize host creation/removal
host_unregister() gives us no chance between removing the device and the mcp data structure being freed to access the data inbetween, which drivers may need to do if they need to iounmap() pointers in their private data structures. Therefore, re-jig the interfaces, which are now, on creation: mcp = mcp_host_alloc() if (mcp) { ret = mcp_host_add(mcp, data); if (!ret) mcp_host_free(mcp); } and on removal: mcp_host_del(mcp); ... access mcp ... mcp_host_free(mcp); The free does the final put_device() on the struct device as one would expect. Acked-by: Jochen Friedrich <jochen@scram.de> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/linux/mfd/mcp.h')
-rw-r--r--include/linux/mfd/mcp.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index f88c1cc0cb0f..79a6b13ba20c 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -47,8 +47,9 @@ void mcp_disable(struct mcp *);
#define mcp_get_sclk_rate(mcp) ((mcp)->sclk_rate)
struct mcp *mcp_host_alloc(struct device *, size_t);
-int mcp_host_register(struct mcp *);
-void mcp_host_unregister(struct mcp *);
+int mcp_host_add(struct mcp *);
+void mcp_host_del(struct mcp *);
+void mcp_host_free(struct mcp *);
struct mcp_driver {
struct device_driver drv;