Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89645
b: refs/heads/master
c: 2a0a259
h: refs/heads/master
i:
  89643: 85a7251
v: v3
  • Loading branch information
Stefan Richter committed Apr 18, 2008
1 parent dca1e33 commit f7f7bad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e09770db0fa33baf8df21fbc18aa24a080330c3f
refs/heads/master: 2a0a2590498be7b92e3e76409c9b8ee722e23c8f
51 changes: 25 additions & 26 deletions trunk/drivers/firewire/fw-transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -294,42 +295,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;
struct fw_phy_packet *p =
container_of(packet, struct fw_phy_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;

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)
Expand Down

0 comments on commit f7f7bad

Please sign in to comment.