diff options
Diffstat (limited to 'drivers/message/i2o/driver.c')
-rw-r--r-- | drivers/message/i2o/driver.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c index d330e4eb86ac..a3ee1796af0c 100644 --- a/drivers/message/i2o/driver.c +++ b/drivers/message/i2o/driver.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/workqueue.h> | 20 | #include <linux/workqueue.h> |
21 | #include <linux/string.h> | 21 | #include <linux/string.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/log2.h> | ||
23 | #include "core.h" | 24 | #include "core.h" |
24 | 25 | ||
25 | #define OSM_NAME "i2o" | 26 | #define OSM_NAME "i2o" |
@@ -260,7 +261,7 @@ void i2o_driver_notify_controller_add_all(struct i2o_controller *c) | |||
260 | int i; | 261 | int i; |
261 | struct i2o_driver *drv; | 262 | struct i2o_driver *drv; |
262 | 263 | ||
263 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 264 | for (i = 0; i < i2o_max_drivers; i++) { |
264 | drv = i2o_drivers[i]; | 265 | drv = i2o_drivers[i]; |
265 | 266 | ||
266 | if (drv) | 267 | if (drv) |
@@ -280,7 +281,7 @@ void i2o_driver_notify_controller_remove_all(struct i2o_controller *c) | |||
280 | int i; | 281 | int i; |
281 | struct i2o_driver *drv; | 282 | struct i2o_driver *drv; |
282 | 283 | ||
283 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 284 | for (i = 0; i < i2o_max_drivers; i++) { |
284 | drv = i2o_drivers[i]; | 285 | drv = i2o_drivers[i]; |
285 | 286 | ||
286 | if (drv) | 287 | if (drv) |
@@ -299,7 +300,7 @@ void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev) | |||
299 | int i; | 300 | int i; |
300 | struct i2o_driver *drv; | 301 | struct i2o_driver *drv; |
301 | 302 | ||
302 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 303 | for (i = 0; i < i2o_max_drivers; i++) { |
303 | drv = i2o_drivers[i]; | 304 | drv = i2o_drivers[i]; |
304 | 305 | ||
305 | if (drv) | 306 | if (drv) |
@@ -318,7 +319,7 @@ void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev) | |||
318 | int i; | 319 | int i; |
319 | struct i2o_driver *drv; | 320 | struct i2o_driver *drv; |
320 | 321 | ||
321 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 322 | for (i = 0; i < i2o_max_drivers; i++) { |
322 | drv = i2o_drivers[i]; | 323 | drv = i2o_drivers[i]; |
323 | 324 | ||
324 | if (drv) | 325 | if (drv) |
@@ -340,8 +341,7 @@ int __init i2o_driver_init(void) | |||
340 | spin_lock_init(&i2o_drivers_lock); | 341 | spin_lock_init(&i2o_drivers_lock); |
341 | 342 | ||
342 | if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64) || | 343 | if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64) || |
343 | ((i2o_max_drivers ^ (i2o_max_drivers - 1)) != | 344 | !is_power_of_2(i2o_max_drivers)) { |
344 | (2 * i2o_max_drivers - 1))) { | ||
345 | osm_warn("max_drivers set to %d, but must be >=2 and <= 64 and " | 345 | osm_warn("max_drivers set to %d, but must be >=2 and <= 64 and " |
346 | "a power of 2\n", i2o_max_drivers); | 346 | "a power of 2\n", i2o_max_drivers); |
347 | i2o_max_drivers = I2O_MAX_DRIVERS; | 347 | i2o_max_drivers = I2O_MAX_DRIVERS; |
@@ -349,7 +349,7 @@ int __init i2o_driver_init(void) | |||
349 | osm_info("max drivers = %d\n", i2o_max_drivers); | 349 | osm_info("max drivers = %d\n", i2o_max_drivers); |
350 | 350 | ||
351 | i2o_drivers = | 351 | i2o_drivers = |
352 | kzalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); | 352 | kcalloc(i2o_max_drivers, sizeof(*i2o_drivers), GFP_KERNEL); |
353 | if (!i2o_drivers) | 353 | if (!i2o_drivers) |
354 | return -ENOMEM; | 354 | return -ENOMEM; |
355 | 355 | ||