mtd: davinci nand: update clock naming
[safe/jmp/linux-2.6] / drivers / ieee1394 / nodemgr.h
index b35c1b5..749b271 100644 (file)
 #define _IEEE1394_NODEMGR_H
 
 #include <linux/device.h>
-#include "csr1212.h"
+#include <asm/system.h>
+#include <asm/types.h>
+
 #include "ieee1394_core.h"
-#include "ieee1394_hotplug.h"
+#include "ieee1394_transactions.h"
+#include "ieee1394_types.h"
 
-/* '1' '3' '9' '4' in ASCII */
-#define IEEE1394_BUSID_MAGIC   __constant_cpu_to_be32(0x31333934)
+struct csr1212_csr;
+struct csr1212_keyval;
+struct hpsb_host;
+struct ieee1394_device_id;
 
 /* This is the start of a Node entry structure. It should be a stable API
  * for which to gather info from the Node Manager about devices attached
@@ -64,12 +69,12 @@ struct unit_directory {
 
        quadlet_t vendor_id;
        struct csr1212_keyval *vendor_name_kv;
-       const char *vendor_oui;
 
        quadlet_t model_id;
        struct csr1212_keyval *model_name_kv;
        quadlet_t specifier_id;
        quadlet_t version;
+       quadlet_t directory_id;
 
        unsigned int id;
 
@@ -78,7 +83,7 @@ struct unit_directory {
        int length;             /* Number of quadlets */
 
        struct device device;
-       struct class_device class_dev;
+       struct device unit_dev;
 
        struct csr1212_keyval *ud_kv;
        u32 lun;                /* logical unit number immediate value */
@@ -87,27 +92,24 @@ struct unit_directory {
 struct node_entry {
        u64 guid;                       /* GUID of this node */
        u32 guid_vendor_id;             /* Top 24bits of guid */
-       const char *guid_vendor_oui;    /* OUI name of guid vendor id */
 
        struct hpsb_host *host;         /* Host this node is attached to */
        nodeid_t nodeid;                /* NodeID */
        struct bus_options busopt;      /* Bus Options */
-       int needs_probe;
+       bool needs_probe;
        unsigned int generation;        /* Synced with hpsb generation */
 
        /* The following is read from the config rom */
        u32 vendor_id;
        struct csr1212_keyval *vendor_name_kv;
-       const char *vendor_oui;
 
        u32 capabilities;
-       struct hpsb_tlabel_pool *tpool;
 
        struct device device;
-       struct class_device class_dev;
+       struct device node_dev;
 
        /* Means this node is not attached anymore */
-       int in_limbo;
+       bool in_limbo;
 
        struct csr1212_csr *csr;
 };
@@ -123,7 +125,7 @@ struct hpsb_protocol_driver {
         * probe function below can implement further protocol
         * dependent or vendor dependent checking.
         */
-       struct ieee1394_device_id *id_table;
+       const struct ieee1394_device_id *id_table;
 
        /*
         * The update function is called when the node has just
@@ -139,37 +141,38 @@ struct hpsb_protocol_driver {
        struct device_driver driver;
 };
 
-int hpsb_register_protocol(struct hpsb_protocol_driver *driver);
+int __hpsb_register_protocol(struct hpsb_protocol_driver *, struct module *);
+static inline int hpsb_register_protocol(struct hpsb_protocol_driver *driver)
+{
+       return __hpsb_register_protocol(driver, THIS_MODULE);
+}
+
 void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver);
 
 static inline int hpsb_node_entry_valid(struct node_entry *ne)
 {
        return ne->generation == get_hpsb_generation(ne->host);
 }
-
-/*
- * This will fill in the given, pre-initialised hpsb_packet with the current
- * information from the node entry (host, node ID, generation number).  It will
- * return false if the node owning the GUID is not accessible (and not modify
- * the hpsb_packet) and return true otherwise.
- *
- * Note that packet sending may still fail in hpsb_send_packet if a bus reset
- * happens while you are trying to set up the packet (due to obsolete generation
- * number).  It will at least reliably fail so that you don't accidentally and
- * unknowingly send your packet to the wrong node.
- */
-void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *pkt);
-
-int hpsb_node_read(struct node_entry *ne, u64 addr,
-                  quadlet_t *buffer, size_t length);
+void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet);
 int hpsb_node_write(struct node_entry *ne, u64 addr,
                    quadlet_t *buffer, size_t length);
-int hpsb_node_lock(struct node_entry *ne, u64 addr,
-                  int extcode, quadlet_t *data, quadlet_t arg);
+static inline int hpsb_node_read(struct node_entry *ne, u64 addr,
+                                quadlet_t *buffer, size_t length)
+{
+       unsigned int g = ne->generation;
 
-/* Iterate the hosts, calling a given function with supplied data for each
- * host. */
-int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *));
+       smp_rmb();
+       return hpsb_read(ne->host, ne->nodeid, g, addr, buffer, length);
+}
+static inline int hpsb_node_lock(struct node_entry *ne, u64 addr, int extcode,
+                                quadlet_t *buffer, quadlet_t arg)
+{
+       unsigned int g = ne->generation;
+
+       smp_rmb();
+       return hpsb_lock(ne->host, ne->nodeid, g, addr, extcode, buffer, arg);
+}
+int nodemgr_for_each_host(void *data, int (*cb)(struct hpsb_host *, void *));
 
 int init_ieee1394_nodemgr(void);
 void cleanup_ieee1394_nodemgr(void);