svcrpc: treat uid's as unsigned
[safe/jmp/linux-2.6] / drivers / ieee1394 / nodemgr.c
index 79ef5fd..5122b5a 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <linux/bitmap.h>
 #include <linux/kernel.h>
+#include <linux/kmemcheck.h>
 #include <linux/list.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -39,7 +40,10 @@ struct nodemgr_csr_info {
        struct hpsb_host *host;
        nodeid_t nodeid;
        unsigned int generation;
+
+       kmemcheck_bitfield_begin(flags);
        unsigned int speed_unverified:1;
+       kmemcheck_bitfield_end(flags);
 };
 
 
@@ -67,7 +71,7 @@ static int nodemgr_check_speed(struct nodemgr_csr_info *ci, u64 addr,
        for (i = IEEE1394_SPEED_100; i <= old_speed; i++) {
                *speed = i;
                error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr,
-                                 &q, sizeof(quadlet_t));
+                                 &q, 4);
                if (error)
                        break;
                *buffer = q;
@@ -85,7 +89,7 @@ static int nodemgr_check_speed(struct nodemgr_csr_info *ci, u64 addr,
        return error;
 }
 
-static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length,
+static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr,
                            void *buffer, void *__ci)
 {
        struct nodemgr_csr_info *ci = (struct nodemgr_csr_info*)__ci;
@@ -93,7 +97,7 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length,
 
        for (i = 1; ; i++) {
                error = hpsb_read(ci->host, ci->nodeid, ci->generation, addr,
-                                 buffer, length);
+                                 buffer, 4);
                if (!error) {
                        ci->speed_unverified = 0;
                        break;
@@ -104,7 +108,7 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length,
 
                /* The ieee1394_core guessed the node's speed capability from
                 * the self ID.  Check whether a lower speed works. */
-               if (ci->speed_unverified && length == sizeof(quadlet_t)) {
+               if (ci->speed_unverified) {
                        error = nodemgr_check_speed(ci, addr, buffer);
                        if (!error)
                                break;
@@ -115,20 +119,8 @@ static int nodemgr_bus_read(struct csr1212_csr *csr, u64 addr, u16 length,
        return error;
 }
 
-#define OUI_FREECOM_TECHNOLOGIES_GMBH 0x0001db
-
-static int nodemgr_get_max_rom(quadlet_t *bus_info_data, void *__ci)
-{
-       /* Freecom FireWire Hard Drive firmware bug */
-       if (be32_to_cpu(bus_info_data[3]) >> 8 == OUI_FREECOM_TECHNOLOGIES_GMBH)
-               return 0;
-
-       return (be32_to_cpu(bus_info_data[2]) >> 8) & 0x3;
-}
-
 static struct csr1212_bus_ops nodemgr_csr_ops = {
        .bus_read =     nodemgr_bus_read,
-       .get_max_rom =  nodemgr_get_max_rom
 };
 
 
@@ -496,7 +488,7 @@ static struct device_attribute *const fw_host_attrs[] = {
 static ssize_t fw_show_drv_device_ids(struct device_driver *drv, char *buf)
 {
        struct hpsb_protocol_driver *driver;
-       struct ieee1394_device_id *id;
+       const struct ieee1394_device_id *id;
        int length = 0;
        char *scratch = buf;
 
@@ -670,7 +662,7 @@ static int nodemgr_bus_match(struct device * dev, struct device_driver * drv)
 {
        struct hpsb_protocol_driver *driver;
        struct unit_directory *ud;
-       struct ieee1394_device_id *id;
+       const struct ieee1394_device_id *id;
 
        /* We only match unit directories */
        if (dev->platform_data != &nodemgr_ud_platform_data)
@@ -983,6 +975,9 @@ static struct unit_directory *nodemgr_process_unit_directory
        ud->ud_kv = ud_kv;
        ud->id = (*id)++;
 
+       /* inherit vendor_id from root directory if none exists in unit dir */
+       ud->vendor_id = ne->vendor_id;
+
        csr1212_for_each_dir_entry(ne->csr, kv, ud_kv, dentry) {
                switch (kv->key.id) {
                case CSR1212_KV_ID_VENDOR:
@@ -1277,7 +1272,8 @@ static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr,
                csr1212_destroy_csr(csr);
        }
 
-       /* Mark the node current */
+       /* Finally, mark the node current */
+       smp_wmb();
        ne->generation = generation;
 
        if (ne->in_limbo) {
@@ -1301,6 +1297,7 @@ static void nodemgr_node_scan_one(struct hpsb_host *host,
        u8 *speed;
 
        ci = kmalloc(sizeof(*ci), GFP_KERNEL);
+       kmemcheck_annotate_bitfield(ci, flags);
        if (!ci)
                return;
 
@@ -1810,7 +1807,7 @@ void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *packet)
 {
        packet->host = ne->host;
        packet->generation = ne->generation;
-       barrier();
+       smp_rmb();
        packet->node_id = ne->nodeid;
 }
 
@@ -1819,7 +1816,7 @@ int hpsb_node_write(struct node_entry *ne, u64 addr,
 {
        unsigned int generation = ne->generation;
 
-       barrier();
+       smp_rmb();
        return hpsb_write(ne->host, ne->nodeid, generation,
                          addr, buffer, length);
 }