x86, ioapic: In mpparse use mp_register_ioapic
[safe/jmp/linux-2.6] / drivers / ieee1394 / csr1212.h
index 6558275..a892d92 100644 (file)
 #define __CSR1212_H__
 
 #include <linux/types.h>
-#include <linux/vmalloc.h>
+#include <linux/slab.h>
+#include <asm/atomic.h>
 
-#define CSR1212_MALLOC(size)           vmalloc((size))
-#define CSR1212_FREE(ptr)              vfree(ptr)
+#define CSR1212_MALLOC(size)   kmalloc((size), GFP_KERNEL)
+#define CSR1212_FREE(ptr)      kfree(ptr)
 
 #define CSR1212_SUCCESS (0)
 
@@ -149,7 +150,7 @@ struct csr1212_keyval {
                struct csr1212_directory directory;
        } value;
        struct csr1212_keyval *associate;
-       int refcnt;
+       atomic_t refcnt;
 
        /* used in generating and/or parsing CSR image */
        struct csr1212_keyval *next, *prev;     /* flat list of CSR elements */
@@ -180,7 +181,7 @@ struct csr1212_csr_rom_cache {
 struct csr1212_csr {
        size_t bus_info_len;    /* bus info block length in bytes */
        size_t crc_len;         /* crc length in bytes */
-       u32 *bus_info_data;     /* bus info data incl bus name and EUI */
+       __be32 *bus_info_data;  /* bus info data incl bus name and EUI */
 
        void *private;          /* private, bus specific data */
        struct csr1212_bus_ops *ops;
@@ -199,7 +200,7 @@ struct csr1212_bus_ops {
         * entries located in the Units Space.  Must return 0 on success
         * anything else indicates an error. */
        int (*bus_read) (struct csr1212_csr *csr, u64 addr,
-                        u16 length, void *buffer, void *private);
+                        void *buffer, void *private);
 
        /* This function is used by csr1212 to allocate a region in units space
         * in the event that Config ROM entries don't all fit in the predefined
@@ -210,11 +211,6 @@ struct csr1212_bus_ops {
        /* This function is used by csr1212 to release a region in units space
         * that is no longer needed. */
        void (*release_addr) (u64 addr, void *private);
-
-       /* This function is used by csr1212 to determine the max read request
-        * supported by a remote node when reading the ConfigROM space.  Must
-        * return 0, 1, or 2 per IEEE 1212.  */
-       int (*get_max_rom) (u32 *bus_info, void *private);
 };
 
 
@@ -224,7 +220,8 @@ struct csr1212_bus_ops {
 #define CSR1212_DESCRIPTOR_LEAF_OVERHEAD (1 * sizeof(u32))
 
 #define CSR1212_DESCRIPTOR_LEAF_TYPE(kv) \
-       (be32_to_cpu((kv)->value.leaf.data[0]) >> CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT)
+       (be32_to_cpu((kv)->value.leaf.data[0]) >> \
+        CSR1212_DESCRIPTOR_LEAF_TYPE_SHIFT)
 #define CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID(kv) \
        (be32_to_cpu((kv)->value.leaf.data[0]) & \
         CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID_MASK)
@@ -349,7 +346,8 @@ csr1212_get_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv);
  * need for code to retain a keyval that has been parsed. */
 static inline void csr1212_keep_keyval(struct csr1212_keyval *kv)
 {
-       kv->refcnt++;
+       atomic_inc(&kv->refcnt);
+       smp_mb__after_atomic_inc();
 }
 
 
@@ -364,24 +362,22 @@ extern void csr1212_release_keyval(struct csr1212_keyval *kv);
  * This macro allows for looping over the keyval entries in a directory and it
  * ensures that keyvals from remote ConfigROMs are parsed properly.
  *
- * _csr is a struct csr1212_csr * that points to CSR associated with dir.
- * _kv is a struct csr1212_keyval * that'll point to the current keyval (loop index).
- * _dir is a struct csr1212_keyval * that points to the directory to be looped.
- * _pos is a struct csr1212_dentry * that is used internally for indexing.
+ * struct csr1212_csr *_csr points to the CSR associated with dir.
+ * struct csr1212_keyval *_kv points to the current keyval (loop index).
+ * struct csr1212_keyval *_dir points to the directory to be looped.
+ * struct csr1212_dentry *_pos is used internally for indexing.
  *
  * kv will be NULL upon exit of the loop.
  */
-#define csr1212_for_each_dir_entry(_csr, _kv, _dir, _pos)                      \
-       for (csr1212_get_keyval((_csr), (_dir)),                                \
-            _pos = (_dir)->value.directory.dentries_head,                      \
-            _kv = (_pos) ? csr1212_get_keyval((_csr), _pos->kv) : NULL;        \
-            (_kv) && (_pos);                                                   \
-            (_kv->associate == NULL) ?                                         \
-                    ((_pos = _pos->next),                                      \
-                     (_kv = (_pos) ? csr1212_get_keyval((_csr), _pos->kv) :    \
-                          NULL)) :                                             \
+#define csr1212_for_each_dir_entry(_csr, _kv, _dir, _pos)              \
+       for (csr1212_get_keyval((_csr), (_dir)),                        \
+            _pos = (_dir)->value.directory.dentries_head,              \
+            _kv = (_pos) ? csr1212_get_keyval((_csr), _pos->kv) : NULL;\
+            (_kv) && (_pos);                                           \
+            (_kv->associate == NULL) ?                                 \
+                    ((_pos = _pos->next), (_kv = (_pos) ?              \
+                               csr1212_get_keyval((_csr), _pos->kv) :  \
+                               NULL)) :                                \
                     (_kv = csr1212_get_keyval((_csr), _kv->associate)))
 
-
-
 #endif /* __CSR1212_H__ */