Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4153577a authored by Joe Perches's avatar Joe Perches Committed by David S. Miller
Browse files

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: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 717ff727
Loading
Loading
Loading
Loading
+393 −398

File changed.

Preview size limit exceeded, changes collapsed.

+15 −3
Original line number Diff line number Diff line
@@ -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) */