[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux1394-devel
Subject:    [PATCH 1/4] firewire: core: reorganize some address handler variables
From:       Clemens Ladisch <clemens () ladisch ! de>
Date:       2009-12-15 8:06:10
Message-ID: 4B274372.5030500 () ladisch ! de
[Download RAW message or body]

Move the variables that manage the address handler list a few lines up.
Since the list parameter to the lookup_*_address_handler functions is
always the same, this allows us to omit that parameter.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
---
 drivers/firewire/core-transaction.c |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

--- linux-2.6/drivers/firewire/core-transaction.c
+++ linux-2.6/drivers/firewire/core-transaction.c
@@ -415,12 +415,15 @@ void fw_flush_transactions(struct fw_car
 	}
 }
 
+static DEFINE_SPINLOCK(address_handler_lock);
+static LIST_HEAD(address_handler_list);
+
 static struct fw_address_handler *lookup_overlapping_address_handler(
-	struct list_head *list, unsigned long long offset, size_t length)
+	unsigned long long offset, size_t length)
 {
 	struct fw_address_handler *handler;
 
-	list_for_each_entry(handler, list, link) {
+	list_for_each_entry(handler, &address_handler_list, link) {
 		if (handler->offset < offset + length &&
 		    offset < handler->offset + handler->length)
 			return handler;
@@ -430,11 +433,11 @@ static struct fw_address_handler *lookup
 }
 
 static struct fw_address_handler *lookup_enclosing_address_handler(
-	struct list_head *list, unsigned long long offset, size_t length)
+	unsigned long long offset, size_t length)
 {
 	struct fw_address_handler *handler;
 
-	list_for_each_entry(handler, list, link) {
+	list_for_each_entry(handler, &address_handler_list, link) {
 		if (handler->offset <= offset &&
 		    offset + length <= handler->offset + handler->length)
 			return handler;
@@ -443,9 +446,6 @@ static struct fw_address_handler *lookup
 	return NULL;
 }
 
-static DEFINE_SPINLOCK(address_handler_lock);
-static LIST_HEAD(address_handler_list);
-
 const struct fw_address_region fw_high_memory_region =
 	{ .start = 0x000100000000ULL, .end = 0xffffe0000000ULL,  };
 EXPORT_SYMBOL(fw_high_memory_region);
@@ -496,8 +496,7 @@ int fw_core_add_address_handler(struct f
 	handler->offset = region->start;
 	while (handler->offset + handler->length <= region->end) {
 		other =
-		    lookup_overlapping_address_handler(&address_handler_list,
-						       handler->offset,
+		    lookup_overlapping_address_handler(handler->offset,
 						       handler->length);
 		if (other != NULL) {
 			handler->offset += other->length;
@@ -709,8 +708,7 @@ void fw_core_handle_request(struct fw_ca
 	source      = HEADER_GET_SOURCE(p->header[1]);
 
 	spin_lock_irqsave(&address_handler_lock, flags);
-	handler = lookup_enclosing_address_handler(&address_handler_list,
-						   offset, request->length);
+	handler = lookup_enclosing_address_handler(offset, request->length);
 	spin_unlock_irqrestore(&address_handler_lock, flags);
 
 	/*

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
mailing list linux1394-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux1394-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic