]> Pileus Git - ~andy/linux/blobdiff - drivers/firewire/fw-transaction.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen...
[~andy/linux] / drivers / firewire / fw-transaction.c
index 3682e75a09e1bb3b534232a383f6ddbee778d28e..ccf0e4cf108f4b65298f1cde98041cc08027d7e2 100644 (file)
@@ -18,6 +18,7 @@
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
+#include <linux/completion.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -28,7 +29,6 @@
 #include <linux/list.h>
 #include <linux/kthread.h>
 #include <asm/uaccess.h>
-#include <asm/semaphore.h>
 
 #include "fw-transaction.h"
 #include "fw-topology.h"
@@ -294,42 +294,40 @@ fw_send_request(struct fw_card *card, struct fw_transaction *t,
 }
 EXPORT_SYMBOL(fw_send_request);
 
+struct fw_phy_packet {
+       struct fw_packet packet;
+       struct completion done;
+};
+
 static void
 transmit_phy_packet_callback(struct fw_packet *packet,
                             struct fw_card *card, int status)
 {
-       kfree(packet);
-}
-
-static void send_phy_packet(struct fw_card *card, u32 data, int generation)
-{
-       struct fw_packet *packet;
-
-       packet = kzalloc(sizeof(*packet), GFP_ATOMIC);
-       if (packet == NULL)
-               return;
-
-       packet->header[0] = data;
-       packet->header[1] = ~data;
-       packet->header_length = 8;
-       packet->payload_length = 0;
-       packet->speed = SCODE_100;
-       packet->generation = generation;
-       packet->callback = transmit_phy_packet_callback;
+       struct fw_phy_packet *p =
+                       container_of(packet, struct fw_phy_packet, packet);
 
-       card->driver->send_request(card, packet);
+       complete(&p->done);
 }
 
 void fw_send_phy_config(struct fw_card *card,
                        int node_id, int generation, int gap_count)
 {
-       u32 q;
-
-       q = PHY_IDENTIFIER(PHY_PACKET_CONFIG) |
-               PHY_CONFIG_ROOT_ID(node_id) |
-               PHY_CONFIG_GAP_COUNT(gap_count);
-
-       send_phy_packet(card, q, generation);
+       struct fw_phy_packet p;
+       u32 data = PHY_IDENTIFIER(PHY_PACKET_CONFIG) |
+                  PHY_CONFIG_ROOT_ID(node_id) |
+                  PHY_CONFIG_GAP_COUNT(gap_count);
+
+       p.packet.header[0] = data;
+       p.packet.header[1] = ~data;
+       p.packet.header_length = 8;
+       p.packet.payload_length = 0;
+       p.packet.speed = SCODE_100;
+       p.packet.generation = generation;
+       p.packet.callback = transmit_phy_packet_callback;
+       init_completion(&p.done);
+
+       card->driver->send_request(card, &p.packet);
+       wait_for_completion(&p.done);
 }
 
 void fw_flush_transactions(struct fw_card *card)
@@ -389,10 +387,13 @@ lookup_enclosing_address_handler(struct list_head *list,
 static DEFINE_SPINLOCK(address_handler_lock);
 static LIST_HEAD(address_handler_list);
 
-const struct fw_address_region fw_low_memory_region =
-       { .start = 0x000000000000ULL, .end = 0x000100000000ULL,  };
 const struct fw_address_region fw_high_memory_region =
        { .start = 0x000100000000ULL, .end = 0xffffe0000000ULL,  };
+EXPORT_SYMBOL(fw_high_memory_region);
+
+#if 0
+const struct fw_address_region fw_low_memory_region =
+       { .start = 0x000000000000ULL, .end = 0x000100000000ULL,  };
 const struct fw_address_region fw_private_region =
        { .start = 0xffffe0000000ULL, .end = 0xfffff0000000ULL,  };
 const struct fw_address_region fw_csr_region =
@@ -400,11 +401,7 @@ const struct fw_address_region fw_csr_region =
          .end   = CSR_REGISTER_BASE | CSR_CONFIG_ROM_END,  };
 const struct fw_address_region fw_unit_space_region =
        { .start = 0xfffff0000900ULL, .end = 0x1000000000000ULL, };
-EXPORT_SYMBOL(fw_low_memory_region);
-EXPORT_SYMBOL(fw_high_memory_region);
-EXPORT_SYMBOL(fw_private_region);
-EXPORT_SYMBOL(fw_csr_region);
-EXPORT_SYMBOL(fw_unit_space_region);
+#endif  /*  0  */
 
 /**
  * Allocate a range of addresses in the node space of the OHCI