Merge master.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6
[powerpc.git] / drivers / i2c / busses / i2c-keywest.c
index 363e545..d61f748 100644 (file)
@@ -87,12 +87,9 @@ static const char *__kw_state_names[] = {
 };
 #endif /* DEBUG */
 
-static int probe;
-
 MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
 MODULE_DESCRIPTION("I2C driver for Apple's Keywest");
 MODULE_LICENSE("GPL");
-module_param(probe, bool, 0);
 
 #ifdef POLLED_MODE
 /* Don't schedule, the g5 fan controller is too
@@ -498,8 +495,6 @@ keywest_func(struct i2c_adapter * adapter)
 
 /* For now, we only handle combined mode (smbus) */
 static struct i2c_algorithm keywest_algorithm = {
-       .name           = "Keywest i2c",
-       .id             = I2C_ALGO_SMBUS,
        .smbus_xfer     = keywest_smbus_xfer,
        .master_xfer    = keywest_xfer,
        .functionality  = keywest_func,
@@ -540,13 +535,12 @@ create_iface(struct device_node *np, struct device *dev)
 
        tsize = sizeof(struct keywest_iface) +
                (sizeof(struct keywest_chan) + 4) * nchan;
-       iface = (struct keywest_iface *) kmalloc(tsize, GFP_KERNEL);
+       iface = kzalloc(tsize, GFP_KERNEL);
        if (iface == NULL) {
                printk(KERN_ERR "i2c-keywest: can't allocate inteface !\n");
                pmac_low_i2c_unlock(np);
                return -ENOMEM;
        }
-       memset(iface, 0, tsize);
        spin_lock_init(&iface->lock);
        init_completion(&iface->complete);
        iface->node = of_node_get(np);
@@ -616,12 +610,10 @@ create_iface(struct device_node *np, struct device *dev)
        
        for (i=0; i<nchan; i++) {
                struct keywest_chan* chan = &iface->channels[i];
-               u8 addr;
                
                sprintf(chan->adapter.name, "%s %d", np->parent->name, i);
                chan->iface = iface;
                chan->chan_no = i;
-               chan->adapter.id = I2C_ALGO_SMBUS;
                chan->adapter.algo = &keywest_algorithm;
                chan->adapter.algo_data = NULL;
                chan->adapter.client_register = NULL;
@@ -635,15 +627,6 @@ create_iface(struct device_node *np, struct device *dev)
                                chan->adapter.name);
                        i2c_set_adapdata(&chan->adapter, NULL);
                }
-               if (probe) {
-                       printk("Probe: ");
-                       for (addr = 0x00; addr <= 0x7f; addr++) {
-                               if (i2c_smbus_xfer(&chan->adapter,addr,
-                                   0,0,0,I2C_SMBUS_QUICK,NULL) >= 0)
-                                       printk("%02x ", addr);
-                       }
-                       printk("\n");
-               }
        }
 
        printk(KERN_INFO "Found KeyWest i2c on \"%s\", %d channel%s, stepping: %d bits\n",
@@ -698,7 +681,7 @@ dispose_iface(struct device *dev)
 }
 
 static int
-create_iface_macio(struct macio_dev* dev, const struct of_match *match)
+create_iface_macio(struct macio_dev* dev, const struct of_device_id *match)
 {
        return create_iface(dev->ofdev.node, &dev->ofdev.dev);
 }
@@ -710,7 +693,7 @@ dispose_iface_macio(struct macio_dev* dev)
 }
 
 static int
-create_iface_of_platform(struct of_device* dev, const struct of_match *match)
+create_iface_of_platform(struct of_device* dev, const struct of_device_id *match)
 {
        return create_iface(dev->node, &dev->dev);
 }
@@ -721,10 +704,9 @@ dispose_iface_of_platform(struct of_device* dev)
        return dispose_iface(&dev->dev);
 }
 
-static struct of_match i2c_keywest_match[] = 
+static struct of_device_id i2c_keywest_match[] = 
 {
        {
-       .name           = OF_ANY_MATCH,
        .type           = "i2c",
        .compatible     = "keywest"
        },
@@ -733,6 +715,7 @@ static struct of_match i2c_keywest_match[] =
 
 static struct macio_driver i2c_keywest_macio_driver = 
 {
+       .owner          = THIS_MODULE,
        .name           = "i2c-keywest",
        .match_table    = i2c_keywest_match,
        .probe          = create_iface_macio,
@@ -741,6 +724,7 @@ static struct macio_driver i2c_keywest_macio_driver =
 
 static struct of_platform_driver i2c_keywest_of_platform_driver = 
 {
+       .owner          = THIS_MODULE,
        .name           = "i2c-keywest",
        .match_table    = i2c_keywest_match,
        .probe          = create_iface_of_platform,