Pull acpi_bus_register_driver into release branch
[pandora-kernel.git] / drivers / message / i2o / iop.c
index f86abb4..febbdd4 100644 (file)
@@ -32,7 +32,7 @@
 #include "core.h"
 
 #define OSM_NAME       "i2o"
-#define OSM_VERSION    "1.288"
+#define OSM_VERSION    "1.325"
 #define OSM_DESCRIPTION        "I2O subsystem"
 
 /* global I2O controller list */
@@ -730,10 +730,6 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
         * Provide three SGL-elements:
         * System table (SysTab), Private memory space declaration and
         * Private i/o space declaration
-        *
-        * FIXME: is this still true?
-        * Nasty one here. We can't use dma_alloc_coherent to send the
-        * same table to everyone. We have to go remap it for them all
         */
 
        msg->body[0] = cpu_to_le32(c->unit + 2);
@@ -756,8 +752,6 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
        else
                osm_debug("%s: SysTab set.\n", c->name);
 
-       i2o_status_get(c);      // Entered READY state
-
        return rc;
 }
 
@@ -767,7 +761,7 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
  *
  *     Send the system table and enable the I2O controller.
  *
- *     Returns 0 on success or negativer error code on failure.
+ *     Returns 0 on success or negative error code on failure.
  */
 static int i2o_iop_online(struct i2o_controller *c)
 {
@@ -806,13 +800,10 @@ void i2o_iop_remove(struct i2o_controller *c)
        list_for_each_entry_safe(dev, tmp, &c->devices, list)
            i2o_device_remove(dev);
 
-       class_device_unregister(c->classdev);
        device_del(&c->device);
 
        /* Ask the IOP to switch to RESET state */
        i2o_iop_reset(c);
-
-       put_device(&c->device);
 }
 
 /**
@@ -845,12 +836,11 @@ static int i2o_systab_build(void)
        i2o_systab.len = sizeof(struct i2o_sys_tbl) + num_controllers *
            sizeof(struct i2o_sys_tbl_entry);
 
-       systab = i2o_systab.virt = kmalloc(i2o_systab.len, GFP_KERNEL);
+       systab = i2o_systab.virt = kzalloc(i2o_systab.len, GFP_KERNEL);
        if (!systab) {
                osm_err("unable to allocate memory for System Table\n");
                return -ENOMEM;
        }
-       memset(systab, 0, i2o_systab.len);
 
        systab->version = I2OVERSION;
        systab->change_ind = change_ind + 1;
@@ -978,7 +968,7 @@ int i2o_status_get(struct i2o_controller *c)
  *     The HRT contains information about possible hidden devices but is
  *     mostly useless to us.
  *
- *     Returns 0 on success or negativer error code on failure.
+ *     Returns 0 on success or negative error code on failure.
  */
 static int i2o_hrt_get(struct i2o_controller *c)
 {
@@ -1026,16 +1016,6 @@ static int i2o_hrt_get(struct i2o_controller *c)
        return -EBUSY;
 }
 
-/**
- *     i2o_iop_free - Free the i2o_controller struct
- *     @c: I2O controller to free
- */
-void i2o_iop_free(struct i2o_controller *c)
-{
-       i2o_pool_free(&c->in_msg);
-       kfree(c);
-};
-
 /**
  *     i2o_iop_release - release the memory for a I2O controller
  *     @dev: I2O controller which should be released
@@ -1050,9 +1030,6 @@ static void i2o_iop_release(struct device *dev)
        i2o_iop_free(c);
 };
 
-/* I2O controller class */
-static struct class *i2o_controller_class;
-
 /**
  *     i2o_iop_alloc - Allocate and initialize a i2o_controller struct
  *
@@ -1068,20 +1045,19 @@ struct i2o_controller *i2o_iop_alloc(void)
        struct i2o_controller *c;
        char poolname[32];
 
-       c = kmalloc(sizeof(*c), GFP_KERNEL);
+       c = kzalloc(sizeof(*c), GFP_KERNEL);
        if (!c) {
                osm_err("i2o: Insufficient memory to allocate a I2O controller."
                        "\n");
                return ERR_PTR(-ENOMEM);
        }
-       memset(c, 0, sizeof(*c));
 
        c->unit = unit++;
        sprintf(c->name, "iop%d", c->unit);
 
        snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name);
        if (i2o_pool_alloc
-           (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4,
+           (&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4 + sizeof(u32),
             I2O_MSG_INPOOL_MIN)) {
                kfree(c);
                return ERR_PTR(-ENOMEM);
@@ -1124,36 +1100,29 @@ int i2o_iop_add(struct i2o_controller *c)
                goto iop_reset;
        }
 
-       c->classdev = class_device_create(i2o_controller_class, NULL, MKDEV(0,0),
-                       &c->device, "iop%d", c->unit);
-       if (IS_ERR(c->classdev)) {
-               osm_err("%s: could not add controller class\n", c->name);
-               goto device_del;
-       }
-
        osm_info("%s: Activating I2O controller...\n", c->name);
        osm_info("%s: This may take a few minutes if there are many devices\n",
                 c->name);
 
        if ((rc = i2o_iop_activate(c))) {
                osm_err("%s: could not activate controller\n", c->name);
-               goto class_del;
+               goto device_del;
        }
 
        osm_debug("%s: building sys table...\n", c->name);
 
        if ((rc = i2o_systab_build()))
-               goto class_del;
+               goto device_del;
 
        osm_debug("%s: online controller...\n", c->name);
 
        if ((rc = i2o_iop_online(c)))
-               goto class_del;
+               goto device_del;
 
        osm_debug("%s: getting LCT...\n", c->name);
 
        if ((rc = i2o_exec_lct_get(c)))
-               goto class_del;
+               goto device_del;
 
        list_add(&c->list, &i2o_controllers);
 
@@ -1163,9 +1132,6 @@ int i2o_iop_add(struct i2o_controller *c)
 
        return 0;
 
-      class_del:
-       class_device_unregister(c->classdev);
-
       device_del:
        device_del(&c->device);
 
@@ -1225,14 +1191,8 @@ static int __init i2o_iop_init(void)
 
        printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
 
-       i2o_controller_class = class_create(THIS_MODULE, "i2o_controller");
-       if (IS_ERR(i2o_controller_class)) {
-               osm_err("can't register class i2o_controller\n");
-               goto exit;
-       }
-
        if ((rc = i2o_driver_init()))
-               goto class_exit;
+               goto exit;
 
        if ((rc = i2o_exec_init()))
                goto driver_exit;
@@ -1248,9 +1208,6 @@ static int __init i2o_iop_init(void)
       driver_exit:
        i2o_driver_exit();
 
-      class_exit:
-       class_destroy(i2o_controller_class);
-
       exit:
        return rc;
 }
@@ -1265,7 +1222,6 @@ static void __exit i2o_iop_exit(void)
        i2o_pci_exit();
        i2o_exec_exit();
        i2o_driver_exit();
-       class_destroy(i2o_controller_class);
 };
 
 module_init(i2o_iop_init);