cxgb - revert file mode changes.
[safe/jmp/linux-2.6] / drivers / net / chelsio / pm3393.c
index 76a7ca9..2117c4f 100644 (file)
@@ -45,7 +45,7 @@
 
 #include <linux/crc32.h>
 
-#define OFFSET(REG_ADDR)    (REG_ADDR << 2)
+#define OFFSET(REG_ADDR)    ((REG_ADDR) << 2)
 
 /* Max frame size PM3393 can handle. Includes Ethernet header and CRC. */
 #define MAX_FRAME_SIZE  9600
@@ -428,35 +428,26 @@ static int pm3393_set_speed_duplex_fc(struct cmac *cmac, int speed, int duplex,
        return 0;
 }
 
-static void pm3393_rmon_update(struct adapter *adapter, u32 offs, u64 *val,
-                              int over)
-{
-       u32 val0, val1, val2;
-
-       t1_tpi_read(adapter, offs, &val0);
-       t1_tpi_read(adapter, offs + 4, &val1);
-       t1_tpi_read(adapter, offs + 8, &val2);
-
-       *val &= ~0ull << 40;
-       *val |= val0 & 0xffff;
-       *val |= (val1 & 0xffff) << 16;
-       *val |= (u64)(val2 & 0xff) << 32;
-
-       if (over)
-               *val += 1ull << 40;
-}
-
 #define RMON_UPDATE(mac, name, stat_name) \
-       pm3393_rmon_update((mac)->adapter, OFFSET(name),                \
-                          &(mac)->stats.stat_name,                     \
-                  (ro &((name - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW) >> 2)))
-
+{ \
+       t1_tpi_read((mac)->adapter, OFFSET(name), &val0);     \
+       t1_tpi_read((mac)->adapter, OFFSET((name)+1), &val1); \
+       t1_tpi_read((mac)->adapter, OFFSET((name)+2), &val2); \
+       (mac)->stats.stat_name = (u64)(val0 & 0xffff) | \
+                                ((u64)(val1 & 0xffff) << 16) | \
+                                ((u64)(val2 & 0xff) << 32) | \
+                                ((mac)->stats.stat_name & \
+                                       0xffffff0000000000ULL); \
+       if (ro & \
+           (1ULL << ((name - SUNI1x10GEXP_REG_MSTAT_COUNTER_0_LOW) >> 2))) \
+               (mac)->stats.stat_name += 1ULL << 40; \
+}
 
 static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac,
                                                              int flag)
 {
-       u64 ro;
-       u32 val0, val1, val2, val3;
+       u64     ro;
+       u32     val0, val1, val2, val3;
 
        /* Snap the counters */
        pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL,
@@ -794,8 +785,8 @@ static int pm3393_mac_reset(adapter_t * adapter)
        return successful_reset ? 0 : 1;
 }
 
-struct gmac t1_pm3393_ops = {
-       STATS_TICK_SECS,
-       pm3393_mac_create,
-       pm3393_mac_reset
+const struct gmac t1_pm3393_ops = {
+       .stats_update_period = STATS_TICK_SECS,
+       .create              = pm3393_mac_create,
+       .reset               = pm3393_mac_reset,
 };