http://linux-1394.bkbits.net/1394-dev
scjody@modernduck.com|ChangeSet|20050307201346|63215 scjody

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/03/07 15:23:03-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ieee1394
# 
# MAINTAINERS
#   2005/03/07 15:22:59-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/07 14:30:38-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ieee1394
# 
# MAINTAINERS
#   2005/03/07 14:30:34-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/07 15:13:46-05:00 scjody@modernduck.com 
#   convert from pci_module_init to pci_register_driver
#   
#   Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>
#   Signed-off-by: Domen Puncer <domen@coderock.org>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/pcilynx.c
#   2005/03/07 15:13:23-05:00 scjody@modernduck.com +1 -1
#   convert from pci_module_init to pci_register_driver
#   
#   Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>
#   Signed-off-by: Domen Puncer <domen@coderock.org>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/ohci1394.c
#   2005/03/07 15:13:23-05:00 scjody@modernduck.com +1 -1
#   convert from pci_module_init to pci_register_driver
#   
#   Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>
#   Signed-off-by: Domen Puncer <domen@coderock.org>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# ChangeSet
#   2005/03/07 14:56:08-05:00 scjody@modernduck.com 
#   Fix comment to match reality.
#   
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/pcilynx.c
#   2005/03/07 14:55:45-05:00 scjody@modernduck.com +1 -1
#   Fix comment to match reality.
# 
# ChangeSet
#   2005/03/07 14:54:30-05:00 scjody@modernduck.com 
#   Fix end of line to match linux1394.org SVN and be <80 chars.
#   
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/raw1394.c
#   2005/03/07 14:54:07-05:00 scjody@modernduck.com +2 -1
#   Fix end of line to match linux1394.org SVN and be <80 chars.
# 
# ChangeSet
#   2005/03/07 14:02:01-05:00 scjody@modernduck.com 
#   
#   Fix a partial conversion to unlocked_ioctl().
#   
#   drivers/ieee1394/dv1394.c: In function `handle_dv1394_init':
#   drivers/ieee1394/dv1394.c:2529: warning: comparison of distinct pointer types lacks a cast
#   drivers/ieee1394/dv1394.c: In function `handle_dv1394_get_status':
#   drivers/ieee1394/dv1394.c:2559: warning: comparison of distinct pointer types lacks a cast
#   drivers/ieee1394/dv1394.c: In function `dv1394_compat_ioctl':
#   drivers/ieee1394/dv1394.c:2593: warning: unused variable `err'
#   
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Dan Dennedy <dan@dennedy.org>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/dv1394.c
#   2005/03/07 14:01:00-05:00 scjody@modernduck.com +4 -7
#   
#   Fix a partial conversion to unlocked_ioctl().
#   
#   drivers/ieee1394/dv1394.c: In function `handle_dv1394_init':
#   drivers/ieee1394/dv1394.c:2529: warning: comparison of distinct pointer types lacks a cast
#   drivers/ieee1394/dv1394.c: In function `handle_dv1394_get_status':
#   drivers/ieee1394/dv1394.c:2559: warning: comparison of distinct pointer types lacks a cast
#   drivers/ieee1394/dv1394.c: In function `dv1394_compat_ioctl':
#   drivers/ieee1394/dv1394.c:2593: warning: unused variable `err'
#   
#   
#   Signed-off-by: Andrew Morton <akpm@osdl.org>
#   Signed-off-by: Dan Dennedy <dan@dennedy.org>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# ChangeSet
#   2005/03/06 19:55:03-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ieee1394
# 
# MAINTAINERS
#   2005/03/06 19:54:58-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/05 15:53:50-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ieee1394
# 
# MAINTAINERS
#   2005/03/05 15:53:45-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/03/05 13:32:17-05:00 scjody@modernduck.com 
#   
#   Description: Use wait_event_interruptible() instead of the deprecated
#   interruptible_sleep_on(). Add a helper function to make the condition
#   for wait_event_interruptible() sane and lock-safe. Patch is compile-tested.
#   
#   Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/video1394.c
#   2005/03/05 13:31:10-05:00 scjody@modernduck.com +16 -15
#   
#   Description: Use wait_event_interruptible() instead of the deprecated
#   interruptible_sleep_on(). Add a helper function to make the condition
#   for wait_event_interruptible() sane and lock-safe. Patch is compile-tested.
#   
#   Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# ChangeSet
#   2005/03/04 22:04:34-08:00 akpm@bix.(none) 
#   Merge bix.(none):/usr/src/bk25 into bix.(none):/usr/src/bk-ieee1394
# 
# MAINTAINERS
#   2005/03/04 22:04:29-08:00 akpm@bix.(none) +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/02/24 10:47:48-05:00 scjody@modernduck.com 
#   ohci1394.c allocates the legacy IR DMA Context on demand. This happens in IRQ
#   path resulting in call to dma_pool_create from within interrupt. Same is true
#   for de-allocation of the IR DMA Context - it happens again in IRQ path
#   resulting in call to dma_pool_destroy.
#   
#   After attempting to fix the above by using schedule_work for delayed
#   allocation and de-allocation, it was determined that it should be fixed
#   simply by moving the allocation to the drivers probe() function and
#   de-allocation to remove() function. This way it reduces the complexity and
#   does not result into any significant wastage of resources.
#   
#   This patch also fixes duplicate pci pool names and removes spaces from the
#   names to make it easier for parsing by scripts.
#   
#   Thanks go to Dave Brownell for greatly simplifying this.
#   
#   Signed-off-by: Parag Warudkar <kernel-stuff@comcast.net>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/ohci1394.c
#   2005/02/24 10:47:23-05:00 scjody@modernduck.com +50 -30
#   ohci1394.c allocates the legacy IR DMA Context on demand. This happens in IRQ
#   path resulting in call to dma_pool_create from within interrupt. Same is true
#   for de-allocation of the IR DMA Context - it happens again in IRQ path
#   resulting in call to dma_pool_destroy.
#   
#   After attempting to fix the above by using schedule_work for delayed
#   allocation and de-allocation, it was determined that it should be fixed
#   simply by moving the allocation to the drivers probe() function and
#   de-allocation to remove() function. This way it reduces the complexity and
#   does not result into any significant wastage of resources.
#   
#   This patch also fixes duplicate pci pool names and removes spaces from the
#   names to make it easier for parsing by scripts.
#   
#   Thanks go to Dave Brownell for greatly simplifying this.
#   
#   Signed-off-by: Parag Warudkar <kernel-stuff@comcast.net>
# 
# ChangeSet
#   2005/02/23 17:17:28-05:00 scjody@modernduck.com 
#   Move hpsb_unregister_protocol, which fixes a hang on rmmod
#   experienced by Parag Warudkar <kernel-stuff@comcast.net>
#   
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/raw1394.c
#   2005/02/23 17:17:04-05:00 scjody@modernduck.com +1 -1
#   Move hpsb_unregister_protocol, which fixes a hang on rmmod
#   experienced by Parag Warudkar <kernel-stuff@comcast.net>
# 
# ChangeSet
#   2005/02/15 13:13:47-05:00 scjody@modernduck.com 
#   This should fix u32 vs. pm_message_t confusion in firewire. No code
#   changes. Please apply,
#                                                           Pavel
#   Signed-off-by: Pavel Machek <pavel@suse.cz>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/ohci1394.c
#   2005/02/15 13:13:22-05:00 scjody@modernduck.com +1 -1
#   This should fix u32 vs. pm_message_t confusion in firewire. No code
#   changes. Please apply,
#                                                           Pavel
#   Signed-off-by: Pavel Machek <pavel@suse.cz>
# 
# drivers/ieee1394/nodemgr.c
#   2005/02/15 13:13:21-05:00 scjody@modernduck.com +1 -1
#   This should fix u32 vs. pm_message_t confusion in firewire. No code
#   changes. Please apply,
#                                                           Pavel
#   Signed-off-by: Pavel Machek <pavel@suse.cz>
# 
# ChangeSet
#   2005/02/10 14:23:38-05:00 scjody@modernduck.com 
#   
#   sbp2: add precautionary log notice to new exit branch from last
#   patch
#   
#   Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/sbp2.c
#   2005/02/10 14:23:13-05:00 scjody@modernduck.com +1 -0
#   
#   sbp2: add precautionary log notice to new exit branch from last
#   patch
#   
#   Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# ChangeSet
#   2005/02/10 14:22:20-05:00 scjody@modernduck.com 
#   
#   apply patch from Nishanth Aravamudan <nacc@us.ibm.com> to use 
#   sleep_interruptible for clarity and prevent early return on wait_queue
#   events.
#   
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/sbp2.c
#   2005/02/10 14:21:56-05:00 scjody@modernduck.com +6 -3
#   
#   apply patch from Nishanth Aravamudan <nacc@us.ibm.com> to use 
#   sleep_interruptible for clarity and prevent early return on wait_queue
#   events.
#   
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# ChangeSet
#   2005/02/10 13:08:56-05:00 scjody@modernduck.com 
#   
#   Change the initialization message for eth1394 to KERN_INFO, requested by
#   Steffen Zieger <lkml@steffenspage.de>
#   
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/eth1394.c
#   2005/02/10 13:08:32-05:00 scjody@modernduck.com +1 -1
#   
#   Change the initialization message for eth1394 to KERN_INFO, requested by
#   Steffen Zieger <lkml@steffenspage.de>
#   
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# ChangeSet
#   2005/02/10 13:02:21-05:00 scjody@modernduck.com 
#   Description: Use wait_event_interruptible() instead of the deprecated
#   interruptible_sleep_on(). The first change is simply to clean up the code a
#   little to make it clearer. The second actually does a replacement, mimicking
#   exactly the first. I removed the #if 1/#else/endif logic, as it duplicated the
#   same code. Patch is compile-tested.
#   
#   Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
# drivers/ieee1394/video1394.c
#   2005/02/10 13:01:31-05:00 scjody@modernduck.com +6 -16
#   Description: Use wait_event_interruptible() instead of the deprecated
#   interruptible_sleep_on(). The first change is simply to clean up the code a
#   little to make it clearer. The second actually does a replacement, mimicking
#   exactly the first. I removed the #if 1/#else/endif logic, as it duplicated the
#   same code. Patch is compile-tested.
#   
#   Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
#   
#   --- 2.6.11-rc2-kj-v/drivers/ieee1394/video1394.c	2005-01-24 09:34:07.000000000 -0800
#   +++ 2.6.11-rc2-kj/drivers/ieee1394/video1394.c	2005-01-24 15:06:16.000000000 -0800
#   @@ -964,10 +964,9 @@ static int __video1394_ioctl(struct file
#    				}
#    			}
#    #else
#   -			if (wait_event_interruptible(d->waitq,
#   -						     d->buffer_status[v.buffer]
#   -						     == VIDEO1394_BUFFER_READY)
#   -			    == -ERESTARTSYS)
#   +			wait_event_interruptible(d->waitq,
#   +					(d->buffer_status[v.buffer] == VIDEO1394_BUFFER_READY));
#   +			if (signal_pending(current))
#    				return -EINTR;
#    #endif
#    			d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE;
#   @@ -1126,19 +1125,10 @@ static int __video1394_ioctl(struct file
#    			d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE;
#    			return 0;
#    		case VIDEO1394_BUFFER_QUEUED:
#   -#if 1
#   -			while (d->buffer_status[v.buffer]!=
#   -			      VIDEO1394_BUFFER_READY) {
#   -				interruptible_sleep_on(&d->waitq);
#   -				if (signal_pending(current)) return -EINTR;
#   -			}
#   -#else
#   -			if (wait_event_interruptible(d->waitq,
#   -						     d->buffer_status[v.buffer]
#   -						     == VIDEO1394_BUFFER_READY)
#   -			    == -ERESTARTSYS)
#   +			wait_event_interruptible(d->waitq,
#   +					(d->buffer_status[v.buffer] == VIDEO1394_BUFFER_READY));
#   +			if (signal_pending(current))
#    				return -EINTR;
#   -#endif
#    			d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE;
#    			return 0;
#    		default:
#   Signed-off-by: Jody McIntyre <scjody@modernduck.com>
# 
diff -Nru a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
--- a/drivers/ieee1394/dv1394.c	2005-03-07 15:24:39 -08:00
+++ b/drivers/ieee1394/dv1394.c	2005-03-07 15:24:39 -08:00
@@ -2531,7 +2531,7 @@
 	mm_segment_t old_fs;
 	int ret;
 
