drm: Propagate error from drm_fb_helper_init().
[safe/jmp/linux-2.6] / drivers / mfd / mcp-core.c
index c75d713..84815f9 100644 (file)
 #include <linux/errno.h>
 #include <linux/smp.h>
 #include <linux/device.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/mfd/mcp.h>
 
-#include <asm/dma.h>
+#include <mach/dma.h>
 #include <asm/system.h>
 
-#include "mcp.h"
 
 #define to_mcp(d)              container_of(d, struct mcp, attached_device)
 #define to_mcp_driver(d)       container_of(d, struct mcp_driver, drv)
@@ -75,6 +77,8 @@ static int mcp_bus_resume(struct device *dev)
 static struct bus_type mcp_bus_type = {
        .name           = "mcp",
        .match          = mcp_bus_match,
+       .probe          = mcp_bus_probe,
+       .remove         = mcp_bus_remove,
        .suspend        = mcp_bus_suspend,
        .resume         = mcp_bus_resume,
 };
@@ -196,9 +200,8 @@ struct mcp *mcp_host_alloc(struct device *parent, size_t size)
 {
        struct mcp *mcp;
 
-       mcp = kmalloc(sizeof(struct mcp) + size, GFP_KERNEL);
+       mcp = kzalloc(sizeof(struct mcp) + size, GFP_KERNEL);
        if (mcp) {
-               memset(mcp, 0, sizeof(struct mcp) + size);
                spin_lock_init(&mcp->lock);
                mcp->attached_device.parent = parent;
                mcp->attached_device.bus = &mcp_bus_type;
@@ -211,7 +214,7 @@ EXPORT_SYMBOL(mcp_host_alloc);
 
 int mcp_host_register(struct mcp *mcp)
 {
-       strcpy(mcp->attached_device.bus_id, "mcp0");
+       dev_set_name(&mcp->attached_device, "mcp0");
        return device_register(&mcp->attached_device);
 }
 EXPORT_SYMBOL(mcp_host_register);
@@ -225,8 +228,6 @@ EXPORT_SYMBOL(mcp_host_unregister);
 int mcp_driver_register(struct mcp_driver *mcpdrv)
 {
        mcpdrv->drv.bus = &mcp_bus_type;
-       mcpdrv->drv.probe = mcp_bus_probe;
-       mcpdrv->drv.remove = mcp_bus_remove;
        return driver_register(&mcpdrv->drv);
 }
 EXPORT_SYMBOL(mcp_driver_register);