Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Markus Lidel and committed by
Linus Torvalds
f6ed39a6 2e1973a3

+22 -35
+1 -1
drivers/message/i2o/config-osm.c
··· 22 22 #include <asm/uaccess.h> 23 23 24 24 #define OSM_NAME "config-osm" 25 - #define OSM_VERSION "1.317" 25 + #define OSM_VERSION "1.323" 26 26 #define OSM_DESCRIPTION "I2O Configuration OSM" 27 27 28 28 /* access mode user rw */
+10 -1
drivers/message/i2o/core.h
··· 40 40 41 41 /* IOP */ 42 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 54 extern int i2o_iop_add(struct i2o_controller *); 46 55 extern void i2o_iop_remove(struct i2o_controller *);
+1 -3
drivers/message/i2o/device.c
··· 195 195 { 196 196 struct i2o_device *dev; 197 197 198 - dev = kmalloc(sizeof(*dev), GFP_KERNEL); 198 + dev = kzalloc(sizeof(*dev), GFP_KERNEL); 199 199 if (!dev) 200 200 return ERR_PTR(-ENOMEM); 201 - 202 - memset(dev, 0, sizeof(*dev)); 203 201 204 202 INIT_LIST_HEAD(&dev->list); 205 203 init_MUTEX(&dev->lock);
+2 -5
drivers/message/i2o/driver.c
··· 217 217 /* cut of header from message size (in 32-bit words) */ 218 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 221 if (!evt) 222 222 return -ENOMEM; 223 - memset(evt, 0, size * 4 + sizeof(*evt)); 224 223 225 224 evt->size = size; 226 225 evt->tcntxt = le32_to_cpu(msg->u.s.tcntxt); ··· 347 348 osm_info("max drivers = %d\n", i2o_max_drivers); 348 349 349 350 i2o_drivers = 350 - kmalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); 351 + kzalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); 351 352 if (!i2o_drivers) 352 353 return -ENOMEM; 353 - 354 - memset(i2o_drivers, 0, i2o_max_drivers * sizeof(*i2o_drivers)); 355 354 356 355 rc = bus_register(&i2o_bus_type); 357 356
+1 -3
drivers/message/i2o/exec-osm.c
··· 75 75 { 76 76 struct i2o_exec_wait *wait; 77 77 78 - wait = kmalloc(sizeof(*wait), GFP_KERNEL); 78 + wait = kzalloc(sizeof(*wait), GFP_KERNEL); 79 79 if (!wait) 80 80 return NULL; 81 - 82 - memset(wait, 0, sizeof(*wait)); 83 81 84 82 INIT_LIST_HEAD(&wait->list); 85 83
+2 -3
drivers/message/i2o/i2o_block.c
··· 64 64 #include "i2o_block.h" 65 65 66 66 #define OSM_NAME "block-osm" 67 - #define OSM_VERSION "1.316" 67 + #define OSM_VERSION "1.325" 68 68 #define OSM_DESCRIPTION "I2O Block Device OSM" 69 69 70 70 static struct i2o_driver i2o_block_driver; ··· 981 981 struct request_queue *queue; 982 982 int rc; 983 983 984 - dev = kmalloc(sizeof(*dev), GFP_KERNEL); 984 + dev = kzalloc(sizeof(*dev), GFP_KERNEL); 985 985 if (!dev) { 986 986 osm_err("Insufficient memory to allocate I2O Block disk.\n"); 987 987 rc = -ENOMEM; 988 988 goto exit; 989 989 } 990 - memset(dev, 0, sizeof(*dev)); 991 990 992 991 INIT_LIST_HEAD(&dev->open_queue); 993 992 spin_lock_init(&dev->lock);
+2 -4
drivers/message/i2o/i2o_config.c
··· 583 583 reply_size >>= 16; 584 584 reply_size <<= 2; 585 585 586 - reply = kmalloc(reply_size, GFP_KERNEL); 586 + reply = kzalloc(reply_size, GFP_KERNEL); 587 587 if (!reply) { 588 588 printk(KERN_WARNING "%s: Could not allocate reply buffer\n", 589 589 c->name); 590 590 return -ENOMEM; 591 591 } 592 - memset(reply, 0, reply_size); 593 592 594 593 sg_offset = (msg->u.head[0] >> 4) & 0x0f; 595 594 ··· 816 817 reply_size >>= 16; 817 818 reply_size <<= 2; 818 819 819 - reply = kmalloc(reply_size, GFP_KERNEL); 820 + reply = kzalloc(reply_size, GFP_KERNEL); 820 821 if (!reply) { 821 822 printk(KERN_WARNING "%s: Could not allocate reply buffer\n", 822 823 c->name); 823 824 return -ENOMEM; 824 825 } 825 - memset(reply, 0, reply_size); 826 826 827 827 sg_offset = (msg->u.head[0] >> 4) & 0x0f; 828 828
+3 -15
drivers/message/i2o/iop.c
··· 32 32 #include "core.h" 33 33 34 34 #define OSM_NAME "i2o" 35 - #define OSM_VERSION "1.316" 35 + #define OSM_VERSION "1.325" 36 36 #define OSM_DESCRIPTION "I2O subsystem" 37 37 38 38 /* global I2O controller list */ ··· 838 838 i2o_systab.len = sizeof(struct i2o_sys_tbl) + num_controllers * 839 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 842 if (!systab) { 843 843 osm_err("unable to allocate memory for System Table\n"); 844 844 return -ENOMEM; 845 845 } 846 - memset(systab, 0, i2o_systab.len); 847 846 848 847 systab->version = I2OVERSION; 849 848 systab->change_ind = change_ind + 1; ··· 1019 1020 } 1020 1021 1021 1022 /** 1022 - * i2o_iop_free - Free the i2o_controller struct 1023 - * @c: I2O controller to free 1024 - */ 1025 - void i2o_iop_free(struct i2o_controller *c) 1026 - { 1027 - i2o_pool_free(&c->in_msg); 1028 - kfree(c); 1029 - }; 1030 - 1031 - /** 1032 1023 * i2o_iop_release - release the memory for a I2O controller 1033 1024 * @dev: I2O controller which should be released 1034 1025 * ··· 1047 1058 struct i2o_controller *c; 1048 1059 char poolname[32]; 1049 1060 1050 - c = kmalloc(sizeof(*c), GFP_KERNEL); 1061 + c = kzalloc(sizeof(*c), GFP_KERNEL); 1051 1062 if (!c) { 1052 1063 osm_err("i2o: Insufficient memory to allocate a I2O controller." 1053 1064 "\n"); 1054 1065 return ERR_PTR(-ENOMEM); 1055 1066 } 1056 - memset(c, 0, sizeof(*c)); 1057 1067 1058 1068 c->unit = unit++; 1059 1069 sprintf(c->name, "iop%d", c->unit);