#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;
+static spinlock_t i2o_drivers_lock = SPIN_LOCK_UNLOCKED;
static struct i2o_driver **i2o_drivers;
/**
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);
}
* negative error code on failure (the message will be flushed too).
*/
int i2o_driver_dispatch(struct i2o_controller *c, u32 m,
- struct i2o_message __iomem *msg)
+ struct i2o_message *msg)
{
struct i2o_driver *drv;
u32 context = readl(&msg->u.s.icntxt);
* 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);
}
}
* 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);
}
}
*
* 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);
}
}
*
* 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);
}
}
{
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))) {