aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Lidel <Markus.Lidel@shadowconnect.com>2006-01-06 03:19:32 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:54 -0500
commitdcceafe25a5f47cf69e5b46b4da6f15186ec8386 (patch)
tree4a3d581b2a1d239daf5d42cd9d2e1e5d838d817a
parent24791bd48f643194d806654b587251b0f92233e8 (diff)
[PATCH] I2O: Bugfixes
- Removed some kmalloc's with __GFP_ZERO and replace it with memset() because it didn't work properly. - Fixed returned message frame in i2o_cfg_passthru() which caused raidutils to display wrong error message in case a disk was missing. - Fixed size of printk() in i2o_scsi.c. - Fixed get_device() and put_device() in probing of the I2O controller. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/message/i2o/driver.c5
-rw-r--r--drivers/message/i2o/i2o_config.c29
-rw-r--r--drivers/message/i2o/i2o_scsi.c4
-rw-r--r--drivers/message/i2o/pci.c6
-rw-r--r--include/linux/i2o.h2
5 files changed, 21 insertions, 25 deletions
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c
index 25292b36e2d9..9c631c873dc6 100644
--- a/drivers/message/i2o/driver.c
+++ b/drivers/message/i2o/driver.c
@@ -217,14 +217,15 @@ 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 | __GFP_ZERO); 220 evt = kmalloc(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));
223 224
224 evt->size = size; 225 evt->size = size;
225 evt->tcntxt = le32_to_cpu(msg->u.s.tcntxt); 226 evt->tcntxt = le32_to_cpu(msg->u.s.tcntxt);
226 evt->event_indicator = le32_to_cpu(msg->body[0]); 227 evt->event_indicator = le32_to_cpu(msg->body[0]);
227 memcpy(&evt->tcntxt, &msg->u.s.tcntxt, size * 4); 228 memcpy(&evt->data, &msg->body[1], size * 4);
228 229
229 list_for_each_entry_safe(dev, tmp, &c->devices, list) 230 list_for_each_entry_safe(dev, tmp, &c->devices, list)
230 if (dev->lct_data.tid == tid) { 231 if (dev->lct_data.tid == tid) {
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index 4fe73d628c5b..286fef3240c4 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -36,12 +36,12 @@
36 36
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
38 38
39#include "core.h"
40
41#define SG_TABLESIZE 30 39#define SG_TABLESIZE 30
42 40
43static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, 41extern int i2o_parm_issue(struct i2o_device *, int, void *, int, void *, int);
44 unsigned long arg); 42
43static int i2o_cfg_ioctl(struct inode *, struct file *, unsigned int,
44 unsigned long);
45 45
46static spinlock_t i2o_config_lock; 46static spinlock_t i2o_config_lock;
47 47
@@ -593,9 +593,6 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd,
593 593
594 sg_offset = (msg->u.head[0] >> 4) & 0x0f; 594 sg_offset = (msg->u.head[0] >> 4) & 0x0f;
595 595
596 msg->u.s.icntxt = cpu_to_le32(i2o_config_driver.context);
597 msg->u.s.tcntxt = cpu_to_le32(i2o_cntxt_list_add(c, reply));
598
599 memset(sg_list, 0, sizeof(sg_list[0]) * SG_TABLESIZE); 596 memset(sg_list, 0, sizeof(sg_list[0]) * SG_TABLESIZE);
600 if (sg_offset) { 597 if (sg_offset) {
601 struct sg_simple_element *sg; 598 struct sg_simple_element *sg;
@@ -629,7 +626,7 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd,
629 goto cleanup; 626 goto cleanup;
630 } 627 }
631 sg_size = sg[i].flag_count & 0xffffff; 628 sg_size = sg[i].flag_count & 0xffffff;
632 p = &(sg_list[sg_index++]); 629 p = &(sg_list[sg_index]);
633 /* Allocate memory for the transfer */ 630 /* Allocate memory for the transfer */
634 if (i2o_dma_alloc 631 if (i2o_dma_alloc
635 (&c->pdev->dev, p, sg_size, 632 (&c->pdev->dev, p, sg_size,
@@ -640,6 +637,7 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd,
640 rcode = -ENOMEM; 637 rcode = -ENOMEM;
641 goto sg_list_cleanup; 638 goto sg_list_cleanup;
642 } 639 }
640 sg_index++;
643 /* Copy in the user's SG buffer if necessary */ 641 /* Copy in the user's SG buffer if necessary */
644 if (sg[i]. 642 if (sg[i].
645 flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR */ ) { 643 flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR */ ) {
@@ -661,8 +659,10 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd,
661 } 659 }
662 660
663 rcode = i2o_msg_post_wait(c, msg, 60); 661 rcode = i2o_msg_post_wait(c, msg, 60);
664 if (rcode) 662 if (rcode) {
663 reply[4] = ((u32) rcode) << 24;
665 goto sg_list_cleanup; 664 goto sg_list_cleanup;
665 }
666 666
667 if (sg_offset) { 667 if (sg_offset) {
668 u32 msg[I2O_OUTBOUND_MSG_FRAME_SIZE]; 668 u32 msg[I2O_OUTBOUND_MSG_FRAME_SIZE];
@@ -712,6 +712,7 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd,
712 } 712 }
713 } 713 }
714 714
715 sg_list_cleanup:
715 /* Copy back the reply to user space */ 716 /* Copy back the reply to user space */
716 if (reply_size) { 717 if (reply_size) {
717 // we wrote our own values for context - now restore the user supplied ones 718 // we wrote our own values for context - now restore the user supplied ones
@@ -729,7 +730,6 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd,
729 } 730 }
730 } 731 }
731 732
732 sg_list_cleanup:
733 for (i = 0; i < sg_index; i++) 733 for (i = 0; i < sg_index; i++)
734 i2o_dma_free(&c->pdev->dev, &sg_list[i]); 734 i2o_dma_free(&c->pdev->dev, &sg_list[i]);
735 735
@@ -827,9 +827,6 @@ static int i2o_cfg_passthru(unsigned long arg)
827 827
828 sg_offset = (msg->u.head[0] >> 4) & 0x0f; 828 sg_offset = (msg->u.head[0] >> 4) & 0x0f;
829 829
830 msg->u.s.icntxt = cpu_to_le32(i2o_config_driver.context);
831 msg->u.s.tcntxt = cpu_to_le32(i2o_cntxt_list_add(c, reply));
832
833 memset(sg_list, 0, sizeof(sg_list[0]) * SG_TABLESIZE); 830 memset(sg_list, 0, sizeof(sg_list[0]) * SG_TABLESIZE);
834 if (sg_offset) { 831 if (sg_offset) {
835 struct sg_simple_element *sg; 832 struct sg_simple_element *sg;
@@ -892,8 +889,10 @@ static int i2o_cfg_passthru(unsigned long arg)
892 } 889 }
893 890
894 rcode = i2o_msg_post_wait(c, msg, 60); 891 rcode = i2o_msg_post_wait(c, msg, 60);
895 if (rcode) 892 if (rcode) {
893 reply[4] = ((u32) rcode) << 24;
896 goto sg_list_cleanup; 894 goto sg_list_cleanup;
895 }
897 896
898 if (sg_offset) { 897 if (sg_offset) {
899 u32 msg[128]; 898 u32 msg[128];
@@ -943,6 +942,7 @@ static int i2o_cfg_passthru(unsigned long arg)
943 } 942 }
944 } 943 }
945 944
945 sg_list_cleanup:
946 /* Copy back the reply to user space */ 946 /* Copy back the reply to user space */
947 if (reply_size) { 947 if (reply_size) {
948 // we wrote our own values for context - now restore the user supplied ones 948 // we wrote our own values for context - now restore the user supplied ones
@@ -959,7 +959,6 @@ static int i2o_cfg_passthru(unsigned long arg)
959 } 959 }
960 } 960 }
961 961
962 sg_list_cleanup:
963 for (i = 0; i < sg_index; i++) 962 for (i = 0; i < sg_index; i++)
964 kfree(sg_list[i]); 963 kfree(sg_list[i]);
965 964
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index 24061dfd46e4..76b9516b1934 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -309,9 +309,9 @@ static int i2o_scsi_probe(struct device *dev)
309 sysfs_create_link(&i2o_dev->device.kobj, &scsi_dev->sdev_gendev.kobj, 309 sysfs_create_link(&i2o_dev->device.kobj, &scsi_dev->sdev_gendev.kobj,
310 "scsi"); 310 "scsi");
311 311
312 osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %d\n", 312 osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %ld\n",
313 i2o_dev->lct_data.tid, channel, le32_to_cpu(id), 313 i2o_dev->lct_data.tid, channel, le32_to_cpu(id),
314 (unsigned int)le64_to_cpu(lun)); 314 (long unsigned int)le64_to_cpu(lun));
315 315
316 return 0; 316 return 0;
317}; 317};
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c
index 329d482eee81..c5b656cdea7c 100644
--- a/drivers/message/i2o/pci.c
+++ b/drivers/message/i2o/pci.c
@@ -339,7 +339,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
339 pci_name(pdev)); 339 pci_name(pdev));
340 340
341 c->pdev = pdev; 341 c->pdev = pdev;
342 c->device.parent = get_device(&pdev->dev); 342 c->device.parent = &pdev->dev;
343 343
344 /* Cards that fall apart if you hit them with large I/O loads... */ 344 /* Cards that fall apart if you hit them with large I/O loads... */
345 if (pdev->vendor == PCI_VENDOR_ID_NCR && pdev->device == 0x0630) { 345 if (pdev->vendor == PCI_VENDOR_ID_NCR && pdev->device == 0x0630) {
@@ -410,8 +410,6 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
410 if ((rc = i2o_iop_add(c))) 410 if ((rc = i2o_iop_add(c)))
411 goto uninstall; 411 goto uninstall;
412 412
413 get_device(&c->device);
414
415 if (i960) 413 if (i960)
416 pci_write_config_word(i960, 0x42, 0x03ff); 414 pci_write_config_word(i960, 0x42, 0x03ff);
417 415
@@ -424,7 +422,6 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
424 i2o_pci_free(c); 422 i2o_pci_free(c);
425 423
426 free_controller: 424 free_controller:
427 put_device(c->device.parent);
428 i2o_iop_free(c); 425 i2o_iop_free(c);
429 426
430 disable: 427 disable:
@@ -454,7 +451,6 @@ static void __devexit i2o_pci_remove(struct pci_dev *pdev)
454 451
455 printk(KERN_INFO "%s: Controller removed.\n", c->name); 452 printk(KERN_INFO "%s: Controller removed.\n", c->name);
456 453
457 put_device(c->device.parent);
458 put_device(&c->device); 454 put_device(&c->device);
459}; 455};
460 456
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 4c18b7711bd9..9ba806796667 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -384,7 +384,7 @@
384 384
385/* defines for max_sectors and max_phys_segments */ 385/* defines for max_sectors and max_phys_segments */
386#define I2O_MAX_SECTORS 1024 386#define I2O_MAX_SECTORS 1024
387#define I2O_MAX_SECTORS_LIMITED 256 387#define I2O_MAX_SECTORS_LIMITED 128
388#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS 388#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
389 389
390/* 390/*