-	if (file->f_op->ioctl != dv1394_ioctl)
+	if (file->f_op->unlocked_ioctl != dv1394_ioctl)
 		return -EFAULT;
 
 	if (copy_from_user(&dv32, (void __user *)arg, sizeof(dv32)))
@@ -2547,8 +2547,7 @@
 
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	ret = dv1394_ioctl(file,
-			   DV1394_IOC_INIT, (unsigned long)&dv);
+	ret = dv1394_ioctl(file, DV1394_IOC_INIT, (unsigned long)&dv);
 	set_fs(old_fs);
 
 	return ret;
@@ -2561,13 +2560,12 @@
 	mm_segment_t old_fs;
 	int ret;
 
-	if (file->f_op->ioctl != dv1394_ioctl)
+	if (file->f_op->unlocked_ioctl != dv1394_ioctl)
 		return -EFAULT;
 
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
-	ret = dv1394_ioctl(file,
-			   DV1394_IOC_GET_STATUS, (unsigned long)&dv);
+	ret = dv1394_ioctl(file, DV1394_IOC_GET_STATUS, (unsigned long)&dv);
 	set_fs(old_fs);
 
 	if (!ret) {
@@ -2595,7 +2593,6 @@
 static long dv1394_compat_ioctl(struct file *file, unsigned int cmd,
 			       unsigned long arg)
 {
-	int err;
 	switch (cmd) {
 	case DV1394_IOC_SHUTDOWN:
 	case DV1394_IOC_SUBMIT_FRAMES:
diff -Nru a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
--- a/drivers/ieee1394/eth1394.c	2005-03-07 15:24:39 -08:00
+++ b/drivers/ieee1394/eth1394.c	2005-03-07 15:24:39 -08:00
@@ -625,7 +625,7 @@
 		goto out;
 	}
 
-	ETH1394_PRINT (KERN_ERR, dev->name, "IEEE-1394 IPv4 over 1394 Ethernet (fw-host%d)\n",
+	ETH1394_PRINT (KERN_INFO, dev->name, "IEEE-1394 IPv4 over 1394 Ethernet (fw-host%d)\n",
 		       host->id);
 
 	hi->host = host;
diff -Nru a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
--- a/drivers/ieee1394/nodemgr.c	2005-03-07 15:24:39 -08:00
+++ b/drivers/ieee1394/nodemgr.c	2005-03-07 15:24:39 -08:00
@@ -1284,7 +1284,7 @@
 
 		if (ud->device.driver &&
 		    (!ud->device.driver->suspend ||
-		      ud->device.driver->suspend(&ud->device, 0, 0)))
+		      ud->device.driver->suspend(&ud->device, PMSG_SUSPEND, 0)))
 			device_release_driver(&ud->device);
 	}
 	up_write(&ne->device.bus->subsys.rwsem);
