drivers/net/ethernet/alteon/acenic.c:1010:17: warning: result of comparison of constant 256 with expression of type 'unsigned char' is always true

From: kernel test robot
Date: Thu Jul 02 2020 - 23:39:08 EST


Hi Nathan,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7cc2a8ea104820dd9e702202621e8fd4d9f6c8cf
commit: afe956c577b2d5a3d9834e4424587c1ebcf90c4c kbuild: Enable -Wtautological-compare
date: 3 months ago
config: s390-randconfig-r032-20200703 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project ca464639a1c9dd3944eb055ffd2796e8c2e7639f)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
git checkout afe956c577b2d5a3d9834e4424587c1ebcf90c4c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:19:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
^
In file included from drivers/net/ethernet/alteon/acenic.c:54:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:72:
include/asm-generic/io.h:492:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:20:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
^
In file included from drivers/net/ethernet/alteon/acenic.c:54:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:72:
include/asm-generic/io.h:492:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:21:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
^
In file included from drivers/net/ethernet/alteon/acenic.c:54:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:72:
include/asm-generic/io.h:492:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
include/uapi/linux/swab.h:22:12: note: expanded from macro '___constant_swab32'
(((__u32)(x) & (__u32)0xff000000UL) >> 24)))
^
In file included from drivers/net/ethernet/alteon/acenic.c:54:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:72:
include/asm-generic/io.h:492:45: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:120:12: note: expanded from macro '__swab32'
__fswab32(x))
^
In file included from drivers/net/ethernet/alteon/acenic.c:54:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:72:
include/asm-generic/io.h:503:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:513:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew(cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:523:46: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel(cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:585:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:593:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:601:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:610:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:619:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:628:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
>> drivers/net/ethernet/alteon/acenic.c:1010:17: warning: result of comparison of constant 256 with expression of type 'unsigned char' is always true [-Wtautological-constant-out-of-range-compare]
if (cache_size != SMP_CACHE_BYTES) {
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
>> drivers/net/ethernet/alteon/acenic.c:1013:18: warning: result of comparison of constant 256 with expression of type 'unsigned char' is always false [-Wtautological-constant-out-of-range-compare]
if (cache_size > SMP_CACHE_BYTES)
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~
22 warnings generated.

vim +1010 drivers/net/ethernet/alteon/acenic.c

^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 859
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 860
083abbb7dc16b6 drivers/net/ethernet/alteon/acenic.c Bill Pemberton 2012-12-03 861 static int ace_init(struct net_device *dev)
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 862 {
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 863 struct ace_private *ap;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 864 struct ace_regs __iomem *regs;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 865 struct ace_info *info = NULL;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 866 struct pci_dev *pdev;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 867 unsigned long myjif;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 868 u64 tmp_ptr;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 869 u32 tig_ver, mac1, mac2, tmp, pci_state;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 870 int board_idx, ecode = 0;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 871 short i;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 872 unsigned char cache_size;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 873
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 874 ap = netdev_priv(dev);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 875 regs = ap->regs;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 876
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 877 board_idx = ap->board_idx;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 878
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 879 /*
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 880 * aman@xxxxxxx - its useful to do a NIC reset here to
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 881 * address the `Firmware not running' problem subsequent
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 882 * to any crashes involving the NIC
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 883 */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 884 writel(HW_RESET | (HW_RESET << 24), &regs->HostCtrl);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 885 readl(&regs->HostCtrl); /* PCI write posting */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 886 udelay(5);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 887
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 888 /*
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 889 * Don't access any other registers before this point!
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 890 */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 891 #ifdef __BIG_ENDIAN
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 892 /*
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 893 * This will most likely need BYTE_SWAP once we switch
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 894 * to using __raw_writel()
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 895 */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 896 writel((WORD_SWAP | CLR_INT | ((WORD_SWAP | CLR_INT) << 24)),
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 897 &regs->HostCtrl);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 898 #else
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 899 writel((CLR_INT | WORD_SWAP | ((CLR_INT | WORD_SWAP) << 24)),
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 900 &regs->HostCtrl);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 901 #endif
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 902 readl(&regs->HostCtrl); /* PCI write posting */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 903
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 904 /*
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 905 * Stop the NIC CPU and clear pending interrupts
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 906 */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 907 writel(readl(&regs->CpuCtrl) | CPU_HALT, &regs->CpuCtrl);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 908 readl(&regs->CpuCtrl); /* PCI write posting */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 909 writel(0, &regs->Mb0Lo);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 910
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 911 tig_ver = readl(&regs->HostCtrl) >> 28;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 912
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 913 switch(tig_ver){
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 914 #ifndef CONFIG_ACENIC_OMIT_TIGON_I
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 915 case 4:
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 916 case 5:
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 917 printk(KERN_INFO " Tigon I (Rev. %i), Firmware: %i.%i.%i, ",
949b42544a20fb drivers/net/acenic.c Jaswinder Singh 2009-01-04 918 tig_ver, ap->firmware_major, ap->firmware_minor,
949b42544a20fb drivers/net/acenic.c Jaswinder Singh 2009-01-04 919 ap->firmware_fix);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 920 writel(0, &regs->LocalCtrl);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 921 ap->version = 1;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 922 ap->tx_ring_entries = TIGON_I_TX_RING_ENTRIES;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 923 break;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 924 #endif
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 925 case 6:
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 926 printk(KERN_INFO " Tigon II (Rev. %i), Firmware: %i.%i.%i, ",
949b42544a20fb drivers/net/acenic.c Jaswinder Singh 2009-01-04 927 tig_ver, ap->firmware_major, ap->firmware_minor,
949b42544a20fb drivers/net/acenic.c Jaswinder Singh 2009-01-04 928 ap->firmware_fix);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 929 writel(readl(&regs->CpuBCtrl) | CPU_HALT, &regs->CpuBCtrl);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 930 readl(&regs->CpuBCtrl); /* PCI write posting */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 931 /*
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 932 * The SRAM bank size does _not_ indicate the amount
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 933 * of memory on the card, it controls the _bank_ size!
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 934 * Ie. a 1MB AceNIC will have two banks of 512KB.
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 935 */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 936 writel(SRAM_BANK_512K, &regs->LocalCtrl);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 937 writel(SYNC_SRAM_TIMING, &regs->MiscCfg);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 938 ap->version = 2;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 939 ap->tx_ring_entries = MAX_TX_RING_ENTRIES;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 940 break;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 941 default:
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 942 printk(KERN_WARNING " Unsupported Tigon version detected "
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 943 "(%i)\n", tig_ver);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 944 ecode = -ENODEV;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 945 goto init_error;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 946 }
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 947
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 948 /*
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 949 * ModeStat _must_ be set after the SRAM settings as this change
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 950 * seems to corrupt the ModeStat and possible other registers.
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 951 * The SRAM settings survive resets and setting it to the same
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 952 * value a second time works as well. This is what caused the
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 953 * `Firmware not running' problem on the Tigon II.
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 954 */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 955 #ifdef __BIG_ENDIAN
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 956 writel(ACE_BYTE_SWAP_DMA | ACE_WARN | ACE_FATAL | ACE_BYTE_SWAP_BD |
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 957 ACE_WORD_SWAP_BD | ACE_NO_JUMBO_FRAG, &regs->ModeStat);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 958 #else
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 959 writel(ACE_BYTE_SWAP_DMA | ACE_WARN | ACE_FATAL |
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 960 ACE_WORD_SWAP_BD | ACE_NO_JUMBO_FRAG, &regs->ModeStat);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 961 #endif
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 962 readl(&regs->ModeStat); /* PCI write posting */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 963
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 964 mac1 = 0;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 965 for(i = 0; i < 4; i++) {
ddfce6bb43c6bf drivers/net/acenic.c Stephen Hemminger 2007-10-05 966 int t;
6f9d47220eb2d1 drivers/net/acenic.c Eric Sesterhenn 2006-01-20 967
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 968 mac1 = mac1 << 8;
ddfce6bb43c6bf drivers/net/acenic.c Stephen Hemminger 2007-10-05 969 t = read_eeprom_byte(dev, 0x8c+i);
ddfce6bb43c6bf drivers/net/acenic.c Stephen Hemminger 2007-10-05 970 if (t < 0) {
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 971 ecode = -EIO;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 972 goto init_error;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 973 } else
ddfce6bb43c6bf drivers/net/acenic.c Stephen Hemminger 2007-10-05 974 mac1 |= (t & 0xff);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 975 }
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 976 mac2 = 0;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 977 for(i = 4; i < 8; i++) {
ddfce6bb43c6bf drivers/net/acenic.c Stephen Hemminger 2007-10-05 978 int t;
6f9d47220eb2d1 drivers/net/acenic.c Eric Sesterhenn 2006-01-20 979
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 980 mac2 = mac2 << 8;
ddfce6bb43c6bf drivers/net/acenic.c Stephen Hemminger 2007-10-05 981 t = read_eeprom_byte(dev, 0x8c+i);
ddfce6bb43c6bf drivers/net/acenic.c Stephen Hemminger 2007-10-05 982 if (t < 0) {
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 983 ecode = -EIO;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 984 goto init_error;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 985 } else
ddfce6bb43c6bf drivers/net/acenic.c Stephen Hemminger 2007-10-05 986 mac2 |= (t & 0xff);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 987 }
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 988
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 989 writel(mac1, &regs->MacAddrHi);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 990 writel(mac2, &regs->MacAddrLo);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 991
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 992 dev->dev_addr[0] = (mac1 >> 8) & 0xff;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 993 dev->dev_addr[1] = mac1 & 0xff;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 994 dev->dev_addr[2] = (mac2 >> 24) & 0xff;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 995 dev->dev_addr[3] = (mac2 >> 16) & 0xff;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 996 dev->dev_addr[4] = (mac2 >> 8) & 0xff;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 997 dev->dev_addr[5] = mac2 & 0xff;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 998
e174961ca1a0b2 drivers/net/acenic.c Johannes Berg 2008-10-27 999 printk("MAC: %pM\n", dev->dev_addr);
0795af5729b182 drivers/net/acenic.c Joe Perches 2007-10-03 1000
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1001 /*
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1002 * Looks like this is necessary to deal with on all architectures,
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1003 * even this %$#%$# N440BX Intel based thing doesn't get it right.
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1004 * Ie. having two NICs in the machine, one will have the cache
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1005 * line set at boot time, the other will not.
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1006 */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1007 pdev = ap->pdev;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1008 pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &cache_size);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1009 cache_size <<= 2;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 @1010 if (cache_size != SMP_CACHE_BYTES) {
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1011 printk(KERN_INFO " PCI cache line size set incorrectly "
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1012 "(%i bytes) by BIOS/FW, ", cache_size);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 @1013 if (cache_size > SMP_CACHE_BYTES)
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1014 printk("expecting %i\n", SMP_CACHE_BYTES);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1015 else {
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1016 printk("correcting to %i\n", SMP_CACHE_BYTES);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1017 pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE,
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1018 SMP_CACHE_BYTES >> 2);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1019 }
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1020 }
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1021
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1022 pci_state = readl(&regs->PciState);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1023 printk(KERN_INFO " PCI bus width: %i bits, speed: %iMHz, "
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1024 "latency: %i clks\n",
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1025 (pci_state & PCI_32BIT) ? 32 : 64,
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1026 (pci_state & PCI_66MHZ) ? 66 : 33,
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1027 ap->pci_latency);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1028
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1029 /*
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1030 * Set the max DMA transfer size. Seems that for most systems
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1031 * the performance is better when no MAX parameter is
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1032 * set. However for systems enabling PCI write and invalidate,
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1033 * DMA writes must be set to the L1 cache line size to get
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1034 * optimal performance.
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1035 *
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1036 * The default is now to turn the PCI write and invalidate off
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1037 * - that is what Alteon does for NT.
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1038 */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1039 tmp = READ_CMD_MEM | WRITE_CMD_MEM;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1040 if (ap->version >= 2) {
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1041 tmp |= (MEM_READ_MULTIPLE | (pci_state & PCI_66MHZ));
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1042 /*
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1043 * Tuning parameters only supported for 8 cards
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1044 */
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1045 if (board_idx == BOARD_IDX_OVERFLOW ||
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1046 dis_pci_mem_inval[board_idx]) {
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1047 if (ap->pci_command & PCI_COMMAND_INVALIDATE) {
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1048 ap->pci_command &= ~PCI_COMMAND_INVALIDATE;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1049 pci_write_config_word(pdev, PCI_COMMAND,
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1050 ap->pci_command);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1051 printk(KERN_INFO " Disabling PCI memory "
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1052 "write and invalidate\n");
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1053 }
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1054 } else if (ap->pci_command & PCI_COMMAND_INVALIDATE) {
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1055 printk(KERN_INFO " PCI memory write & invalidate "
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1056 "enabled by BIOS, enabling counter measures\n");
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1057
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1058 switch(SMP_CACHE_BYTES) {
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1059 case 16:
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1060 tmp |= DMA_WRITE_MAX_16;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1061 break;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1062 case 32:
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1063 tmp |= DMA_WRITE_MAX_32;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1064 break;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1065 case 64:
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1066 tmp |= DMA_WRITE_MAX_64;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1067 break;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1068 case 128:
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1069 tmp |= DMA_WRITE_MAX_128;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1070 break;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1071 default:
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1072 printk(KERN_INFO " Cache line size %i not "
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1073 "supported, PCI write and invalidate "
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1074 "disabled\n", SMP_CACHE_BYTES);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1075 ap->pci_command &= ~PCI_COMMAND_INVALIDATE;
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1076 pci_write_config_word(pdev, PCI_COMMAND,
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1077 ap->pci_command);
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1078 }
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1079 }
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1080 }
^1da177e4c3f41 drivers/net/acenic.c Linus Torvalds 2005-04-16 1081

:::::: The code at line 1010 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip