Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1415d9189e8c59aa9c77a3bba419dcea062c145f
Commit:     1415d9189e8c59aa9c77a3bba419dcea062c145f
Parent:     002a98f14720f90b107e8c44b7733f9bd5dff728
Author:     Stefan Richter <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 02:10:16 2007 +0200
Committer:  Stefan Richter <[EMAIL PROTECTED]>
CommitDate: Wed Oct 17 00:00:00 2007 +0200

    firewire: optimize fw_core_add_address_handler
    
    Potentially avoids unnecessary loop runs.
    Guarantee quadlet-aligned starts of address regions.
    Document the return values.
    
    Signed-off-by: Stefan Richter <[EMAIL PROTECTED]>
---
 drivers/firewire/fw-transaction.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/firewire/fw-transaction.c 
b/drivers/firewire/fw-transaction.c
index 3e1cb12..9959b79 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -410,7 +410,12 @@ EXPORT_SYMBOL(fw_unit_space_region);
  * controller.  When a request is received that falls within the
  * specified address range, the specified callback is invoked.  The
  * parameters passed to the callback give the details of the
- * particular request
+ * particular request.
+ *
+ * Return value:  0 on success, non-zero otherwise.
+ * The start offset of the handler's address region is determined by
+ * fw_core_add_address_handler() and is returned in handler->offset.
+ * The offset is quadlet-aligned.
  */
 int
 fw_core_add_address_handler(struct fw_address_handler *handler,
@@ -422,14 +427,15 @@ fw_core_add_address_handler(struct fw_address_handler 
*handler,
 
        spin_lock_irqsave(&address_handler_lock, flags);
 
-       handler->offset = region->start;
+       handler->offset = roundup(region->start, 4);
        while (handler->offset + handler->length <= region->end) {
                other =
                    lookup_overlapping_address_handler(&address_handler_list,
                                                       handler->offset,
                                                       handler->length);
                if (other != NULL) {
-                       handler->offset += other->length;
+                       handler->offset =
+                           roundup(other->offset + other->length, 4);
                } else {
                        list_add_tail(&handler->link, &address_handler_list);
                        ret = 0;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to