ieee1394: consolidate uses of IEEE1934_BUSID_MAGIC
[cascardo/linux.git] / drivers / ieee1394 / csr.c
index ab0c80f..31400c8 100644 (file)
@@ -68,22 +68,22 @@ static struct hpsb_highlevel csr_highlevel = {
        .host_reset =   host_reset,
 };
 
-static struct hpsb_address_ops map_ops = {
+const static struct hpsb_address_ops map_ops = {
        .read = read_maps,
 };
 
-static struct hpsb_address_ops fcp_ops = {
+const static struct hpsb_address_ops fcp_ops = {
        .write = write_fcp,
 };
 
-static struct hpsb_address_ops reg_ops = {
+const static struct hpsb_address_ops reg_ops = {
        .read = read_regs,
        .write = write_regs,
        .lock = lock_regs,
        .lock64 = lock64_regs,
 };
 
-static struct hpsb_address_ops config_rom_ops = {
+const static struct hpsb_address_ops config_rom_ops = {
        .read = read_config_rom,
 };
 
@@ -133,8 +133,7 @@ static void host_reset(struct hpsb_host *host)
                 host->csr.state &= ~0x100;
         }
 
-        host->csr.topology_map[1] =
-                cpu_to_be32(be32_to_cpu(host->csr.topology_map[1]) + 1);
+       be32_add_cpu(&host->csr.topology_map[1], 1);
         host->csr.topology_map[2] = cpu_to_be32(host->node_count << 16
                                                 | host->selfid_count);
         host->csr.topology_map[0] =
@@ -142,8 +141,7 @@ static void host_reset(struct hpsb_host *host)
                             | csr_crc16(host->csr.topology_map + 1,
                                         host->selfid_count + 2));
 
-        host->csr.speed_map[1] =
-                cpu_to_be32(be32_to_cpu(host->csr.speed_map[1]) + 1);
+       be32_add_cpu(&host->csr.speed_map[1], 1);
         host->csr.speed_map[0] = cpu_to_be32(0x3f1 << 16
                                              | csr_crc16(host->csr.speed_map+1,
                                                          0x3f1));
@@ -158,12 +156,10 @@ static void host_reset(struct hpsb_host *host)
  */
 static inline void calculate_expire(struct csr_control *csr)
 {
-       unsigned long usecs =
-               (csr->split_timeout_hi & 0x07) * USEC_PER_SEC +
-               (csr->split_timeout_lo >> 19) * 125L;
-
-       csr->expire = usecs_to_jiffies(usecs > 100000L ? usecs : 100000L);
+       unsigned int usecs = (csr->split_timeout_hi & 7) * 1000000 +
+                            (csr->split_timeout_lo >> 19) * 125;
 
+       csr->expire = usecs_to_jiffies(usecs > 100000 ? usecs : 100000);
        HPSB_VERBOSE("CSR: setting expire to %lu, HZ=%u", csr->expire, HZ);
 }
 
@@ -221,7 +217,7 @@ static void add_host(struct hpsb_host *host)
 
        host->csr.generation = 2;
 
-       bus_info[1] = __constant_cpu_to_be32(0x31333934);
+       bus_info[1] = IEEE1394_BUSID_MAGIC;
        bus_info[2] = cpu_to_be32((hpsb_disable_irm ? 0 : 1 << CSR_IRMC_SHIFT) |
                                  (1 << CSR_CMC_SHIFT) |
                                  (1 << CSR_ISC_SHIFT) |
@@ -254,7 +250,7 @@ static void remove_host(struct hpsb_host *host)
 {
        quadlet_t bus_info[CSR_BUS_INFO_SIZE];
 
-       bus_info[1] = __constant_cpu_to_be32(0x31333934);
+       bus_info[1] = IEEE1394_BUSID_MAGIC;
        bus_info[2] = cpu_to_be32((0 << CSR_IRMC_SHIFT) |
                                  (0 << CSR_CMC_SHIFT) |
                                  (0 << CSR_ISC_SHIFT) |