Commit b769bd17656f991c5588c676376e5ec77d25997a
1 parent
be5bbd6756
Exists in
master
and in
7 other branches
firewire: core: topology header fix
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Showing 1 changed file with 6 additions and 0 deletions Inline Diff
drivers/firewire/fw-topology.h
1 | /* | 1 | /* |
2 | * Copyright (C) 2003-2006 Kristian Hoegsberg <krh@bitplanet.net> | 2 | * Copyright (C) 2003-2006 Kristian Hoegsberg <krh@bitplanet.net> |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
6 | * the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
7 | * (at your option) any later version. | 7 | * (at your option) any later version. |
8 | * | 8 | * |
9 | * This program is distributed in the hope that it will be useful, | 9 | * This program is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | * | 13 | * |
14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write to the Free Software Foundation, | 15 | * along with this program; if not, write to the Free Software Foundation, |
16 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #ifndef __fw_topology_h | 19 | #ifndef __fw_topology_h |
20 | #define __fw_topology_h | 20 | #define __fw_topology_h |
21 | 21 | ||
22 | #include <linux/list.h> | ||
23 | #include <linux/slab.h> | ||
24 | |||
25 | #include <asm/atomic.h> | ||
26 | |||
22 | enum { | 27 | enum { |
23 | FW_NODE_CREATED, | 28 | FW_NODE_CREATED, |
24 | FW_NODE_UPDATED, | 29 | FW_NODE_UPDATED, |
25 | FW_NODE_DESTROYED, | 30 | FW_NODE_DESTROYED, |
26 | FW_NODE_LINK_ON, | 31 | FW_NODE_LINK_ON, |
27 | FW_NODE_LINK_OFF, | 32 | FW_NODE_LINK_OFF, |
28 | FW_NODE_INITIATED_RESET, | 33 | FW_NODE_INITIATED_RESET, |
29 | }; | 34 | }; |
30 | 35 | ||
31 | struct fw_node { | 36 | struct fw_node { |
32 | u16 node_id; | 37 | u16 node_id; |
33 | u8 color; | 38 | u8 color; |
34 | u8 port_count; | 39 | u8 port_count; |
35 | u8 link_on : 1; | 40 | u8 link_on : 1; |
36 | u8 initiated_reset : 1; | 41 | u8 initiated_reset : 1; |
37 | u8 b_path : 1; | 42 | u8 b_path : 1; |
38 | u8 phy_speed : 2; /* As in the self ID packet. */ | 43 | u8 phy_speed : 2; /* As in the self ID packet. */ |
39 | u8 max_speed : 2; /* Minimum of all phy-speeds on the path from the | 44 | u8 max_speed : 2; /* Minimum of all phy-speeds on the path from the |
40 | * local node to this node. */ | 45 | * local node to this node. */ |
41 | u8 max_depth : 4; /* Maximum depth to any leaf node */ | 46 | u8 max_depth : 4; /* Maximum depth to any leaf node */ |
42 | u8 max_hops : 4; /* Max hops in this sub tree */ | 47 | u8 max_hops : 4; /* Max hops in this sub tree */ |
43 | atomic_t ref_count; | 48 | atomic_t ref_count; |
44 | 49 | ||
45 | /* For serializing node topology into a list. */ | 50 | /* For serializing node topology into a list. */ |
46 | struct list_head link; | 51 | struct list_head link; |
47 | 52 | ||
48 | /* Upper layer specific data. */ | 53 | /* Upper layer specific data. */ |
49 | void *data; | 54 | void *data; |
50 | 55 | ||
51 | struct fw_node *ports[0]; | 56 | struct fw_node *ports[0]; |
52 | }; | 57 | }; |
53 | 58 | ||
54 | static inline struct fw_node *fw_node_get(struct fw_node *node) | 59 | static inline struct fw_node *fw_node_get(struct fw_node *node) |
55 | { | 60 | { |
56 | atomic_inc(&node->ref_count); | 61 | atomic_inc(&node->ref_count); |
57 | 62 | ||
58 | return node; | 63 | return node; |
59 | } | 64 | } |
60 | 65 | ||
61 | static inline void fw_node_put(struct fw_node *node) | 66 | static inline void fw_node_put(struct fw_node *node) |
62 | { | 67 | { |
63 | if (atomic_dec_and_test(&node->ref_count)) | 68 | if (atomic_dec_and_test(&node->ref_count)) |
64 | kfree(node); | 69 | kfree(node); |
65 | } | 70 | } |
66 | 71 | ||
72 | struct fw_card; | ||
67 | void fw_destroy_nodes(struct fw_card *card); | 73 | void fw_destroy_nodes(struct fw_card *card); |
68 | 74 | ||
69 | int fw_compute_block_crc(u32 *block); | 75 | int fw_compute_block_crc(u32 *block); |
70 | 76 | ||
71 | #endif /* __fw_topology_h */ | 77 | #endif /* __fw_topology_h */ |
72 | 78 |