diff -Nru a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
--- a/drivers/ieee1394/ohci1394.c	2005-03-07 15:24:39 -08:00
+++ b/drivers/ieee1394/ohci1394.c	2005-03-07 15:24:39 -08:00
@@ -538,6 +538,11 @@
 	/* Initialize AT dma */
 	initialize_dma_trm_ctx(&ohci->at_req_context);
 	initialize_dma_trm_ctx(&ohci->at_resp_context);
+	
+	/* Initialize IR Legacy DMA */
+	ohci->ir_legacy_channels = 0;
+	initialize_dma_rcv_ctx(&ohci->ir_legacy_context, 1);
+	DBGMSG("ISO receive legacy context activated");
 
 	/*
 	 * Accept AT requests from all nodes. This probably
@@ -1035,22 +1040,6 @@
 			return -EFAULT;
 		}
 
-		/* activate the legacy IR context */
-		if (ohci->ir_legacy_context.ohci == NULL) {
-			if (alloc_dma_rcv_ctx(ohci, &ohci->ir_legacy_context,
-					      DMA_CTX_ISO, 0, IR_NUM_DESC,
-					      IR_BUF_SIZE, IR_SPLIT_BUF_SIZE,
-					      OHCI1394_IsoRcvContextBase) < 0) {
-				PRINT(KERN_ERR, "%s: failed to allocate an IR context",
-				      __FUNCTION__);
-				return -ENOMEM;
-			}
-			ohci->ir_legacy_channels = 0;
-			initialize_dma_rcv_ctx(&ohci->ir_legacy_context, 1);
-
-			DBGMSG("ISO receive legacy context activated");
-		}
-
 		mask = (u64)0x1<<arg;
 
                 spin_lock_irqsave(&ohci->IR_channel_lock, flags);
@@ -1112,12 +1101,6 @@
 
                 spin_unlock_irqrestore(&ohci->IR_channel_lock, flags);
                 DBGMSG("Listening disabled on channel %d", arg);
-
-		if (ohci->ir_legacy_channels == 0) {
-			stop_dma_rcv_ctx(&ohci->ir_legacy_context);
-			free_dma_rcv_ctx(&ohci->ir_legacy_context);
-			DBGMSG("ISO receive legacy context deactivated");
-		}
                 break;
         }
 	default:
@@ -2921,7 +2904,9 @@
 		  enum context_type type, int ctx, int num_desc,
 		  int buf_size, int split_buf_size, int context_base)
 {
-	int i;
+	int i, len;
+	static int num_allocs;
+	static char pool_name[20];
 
 	d->ohci = ohci;
 	d->type = type;
@@ -2965,9 +2950,19 @@
 		free_dma_rcv_ctx(d);
 		return -ENOMEM;
 	}
-
-	d->prg_pool = pci_pool_create("ohci1394 rcv prg", ohci->dev,
+	
+	len = sprintf(pool_name, "ohci1394_rcv_prg");
+	sprintf(pool_name+len, "%d", num_allocs);
+	d->prg_pool = pci_pool_create(pool_name, ohci->dev,
 				sizeof(struct dma_cmd), 4, 0);
+	if(d->prg_pool == NULL)
+	{
+		PRINT(KERN_ERR, "pci_pool_create failed for %s", pool_name);
+		free_dma_rcv_ctx(d);
+		return -ENOMEM;
+	}
+	num_allocs++;
+
 	OHCI_DMA_ALLOC("dma_rcv prg pool");
 
 	for (i=0; i<d->num_desc; i++) {
@@ -3060,7 +3055,9 @@
 		  enum context_type type, int ctx, int num_desc,
 		  int context_base)
 {
-	int i;
+	int i, len;
+	static char pool_name[20];
+	static int num_allocs=0;
 
 	d->ohci = ohci;
 	d->type = type;
@@ -3082,8 +3079,17 @@
 	memset(d->prg_cpu, 0, d->num_desc * sizeof(struct at_dma_prg*));
 	memset(d->prg_bus, 0, d->num_desc * sizeof(dma_addr_t));
 
-	d->prg_pool = pci_pool_create("ohci1394 trm prg", ohci->dev,
+	len = sprintf(pool_name, "ohci1394_trm_prg");
+	sprintf(pool_name+len, "%d", num_allocs);
+	d->prg_pool = pci_pool_create(pool_name, ohci->dev,
 				sizeof(struct at_dma_prg), 4, 0);
+	if (d->prg_pool == NULL) {
+		PRINT(KERN_ERR, "pci_pool_create failed for %s", pool_name);
+		free_dma_trm_ctx(d);
+		return -ENOMEM;
+	}
+	num_allocs++;
+
 	OHCI_DMA_ALLOC("dma_rcv prg pool");
 
 	for (i = 0; i < d->num_desc; i++) {
@@ -3355,10 +3361,19 @@
 	ohci->ISO_channel_usage = 0;
         spin_lock_init(&ohci->IR_channel_lock);
 
-	/* the IR DMA context is allocated on-demand; mark it inactive */
-	ohci->ir_legacy_context.ohci = NULL;
+	/* Allocate the IR DMA context right here so we don't have
+	 * to do it in interrupt path - note that this doesn't
+	 * waste much memory and avoids the jugglery required to
+	 * allocate it in IRQ path. */
+	if (alloc_dma_rcv_ctx(ohci, &ohci->ir_legacy_context,
+			      DMA_CTX_ISO, 0, IR_NUM_DESC,
+			      IR_BUF_SIZE, IR_SPLIT_BUF_SIZE,
+			      OHCI1394_IsoRcvContextBase) < 0) {
+		FAIL(-ENOMEM, "Cannot allocate IR Legacy DMA context");
+	}
 
-	/* same for the IT DMA context */
+	/* We hopefully don't have to pre-allocate IT DMA like we did
+	 * for IR DMA above. Allocate it on-demand and mark inactive. */
 	ohci->it_legacy_context.ohci = NULL;
 
 	if (request_irq(dev->irq, ohci_irq_handler, SA_SHIRQ,
@@ -3398,6 +3413,7 @@
 
 	switch (ohci->init_state) {
 	case OHCI_INIT_DONE:
+		stop_dma_rcv_ctx(&ohci->ir_legacy_context);
 		hpsb_remove_host(ohci->host);
 
 		/* Clear out BUS Options */
@@ -3447,6 +3463,10 @@
 		/* Free IT dma */
 		free_dma_trm_ctx(&ohci->it_legacy_context);
 
+		/* Free IR legacy dma */
+		free_dma_rcv_ctx(&ohci->ir_legacy_context);
+
+
 	case OHCI_INIT_HAVE_SELFID_BUFFER:
 		pci_free_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE,
 				    ohci->selfid_buf_cpu,
@@ -3512,7 +3532,7 @@
 }
 
 
-static int ohci1394_pci_suspend (struct pci_dev *pdev, u32 state)
+static int ohci1394_pci_suspend (struct pci_dev *pdev, pm_message_t state)
 {
 #ifdef CONFIG_PMAC_PBOOK
 	{
@@ -3678,7 +3698,7 @@
 
 static int __init ohci1394_init(void)
 {
-	return pci_module_init(&ohci1394_pci_driver);
+	return pci_register_driver(&ohci1394_pci_driver);
 }
 
 module_init(ohci1394_init);
diff -Nru a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
--- a/drivers/ieee1394/pcilynx.c	2005-03-07 15:24:39 -08:00
+++ b/drivers/ieee1394/pcilynx.c	2005-03-07 15:24:39 -08:00
@@ -1,5 +1,5 @@
 /*
- * ti_pcilynx.c - Texas Instruments PCILynx driver
+ * pcilynx.c - Texas Instruments PCILynx driver
  * Copyright (C) 1999,2000 Andreas Bombe <andreas.bombe@munich.netsurf.de>,
  *                         Stephan Linz <linz@mazet.de>
  *                         Manfred Weihs <weihs@ict.tuwien.ac.at>
@@ -1952,7 +1952,7 @@
         }
 #endif
 
-        ret = pci_module_init(&lynx_pci_driver);
+        ret = pci_register_driver(&lynx_pci_driver);
         if (ret < 0) {
                 PRINT_G(KERN_ERR, "PCI module init failed");
                 goto free_char_dev;
diff -Nru a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
--- a/drivers/ieee1394/raw1394.c	2005-03-07 15:24:39 -08:00
+++ b/drivers/ieee1394/raw1394.c	2005-03-07 15:24:39 -08:00
@@ -2737,7 +2737,8 @@
 						    list) {
 					entry = fi_hlp->addr_list.next;
 					while (entry != &(fi_hlp->addr_list)) {
-						arm_addr = list_entry(entry, struct
+						arm_addr = list_entry(entry,
+								      struct
 								      arm_addr,
 								      addr_list);
 						if (arm_addr->start ==
@@ -2945,10 +2946,10 @@
 {
 	class_simple_device_remove(MKDEV(
 		IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16));
-	hpsb_unregister_protocol(&raw1394_driver);
 	cdev_del(&raw1394_cdev);
 	devfs_remove(RAW1394_DEVICE_NAME);
 	hpsb_unregister_highlevel(&raw1394_highlevel);
+	hpsb_unregister_protocol(&raw1394_driver);
 }
 
 module_init(init_raw1394);
diff -Nru a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
--- a/drivers/ieee1394/sbp2.c	2005-03-07 15:24:39 -08:00
+++ b/drivers/ieee1394/sbp2.c	2005-03-07 15:24:39 -08:00
@@ -905,9 +905,13 @@
 	 * connected to the sbp2 device being removed. That host would
 	 * have a certain amount of time to relogin before the sbp2 device
 	 * allows someone else to login instead. One second makes sense. */
-	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout(HZ);
-
+	msleep_interruptible(1000);
+	if (signal_pending(current)) {
+		SBP2_WARN("aborting sbp2_start_device due to event");
+		sbp2_remove_device(scsi_id);
+		return -EINTR;
+	}
+	
 	/*
 	 * Login to the sbp-2 device
 	 */
diff -Nru a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
--- a/drivers/ieee1394/video1394.c	2005-03-07 15:24:39 -08:00
+++ b/drivers/ieee1394/video1394.c	2005-03-07 15:24:39 -08:00
@@ -710,6 +710,17 @@
 	reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, 1<<d->ctx);
 }
 
+static inline unsigned video1394_buffer_state(struct dma_iso_ctx *d,
+					      unsigned int buffer)
+{
+	unsigned long flags;
+	unsigned int ret;
+	spin_lock_irqsave(&d->lock, flags);
+	ret = d->buffer_status[buffer];
+	spin_unlock_irqrestore(&d->lock, flags);
+	return ret;
+}
+
 static int __video1394_ioctl(struct file *file,
 			     unsigned int cmd, unsigned long arg)
 {
@@ -970,24 +981,13 @@
 			    return -EINTR;
 			}
 
-#if 1
-			while (d->buffer_status[v.buffer]!=
-			      VIDEO1394_BUFFER_READY) {
-				spin_unlock_irqrestore(&d->lock, flags);
-				interruptible_sleep_on(&d->waitq);
-				spin_lock_irqsave(&d->lock, flags);
-				if (signal_pending(current)) {
-					spin_unlock_irqrestore(&d->lock,flags);
-					return -EINTR;
-				}
-			}
-#else
-			if (wait_event_interruptible(d->waitq,
-						     d->buffer_status[v.buffer]
-						     == VIDEO1394_BUFFER_READY)
-			    == -ERESTARTSYS)
-				return -EINTR;
-#endif
+			spin_unlock_irqrestore(&d->lock, flags);
+			wait_event_interruptible(d->waitq,
+					video1394_buffer_state(d, v.buffer) ==
+					 VIDEO1394_BUFFER_READY);
+			if (signal_pending(current))
+                                return -EINTR;
+			spin_lock_irqsave(&d->lock, flags);
 			d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE;
 			break;
 		default:
@@ -1144,19 +1144,10 @@
 			d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE;
 			return 0;
 		case VIDEO1394_BUFFER_QUEUED:
-#if 1
-			while (d->buffer_status[v.buffer]!=
-			      VIDEO1394_BUFFER_READY) {
-				interruptible_sleep_on(&d->waitq);
-				if (signal_pending(current)) return -EINTR;
-			}
-#else
-			if (wait_event_interruptible(d->waitq,
-						     d->buffer_status[v.buffer]
-						     == VIDEO1394_BUFFER_READY)
-			    == -ERESTARTSYS)
+			wait_event_interruptible(d->waitq,
+					(d->buffer_status[v.buffer] == VIDEO1394_BUFFER_READY));
+			if (signal_pending(current))
 				return -EINTR;
-#endif
 			d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE;
 			return 0;
 		default: