16 #include <linux/device.h>
17 #include <linux/module.h>
21 #include <linux/string.h>
22 #include <linux/slab.h>
25 #define OSM_NAME "i2o"
64 .match = i2o_bus_match,
90 osm_err(
"Could not initialize event queue for driver "
94 osm_debug(
"Event queue initialized for driver %s\n", drv->
name);
103 for (i = 0; i2o_drivers[
i]; i++)
104 if (i >= i2o_max_drivers) {
105 osm_err(
"too many drivers registered, increase "
107 spin_unlock_irqrestore(&i2o_drivers_lock, flags);
112 i2o_drivers[
i] = drv;
114 spin_unlock_irqrestore(&i2o_drivers_lock, flags);
121 i2o_driver_notify_controller_add(drv, c);
123 i2o_driver_notify_device_add(drv, i2o_dev);
157 i2o_driver_notify_device_remove(drv, i2o_dev);
159 i2o_driver_notify_controller_remove(drv, c);
164 spin_unlock_irqrestore(&i2o_drivers_lock, flags);
192 if (
unlikely(context >= i2o_max_drivers)) {
193 osm_warn(
"%s: Spurious reply to unknown driver %d\n", c->
name,
200 spin_unlock_irqrestore(&i2o_drivers_lock, flags);
203 osm_warn(
"%s: Spurious reply to unknown driver %d\n", c->
name,
214 osm_debug(
"event received from device %d\n", tid);
222 evt = kzalloc(size * 4 +
sizeof(*evt),
GFP_ATOMIC);
243 osm_debug(
"%s: Reply to driver %s, but no reply function"
248 return drv->
reply(c, m, msg);
263 for (i = 0; i < i2o_max_drivers; i++) {
264 drv = i2o_drivers[
i];
267 i2o_driver_notify_controller_add(drv, c);
283 for (i = 0; i < i2o_max_drivers; i++) {
284 drv = i2o_drivers[
i];
287 i2o_driver_notify_controller_remove(drv, c);
302 for (i = 0; i < i2o_max_drivers; i++) {
303 drv = i2o_drivers[
i];
306 i2o_driver_notify_device_add(drv, i2o_dev);
321 for (i = 0; i < i2o_max_drivers; i++) {
322 drv = i2o_drivers[
i];
325 i2o_driver_notify_device_remove(drv, i2o_dev);
342 if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64)) {
343 osm_warn(
"max_drivers set to %d, but must be >=2 and <= 64\n",
347 osm_info(
"max drivers = %d\n", i2o_max_drivers);
350 kcalloc(i2o_max_drivers,
sizeof(*i2o_drivers),
GFP_KERNEL);