[PATCH] ieee1394: remove unused macros HPSB_PANIC and HPSB_TRACE
[linux-2.6] / drivers / ieee1394 / ieee1394_types.h
1 #ifndef _IEEE1394_TYPES_H
2 #define _IEEE1394_TYPES_H
3
4 #include <linux/kernel.h>
5 #include <linux/list.h>
6 #include <linux/spinlock.h>
7 #include <linux/string.h>
8 #include <linux/types.h>
9
10 #include <asm/byteorder.h>
11 #include <asm/semaphore.h>
12
13 /* Transaction Label handling */
14 struct hpsb_tlabel_pool {
15         DECLARE_BITMAP(pool, 64);
16         spinlock_t lock;
17         u8 next;
18         u32 allocations;
19         struct semaphore count;
20 };
21
22 #define HPSB_TPOOL_INIT(_tp)                    \
23 do {                                            \
24         bitmap_zero((_tp)->pool, 64);           \
25         spin_lock_init(&(_tp)->lock);           \
26         (_tp)->next = 0;                        \
27         (_tp)->allocations = 0;                 \
28         sema_init(&(_tp)->count, 63);           \
29 } while (0)
30
31 typedef u32 quadlet_t;
32 typedef u64 octlet_t;
33 typedef u16 nodeid_t;
34
35 typedef u8  byte_t;
36 typedef u64 nodeaddr_t;
37 typedef u16 arm_length_t;
38
39 #define BUS_MASK  0xffc0
40 #define BUS_SHIFT 6
41 #define NODE_MASK 0x003f
42 #define LOCAL_BUS 0xffc0
43 #define ALL_NODES 0x003f
44
45 #define NODEID_TO_BUS(nodeid)   ((nodeid & BUS_MASK) >> BUS_SHIFT)
46 #define NODEID_TO_NODE(nodeid)  (nodeid & NODE_MASK)
47
48 /* Can be used to consistently print a node/bus ID. */
49 #define NODE_BUS_FMT            "%d-%02d:%04d"
50 #define NODE_BUS_ARGS(__host, __nodeid) \
51         __host->id, NODEID_TO_NODE(__nodeid), NODEID_TO_BUS(__nodeid)
52
53 #define HPSB_PRINT(level, fmt, args...) \
54         printk(level "ieee1394: " fmt "\n" , ## args)
55
56 #define HPSB_DEBUG(fmt, args...)        HPSB_PRINT(KERN_DEBUG, fmt , ## args)
57 #define HPSB_INFO(fmt, args...)         HPSB_PRINT(KERN_INFO, fmt , ## args)
58 #define HPSB_NOTICE(fmt, args...)       HPSB_PRINT(KERN_NOTICE, fmt , ## args)
59 #define HPSB_WARN(fmt, args...)         HPSB_PRINT(KERN_WARNING, fmt , ## args)
60 #define HPSB_ERR(fmt, args...)          HPSB_PRINT(KERN_ERR, fmt , ## args)
61
62 #ifdef CONFIG_IEEE1394_VERBOSEDEBUG
63 #define HPSB_VERBOSE(fmt, args...)      HPSB_PRINT(KERN_DEBUG, fmt , ## args)
64 #else
65 #define HPSB_VERBOSE(fmt, args...)
66 #endif
67
68 #ifdef __BIG_ENDIAN
69
70 static inline void *memcpy_le32(u32 *dest, const u32 *__src, size_t count)
71 {
72         void *tmp = dest;
73         u32 *src = (u32 *)__src;
74
75         count /= 4;
76         while (count--)
77                 *dest++ = swab32p(src++);
78         return tmp;
79 }
80
81 #else
82
83 static __inline__ void *memcpy_le32(u32 *dest, const u32 *src, size_t count)
84 {
85         return memcpy(dest, src, count);
86 }
87
88 #endif /* __BIG_ENDIAN */
89
90 #endif /* _IEEE1394_TYPES_H */