diff options
author | Joe Perches <joe@perches.com> | 2013-02-16 15:20:04 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-18 21:45:53 +0400 |
commit | 4153577a8d318ae02b3791341e10e78416de402f (patch) | |
tree | 95c53e095bf5eecdedf7043aac61b9062c07fb43 /drivers/net/ethernet/broadcom/tg3.h | |
parent | 717ff727faa05958633e4e786f5b092c4bcf58e7 (diff) | |
download | linux-4153577a8d318ae02b3791341e10e78416de402f.tar.xz |
tg3: Use different macros for pci_chip_rev_id accesses
Upper case macros for various chip attributes are slightly
difficult to read and are a bit out of characterto the other
tg3_<foo> attribute functions.
Convert:
GET_ASIC_REV(tp->pci_chip_rev_id) -> tg3_asic_rev(tp)
GET_CHIP_REV(tp->pci_chip_rev_id) -> tg3_chip_rev(tp)
Remove:
GET_METAL_REV(tp->pci_chip_rev_id) -> tg3_metal_rev(tp) (unused)
Add:
tg3_chip_rev_id(tp) for tp->pci_chip_rev_id so access styles
are similar to tg3_asic_rev and tg3_chip_rev.
These macros are not converted to static inline functions
because gcc (tested with 4.7.2) is currently unable to
optimize the object code it produces the same way and code
is otherwise larger.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/tg3.h')
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index 3e27f2efbfe0..8d7d4c2ab5d6 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h @@ -161,7 +161,7 @@ #define CHIPREV_ID_5719_A0 0x05719000 #define CHIPREV_ID_5720_A0 0x05720000 #define CHIPREV_ID_5762_A0 0x05762000 -#define GET_ASIC_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 12) + #define ASIC_REV_5700 0x07 #define ASIC_REV_5701 0x00 #define ASIC_REV_5703 0x01 @@ -185,7 +185,6 @@ #define ASIC_REV_5720 0x5720 #define ASIC_REV_57766 0x57766 #define ASIC_REV_5762 0x5762 -#define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) #define CHIPREV_5700_AX 0x70 #define CHIPREV_5700_BX 0x71 #define CHIPREV_5700_CX 0x72 @@ -198,7 +197,6 @@ #define CHIPREV_5784_AX 0x57840 #define CHIPREV_5761_AX 0x57610 #define CHIPREV_57765_AX 0x577650 -#define GET_METAL_REV(CHIP_REV_ID) ((CHIP_REV_ID) & 0xff) #define METAL_REV_A0 0x00 #define METAL_REV_A1 0x01 #define METAL_REV_B0 0x00 @@ -3357,4 +3355,18 @@ struct tg3 { bool link_up; }; +/* Accessor macros for chip and asic attributes + * + * nb: Using static inlines equivalent to the accessor macros generates + * larger object code with gcc 4.7. + * Using statement expression macros to check tp with + * typecheck(struct tg3 *, tp) also creates larger objects. + */ +#define tg3_chip_rev_id(tp) \ + ((tp)->pci_chip_rev_id) +#define tg3_asic_rev(tp) \ + ((tp)->pci_chip_rev_id >> 12) +#define tg3_chip_rev(tp) \ + ((tp)->pci_chip_rev_id >> 8) + #endif /* !(_T3_H) */ |