fedora core 2.6.10-1.12-FC2
[linux-2.6.git] / drivers / message / i2o / driver.c
index bc69d66..388a443 100644 (file)
 #include <linux/rwsem.h>
 #include <linux/i2o.h>
 
-
 /* max_drivers - Maximum I2O drivers (OSMs) which could be registered */
 unsigned int i2o_max_drivers = I2O_MAX_DRIVERS;
 module_param_named(max_drivers, i2o_max_drivers, uint, 0);
 MODULE_PARM_DESC(max_drivers, "maximum number of OSM's to support");
 
 /* I2O drivers lock and array */
-static spinlock_t i2o_drivers_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t i2o_drivers_lock;
 static struct i2o_driver **i2o_drivers;
 
 /**
@@ -146,7 +145,7 @@ void i2o_driver_unregister(struct i2o_driver *drv)
                struct i2o_device *i2o_dev;
 
                list_for_each_entry(i2o_dev, &c->devices, list)
-                       i2o_driver_notify_device_remove(drv, i2o_dev);
+                   i2o_driver_notify_device_remove(drv, i2o_dev);
 
                i2o_driver_notify_controller_remove(drv, c);
        }
@@ -176,7 +175,7 @@ void i2o_driver_unregister(struct i2o_driver *drv)
  *     negative error code on failure (the message will be flushed too).
  */
 int i2o_driver_dispatch(struct i2o_controller *c, u32 m,
-                       struct i2o_message *msg)
+                       struct i2o_message __iomem *msg)
 {
        struct i2o_driver *drv;
        u32 context = readl(&msg->u.s.icntxt);
@@ -246,14 +245,15 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m,
  *     Send notifications to all registered drivers that a new controller was
  *     added.
  */
-void i2o_driver_notify_controller_add_all(struct i2o_controller *c) {
+void i2o_driver_notify_controller_add_all(struct i2o_controller *c)
+{
        int i;
        struct i2o_driver *drv;
 
-       for(i = 0; i < I2O_MAX_DRIVERS; i ++) {
+       for (i = 0; i < I2O_MAX_DRIVERS; i++) {
                drv = i2o_drivers[i];
 
-               if(drv)
+               if (drv)
                        i2o_driver_notify_controller_add(drv, c);
        }
 }
@@ -265,14 +265,15 @@ void i2o_driver_notify_controller_add_all(struct i2o_controller *c) {
  *     Send notifications to all registered drivers that a controller was
  *     removed.
  */
-void i2o_driver_notify_controller_remove_all(struct i2o_controller *c) {
+void i2o_driver_notify_controller_remove_all(struct i2o_controller *c)
+{
        int i;
        struct i2o_driver *drv;
 
-       for(i = 0; i < I2O_MAX_DRIVERS; i ++) {
+       for (i = 0; i < I2O_MAX_DRIVERS; i++) {
                drv = i2o_drivers[i];
 
-               if(drv)
+               if (drv)
                        i2o_driver_notify_controller_remove(drv, c);
        }
 }
@@ -283,14 +284,15 @@ void i2o_driver_notify_controller_remove_all(struct i2o_controller *c) {
  *
  *     Send notifications to all registered drivers that a device was added.
  */
-void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev) {
+void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev)
+{
        int i;
        struct i2o_driver *drv;
 
-       for(i = 0; i < I2O_MAX_DRIVERS; i ++) {
+       for (i = 0; i < I2O_MAX_DRIVERS; i++) {
                drv = i2o_drivers[i];
 
-               if(drv)
+               if (drv)
                        i2o_driver_notify_device_add(drv, i2o_dev);
        }
 }
@@ -301,14 +303,15 @@ void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev) {
  *
  *     Send notifications to all registered drivers that a device was removed.
  */
-void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev) {
+void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev)
+{
        int i;
        struct i2o_driver *drv;
 
-       for(i = 0; i < I2O_MAX_DRIVERS; i ++) {
+       for (i = 0; i < I2O_MAX_DRIVERS; i++) {
                drv = i2o_drivers[i];
 
-               if(drv)
+               if (drv)
                        i2o_driver_notify_device_remove(drv, i2o_dev);
        }
 }
@@ -324,6 +327,8 @@ int __init i2o_driver_init(void)
 {
        int rc = 0;
 
+       spin_lock_init(&i2o_drivers_lock);
+
        if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64) ||
            ((i2o_max_drivers ^ (i2o_max_drivers - 1)) !=
             (2 * i2o_max_drivers - 1))) {