diff options
author | Markus Lidel <Markus.Lidel@shadowconnect.com> | 2006-01-06 03:19:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:54 -0500 |
commit | f6ed39a6e1a88240eec629a3da17c3a47ada3b89 (patch) | |
tree | b19fee742b48865b94bb26ed4428ca00a1a95b2c /drivers/message | |
parent | 2e1973a3cd0b9fe31469be62df3583bdc5a34f51 (diff) |
[PATCH] I2O: Optimizing
- make i2o_iop_free() static inline (from Adrian Bunk)
- changed kmalloc() + memset(0) into kzalloc()
Signed-off-by: Markus Lidel <Markus.Lidel@shadowconnect.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/message')
-rw-r--r-- | drivers/message/i2o/config-osm.c | 2 | ||||
-rw-r--r-- | drivers/message/i2o/core.h | 11 | ||||
-rw-r--r-- | drivers/message/i2o/device.c | 4 | ||||
-rw-r--r-- | drivers/message/i2o/driver.c | 7 | ||||
-rw-r--r-- | drivers/message/i2o/exec-osm.c | 4 | ||||
-rw-r--r-- | drivers/message/i2o/i2o_block.c | 5 | ||||
-rw-r--r-- | drivers/message/i2o/i2o_config.c | 6 | ||||
-rw-r--r-- | drivers/message/i2o/iop.c | 18 |
8 files changed, 22 insertions, 35 deletions
diff --git a/drivers/message/i2o/config-osm.c b/drivers/message/i2o/config-osm.c index b613890026b..3bba7aa82e5 100644 --- a/drivers/message/i2o/config-osm.c +++ b/drivers/message/i2o/config-osm.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
23 | 23 | ||
24 | #define OSM_NAME "config-osm" | 24 | #define OSM_NAME "config-osm" |
25 | #define OSM_VERSION "1.317" | 25 | #define OSM_VERSION "1.323" |
26 | #define OSM_DESCRIPTION "I2O Configuration OSM" | 26 | #define OSM_DESCRIPTION "I2O Configuration OSM" |
27 | 27 | ||
28 | /* access mode user rw */ | 28 | /* access mode user rw */ |
diff --git a/drivers/message/i2o/core.h b/drivers/message/i2o/core.h index edab686657f..90628562851 100644 --- a/drivers/message/i2o/core.h +++ b/drivers/message/i2o/core.h | |||
@@ -40,7 +40,16 @@ extern int i2o_device_parse_lct(struct i2o_controller *); | |||
40 | 40 | ||
41 | /* IOP */ | 41 | /* IOP */ |
42 | extern struct i2o_controller *i2o_iop_alloc(void); | 42 | extern struct i2o_controller *i2o_iop_alloc(void); |
43 | extern void i2o_iop_free(struct i2o_controller *); | 43 | |
44 | /** | ||
45 | * i2o_iop_free - Free the i2o_controller struct | ||
46 | * @c: I2O controller to free | ||
47 | */ | ||
48 | static inline void i2o_iop_free(struct i2o_controller *c) | ||
49 | { | ||
50 | i2o_pool_free(&c->in_msg); | ||
51 | kfree(c); | ||
52 | } | ||
44 | 53 | ||
45 | extern int i2o_iop_add(struct i2o_controller *); | 54 | extern int i2o_iop_add(struct i2o_controller *); |
46 | extern void i2o_iop_remove(struct i2o_controller *); | 55 | extern void i2o_iop_remove(struct i2o_controller *); |
diff --git a/drivers/message/i2o/device.c b/drivers/message/i2o/device.c index 773b0a4cfe2..34976b26b26 100644 --- a/drivers/message/i2o/device.c +++ b/drivers/message/i2o/device.c | |||
@@ -195,12 +195,10 @@ static struct i2o_device *i2o_device_alloc(void) | |||
195 | { | 195 | { |
196 | struct i2o_device *dev; | 196 | struct i2o_device *dev; |
197 | 197 | ||
198 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 198 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
199 | if (!dev) | 199 | if (!dev) |
200 | return ERR_PTR(-ENOMEM); | 200 | return ERR_PTR(-ENOMEM); |
201 | 201 | ||
202 | memset(dev, 0, sizeof(*dev)); | ||
203 | |||
204 | INIT_LIST_HEAD(&dev->list); | 202 | INIT_LIST_HEAD(&dev->list); |
205 | init_MUTEX(&dev->lock); | 203 | init_MUTEX(&dev->lock); |
206 | 204 | ||
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c index 45f4119a75f..64130227574 100644 --- a/drivers/message/i2o/driver.c +++ b/drivers/message/i2o/driver.c | |||
@@ -217,10 +217,9 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m) | |||
217 | /* cut of header from message size (in 32-bit words) */ | 217 | /* cut of header from message size (in 32-bit words) */ |
218 | size = (le32_to_cpu(msg->u.head[0]) >> 16) - 5; | 218 | size = (le32_to_cpu(msg->u.head[0]) >> 16) - 5; |
219 | 219 | ||
220 | evt = kmalloc(size * 4 + sizeof(*evt), GFP_ATOMIC); | 220 | evt = kzalloc(size * 4 + sizeof(*evt), GFP_ATOMIC); |
221 | if (!evt) | 221 | if (!evt) |
222 | return -ENOMEM; | 222 | return -ENOMEM; |
223 | memset(evt, 0, size * 4 + sizeof(*evt)); | ||
224 | 223 | ||
225 | evt->size = size; | 224 | evt->size = size; |
226 | evt->tcntxt = le32_to_cpu(msg->u.s.tcntxt); | 225 | evt->tcntxt = le32_to_cpu(msg->u.s.tcntxt); |
@@ -348,12 +347,10 @@ int __init i2o_driver_init(void) | |||
348 | osm_info("max drivers = %d\n", i2o_max_drivers); | 347 | osm_info("max drivers = %d\n", i2o_max_drivers); |
349 | 348 | ||
350 | i2o_drivers = | 349 | i2o_drivers = |
351 | kmalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); | 350 | kzalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); |
352 | if (!i2o_drivers) | 351 | if (!i2o_drivers) |
353 | return -ENOMEM; | 352 | return -ENOMEM; |
354 | 353 | ||
355 | memset(i2o_drivers, 0, i2o_max_drivers * sizeof(*i2o_drivers)); | ||
356 | |||
357 | rc = bus_register(&i2o_bus_type); | 354 | rc = bus_register(&i2o_bus_type); |
358 | 355 | ||
359 | if (rc < 0) | 356 | if (rc < 0) |
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c index d24548f4c03..d418ad35dcd 100644 --- a/drivers/message/i2o/exec-osm.c +++ b/drivers/message/i2o/exec-osm.c | |||
@@ -75,12 +75,10 @@ static struct i2o_exec_wait *i2o_exec_wait_alloc(void) | |||
75 | { | 75 | { |
76 | struct i2o_exec_wait *wait; | 76 | struct i2o_exec_wait *wait; |
77 | 77 | ||
78 | wait = kmalloc(sizeof(*wait), GFP_KERNEL); | 78 | wait = kzalloc(sizeof(*wait), GFP_KERNEL); |
79 | if (!wait) | 79 | if (!wait) |
80 | return NULL; | 80 | return NULL; |
81 | 81 | ||
82 | memset(wait, 0, sizeof(*wait)); | ||
83 | |||
84 | INIT_LIST_HEAD(&wait->list); | 82 | INIT_LIST_HEAD(&wait->list); |
85 | 83 | ||
86 | return wait; | 84 | return wait; |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index 3e865b793f2..c5807d6e85c 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -64,7 +64,7 @@ | |||
64 | #include "i2o_block.h" | 64 | #include "i2o_block.h" |
65 | 65 | ||
66 | #define OSM_NAME "block-osm" | 66 | #define OSM_NAME "block-osm" |
67 | #define OSM_VERSION "1.316" | 67 | #define OSM_VERSION "1.325" |
68 | #define OSM_DESCRIPTION "I2O Block Device OSM" | 68 | #define OSM_DESCRIPTION "I2O Block Device OSM" |
69 | 69 | ||
70 | static struct i2o_driver i2o_block_driver; | 70 | static struct i2o_driver i2o_block_driver; |
@@ -981,13 +981,12 @@ static struct i2o_block_device *i2o_block_device_alloc(void) | |||
981 | struct request_queue *queue; | 981 | struct request_queue *queue; |
982 | int rc; | 982 | int rc; |
983 | 983 | ||
984 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 984 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
985 | if (!dev) { | 985 | if (!dev) { |
986 | osm_err("Insufficient memory to allocate I2O Block disk.\n"); | 986 | osm_err("Insufficient memory to allocate I2O Block disk.\n"); |
987 | rc = -ENOMEM; | 987 | rc = -ENOMEM; |
988 | goto exit; | 988 | goto exit; |
989 | } | 989 | } |
990 | memset(dev, 0, sizeof(*dev)); | ||
991 | 990 | ||
992 | INIT_LIST_HEAD(&dev->open_queue); | 991 | INIT_LIST_HEAD(&dev->open_queue); |
993 | spin_lock_init(&dev->lock); | 992 | spin_lock_init(&dev->lock); |
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index 286fef3240c..89daf67b764 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -583,13 +583,12 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, | |||
583 | reply_size >>= 16; | 583 | reply_size >>= 16; |
584 | reply_size <<= 2; | 584 | reply_size <<= 2; |
585 | 585 | ||
586 | reply = kmalloc(reply_size, GFP_KERNEL); | 586 | reply = kzalloc(reply_size, GFP_KERNEL); |
587 | if (!reply) { | 587 | if (!reply) { |
588 | printk(KERN_WARNING "%s: Could not allocate reply buffer\n", | 588 | printk(KERN_WARNING "%s: Could not allocate reply buffer\n", |
589 | c->name); | 589 | c->name); |
590 | return -ENOMEM; | 590 | return -ENOMEM; |
591 | } | 591 | } |
592 | memset(reply, 0, reply_size); | ||
593 | 592 | ||
594 | sg_offset = (msg->u.head[0] >> 4) & 0x0f; | 593 | sg_offset = (msg->u.head[0] >> 4) & 0x0f; |
595 | 594 | ||
@@ -817,13 +816,12 @@ static int i2o_cfg_passthru(unsigned long arg) | |||
817 | reply_size >>= 16; | 816 | reply_size >>= 16; |
818 | reply_size <<= 2; | 817 | reply_size <<= 2; |
819 | 818 | ||
820 | reply = kmalloc(reply_size, GFP_KERNEL); | 819 | reply = kzalloc(reply_size, GFP_KERNEL); |
821 | if (!reply) { | 820 | if (!reply) { |
822 | printk(KERN_WARNING "%s: Could not allocate reply buffer\n", | 821 | printk(KERN_WARNING "%s: Could not allocate reply buffer\n", |
823 | c->name); | 822 | c->name); |
824 | return -ENOMEM; | 823 | return -ENOMEM; |
825 | } | 824 | } |
826 | memset(reply, 0, reply_size); | ||
827 | 825 | ||
828 | sg_offset = (msg->u.head[0] >> 4) & 0x0f; | 826 | sg_offset = (msg->u.head[0] >> 4) & 0x0f; |
829 | 827 | ||
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c index 0e465186196..49216744693 100644 --- a/drivers/message/i2o/iop.c +++ b/drivers/message/i2o/iop.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "core.h" | 32 | #include "core.h" |
33 | 33 | ||
34 | #define OSM_NAME "i2o" | 34 | #define OSM_NAME "i2o" |
35 | #define OSM_VERSION "1.316" | 35 | #define OSM_VERSION "1.325" |
36 | #define OSM_DESCRIPTION "I2O subsystem" | 36 | #define OSM_DESCRIPTION "I2O subsystem" |
37 | 37 | ||
38 | /* global I2O controller list */ | 38 | /* global I2O controller list */ |
@@ -838,12 +838,11 @@ static int i2o_systab_build(void) | |||
838 | i2o_systab.len = sizeof(struct i2o_sys_tbl) + num_controllers * | 838 | i2o_systab.len = sizeof(struct i2o_sys_tbl) + num_controllers * |
839 | sizeof(struct i2o_sys_tbl_entry); | 839 | sizeof(struct i2o_sys_tbl_entry); |
840 | 840 | ||
841 | systab = i2o_systab.virt = kmalloc(i2o_systab.len, GFP_KERNEL); | 841 | systab = i2o_systab.virt = kzalloc(i2o_systab.len, GFP_KERNEL); |
842 | if (!systab) { | 842 | if (!systab) { |
843 | osm_err("unable to allocate memory for System Table\n"); | 843 | osm_err("unable to allocate memory for System Table\n"); |
844 | return -ENOMEM; | 844 | return -ENOMEM; |
845 | } | 845 | } |
846 | memset(systab, 0, i2o_systab.len); | ||
847 | 846 | ||
848 | systab->version = I2OVERSION; | 847 | systab->version = I2OVERSION; |
849 | systab->change_ind = change_ind + 1; | 848 | systab->change_ind = change_ind + 1; |
@@ -1020,16 +1019,6 @@ static int i2o_hrt_get(struct i2o_controller *c) | |||
1020 | } | 1019 | } |
1021 | 1020 | ||
1022 | /** | 1021 | /** |
1023 | * i2o_iop_free - Free the i2o_controller struct | ||
1024 | * @c: I2O controller to free | ||
1025 | */ | ||
1026 | void i2o_iop_free(struct i2o_controller *c) | ||
1027 | { | ||
1028 | i2o_pool_free(&c->in_msg); | ||
1029 | kfree(c); | ||
1030 | }; | ||
1031 | |||
1032 | /** | ||
1033 | * i2o_iop_release - release the memory for a I2O controller | 1022 | * i2o_iop_release - release the memory for a I2O controller |
1034 | * @dev: I2O controller which should be released | 1023 | * @dev: I2O controller which should be released |
1035 | * | 1024 | * |
@@ -1058,13 +1047,12 @@ struct i2o_controller *i2o_iop_alloc(void) | |||
1058 | struct i2o_controller *c; | 1047 | struct i2o_controller *c; |
1059 | char poolname[32]; | 1048 | char poolname[32]; |
1060 | 1049 | ||
1061 | c = kmalloc(sizeof(*c), GFP_KERNEL); | 1050 | c = kzalloc(sizeof(*c), GFP_KERNEL); |
1062 | if (!c) { | 1051 | if (!c) { |
1063 | osm_err("i2o: Insufficient memory to allocate a I2O controller." | 1052 | osm_err("i2o: Insufficient memory to allocate a I2O controller." |
1064 | "\n"); | 1053 | "\n"); |
1065 | return ERR_PTR(-ENOMEM); | 1054 | return ERR_PTR(-ENOMEM); |
1066 | } | 1055 | } |
1067 | memset(c, 0, sizeof(*c)); | ||
1068 | 1056 | ||
1069 | c->unit = unit++; | 1057 | c->unit = unit++; |
1070 | sprintf(c->name, "iop%d", c->unit); | 1058 | sprintf(c->name, "iop%d", c->unit); |