Commit dae1a3aa authored by Stefan Richter's avatar Stefan Richter

firewire: simplify a struct type

cleanup after "firewire: support S100B...S400B and link slower than PHY"
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: default avatarKristian Høgsberg <krh@redhat.com>
parent f1397490
...@@ -135,17 +135,17 @@ static void update_hop_count(struct fw_node *node) ...@@ -135,17 +135,17 @@ static void update_hop_count(struct fw_node *node)
int i; int i;
for (i = 0; i < node->port_count; i++) { for (i = 0; i < node->port_count; i++) {
if (node->ports[i].node == NULL) if (node->ports[i] == NULL)
continue; continue;
if (node->ports[i].node->max_hops > max_child_hops) if (node->ports[i]->max_hops > max_child_hops)
max_child_hops = node->ports[i].node->max_hops; max_child_hops = node->ports[i]->max_hops;
if (node->ports[i].node->max_depth > depths[0]) { if (node->ports[i]->max_depth > depths[0]) {
depths[1] = depths[0]; depths[1] = depths[0];
depths[0] = node->ports[i].node->max_depth; depths[0] = node->ports[i]->max_depth;
} else if (node->ports[i].node->max_depth > depths[1]) } else if (node->ports[i]->max_depth > depths[1])
depths[1] = node->ports[i].node->max_depth; depths[1] = node->ports[i]->max_depth;
} }
node->max_depth = depths[0] + 1; node->max_depth = depths[0] + 1;
...@@ -245,12 +245,12 @@ static struct fw_node *build_tree(struct fw_card *card, ...@@ -245,12 +245,12 @@ static struct fw_node *build_tree(struct fw_card *card,
break; break;
case SELFID_PORT_CHILD: case SELFID_PORT_CHILD:
node->ports[i].node = child; node->ports[i] = child;
/* /*
* Fix up parent reference for this * Fix up parent reference for this
* child node. * child node.
*/ */
child->ports[child->color].node = node; child->ports[child->color] = node;
child->color = card->color; child->color = card->color;
child = fw_node(child->link.next); child = fw_node(child->link.next);
break; break;
...@@ -321,7 +321,7 @@ for_each_fw_node(struct fw_card *card, struct fw_node *root, ...@@ -321,7 +321,7 @@ for_each_fw_node(struct fw_card *card, struct fw_node *root,
node->color = card->color; node->color = card->color;
for (i = 0; i < node->port_count; i++) { for (i = 0; i < node->port_count; i++) {
child = node->ports[i].node; child = node->ports[i];
if (!child) if (!child)
continue; continue;
if (child->color == card->color) if (child->color == card->color)
...@@ -382,11 +382,11 @@ static void move_tree(struct fw_node *node0, struct fw_node *node1, int port) ...@@ -382,11 +382,11 @@ static void move_tree(struct fw_node *node0, struct fw_node *node1, int port)
struct fw_node *tree; struct fw_node *tree;
int i; int i;
tree = node1->ports[port].node; tree = node1->ports[port];
node0->ports[port].node = tree; node0->ports[port] = tree;
for (i = 0; i < tree->port_count; i++) { for (i = 0; i < tree->port_count; i++) {
if (tree->ports[i].node == node1) { if (tree->ports[i] == node1) {
tree->ports[i].node = node0; tree->ports[i] = node0;
break; break;
} }
} }
...@@ -437,19 +437,17 @@ update_tree(struct fw_card *card, struct fw_node *root) ...@@ -437,19 +437,17 @@ update_tree(struct fw_card *card, struct fw_node *root)
card->irm_node = node0; card->irm_node = node0;
for (i = 0; i < node0->port_count; i++) { for (i = 0; i < node0->port_count; i++) {
if (node0->ports[i].node && node1->ports[i].node) { if (node0->ports[i] && node1->ports[i]) {
/* /*
* This port didn't change, queue the * This port didn't change, queue the
* connected node for further * connected node for further
* investigation. * investigation.
*/ */
if (node0->ports[i].node->color == card->color) if (node0->ports[i]->color == card->color)
continue; continue;
list_add_tail(&node0->ports[i].node->link, list_add_tail(&node0->ports[i]->link, &list0);
&list0); list_add_tail(&node1->ports[i]->link, &list1);
list_add_tail(&node1->ports[i].node->link, } else if (node0->ports[i]) {
&list1);
} else if (node0->ports[i].node) {
/* /*
* The nodes connected here were * The nodes connected here were
* unplugged; unref the lost nodes and * unplugged; unref the lost nodes and
...@@ -457,10 +455,10 @@ update_tree(struct fw_card *card, struct fw_node *root) ...@@ -457,10 +455,10 @@ update_tree(struct fw_card *card, struct fw_node *root)
* them. * them.
*/ */
for_each_fw_node(card, node0->ports[i].node, for_each_fw_node(card, node0->ports[i],
report_lost_node); report_lost_node);
node0->ports[i].node = NULL; node0->ports[i] = NULL;
} else if (node1->ports[i].node) { } else if (node1->ports[i]) {
/* /*
* One or more node were connected to * One or more node were connected to
* this port. Move the new nodes into * this port. Move the new nodes into
...@@ -468,7 +466,7 @@ update_tree(struct fw_card *card, struct fw_node *root) ...@@ -468,7 +466,7 @@ update_tree(struct fw_card *card, struct fw_node *root)
* callbacks for them. * callbacks for them.
*/ */
move_tree(node0, node1, i); move_tree(node0, node1, i);
for_each_fw_node(card, node0->ports[i].node, for_each_fw_node(card, node0->ports[i],
report_found_node); report_found_node);
} }
} }
......
...@@ -27,10 +27,6 @@ enum { ...@@ -27,10 +27,6 @@ enum {
FW_NODE_LINK_OFF = 0x04, FW_NODE_LINK_OFF = 0x04,
}; };
struct fw_port {
struct fw_node *node;
};
struct fw_node { struct fw_node {
u16 node_id; u16 node_id;
u8 color; u8 color;
...@@ -51,7 +47,7 @@ struct fw_node { ...@@ -51,7 +47,7 @@ struct fw_node {
/* Upper layer specific data. */ /* Upper layer specific data. */
void *data; void *data;
struct fw_port ports[0]; struct fw_node *ports[0];
}; };
static inline struct fw_node * static inline struct fw_node *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment