Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/net/*.c: Use static const

Using static const generally increases object text and decreases data size.
It also generally decreases overall object size.

Signed-off-by: Joe Perches <joe@perches.com>

+78 -69
+2 -2
drivers/net/3c501.c
··· 158 158 struct net_device * __init el1_probe(int unit) 159 159 { 160 160 struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); 161 - static unsigned ports[] = { 0x280, 0x300, 0}; 162 - unsigned *port; 161 + static const unsigned ports[] = { 0x280, 0x300, 0}; 162 + const unsigned *port; 163 163 int err = 0; 164 164 165 165 if (!dev)
+2 -2
drivers/net/3c503.c
··· 392 392 int retval; 393 393 394 394 if (dev->irq < 2) { 395 - int irqlist[] = {5, 9, 3, 4, 0}; 396 - int *irqp = irqlist; 395 + static const int irqlist[] = {5, 9, 3, 4, 0}; 396 + const int *irqp = irqlist; 397 397 398 398 outb(EGACFR_NORM, E33G_GACFR); /* Enable RAM and interrupts. */ 399 399 do {
+2 -2
drivers/net/3c507.c
··· 311 311 struct net_device * __init el16_probe(int unit) 312 312 { 313 313 struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); 314 - static unsigned ports[] = { 0x300, 0x320, 0x340, 0x280, 0}; 315 - unsigned *port; 314 + static const unsigned ports[] = { 0x300, 0x320, 0x340, 0x280, 0}; 315 + const unsigned *port; 316 316 int err = -ENODEV; 317 317 318 318 if (!dev)
+3 -3
drivers/net/3c527.c
··· 317 317 u8 POS; 318 318 u32 base; 319 319 struct mc32_local *lp = netdev_priv(dev); 320 - static u16 mca_io_bases[]={ 320 + static const u16 mca_io_bases[] = { 321 321 0x7280,0x7290, 322 322 0x7680,0x7690, 323 323 0x7A80,0x7A90, 324 324 0x7E80,0x7E90 325 325 }; 326 - static u32 mca_mem_bases[]={ 326 + static const u32 mca_mem_bases[] = { 327 327 0x00C0000, 328 328 0x00C4000, 329 329 0x00C8000, ··· 333 333 0x00D8000, 334 334 0x00DC000 335 335 }; 336 - static char *failures[]={ 336 + static const char * const failures[] = { 337 337 "Processor instruction", 338 338 "Processor data bus", 339 339 "Processor data bus",
+3 -3
drivers/net/at1700.c
··· 270 270 271 271 static int __init at1700_probe1(struct net_device *dev, int ioaddr) 272 272 { 273 - char fmv_irqmap[4] = {3, 7, 10, 15}; 274 - char fmv_irqmap_pnp[8] = {3, 4, 5, 7, 9, 10, 11, 15}; 275 - char at1700_irqmap[8] = {3, 4, 5, 9, 10, 11, 14, 15}; 273 + static const char fmv_irqmap[4] = {3, 7, 10, 15}; 274 + static const char fmv_irqmap_pnp[8] = {3, 4, 5, 7, 9, 10, 11, 15}; 275 + static const char at1700_irqmap[8] = {3, 4, 5, 9, 10, 11, 14, 15}; 276 276 unsigned int i, irq, is_fmv18x = 0, is_at1700 = 0; 277 277 int slot, ret = -ENODEV; 278 278 struct net_local *lp = netdev_priv(dev);
+24 -22
drivers/net/bnx2.c
··· 6811 6811 u32 *p = _p, i, offset; 6812 6812 u8 *orig_p = _p; 6813 6813 struct bnx2 *bp = netdev_priv(dev); 6814 - u32 reg_boundaries[] = { 0x0000, 0x0098, 0x0400, 0x045c, 6815 - 0x0800, 0x0880, 0x0c00, 0x0c10, 6816 - 0x0c30, 0x0d08, 0x1000, 0x101c, 6817 - 0x1040, 0x1048, 0x1080, 0x10a4, 6818 - 0x1400, 0x1490, 0x1498, 0x14f0, 6819 - 0x1500, 0x155c, 0x1580, 0x15dc, 6820 - 0x1600, 0x1658, 0x1680, 0x16d8, 6821 - 0x1800, 0x1820, 0x1840, 0x1854, 6822 - 0x1880, 0x1894, 0x1900, 0x1984, 6823 - 0x1c00, 0x1c0c, 0x1c40, 0x1c54, 6824 - 0x1c80, 0x1c94, 0x1d00, 0x1d84, 6825 - 0x2000, 0x2030, 0x23c0, 0x2400, 6826 - 0x2800, 0x2820, 0x2830, 0x2850, 6827 - 0x2b40, 0x2c10, 0x2fc0, 0x3058, 6828 - 0x3c00, 0x3c94, 0x4000, 0x4010, 6829 - 0x4080, 0x4090, 0x43c0, 0x4458, 6830 - 0x4c00, 0x4c18, 0x4c40, 0x4c54, 6831 - 0x4fc0, 0x5010, 0x53c0, 0x5444, 6832 - 0x5c00, 0x5c18, 0x5c80, 0x5c90, 6833 - 0x5fc0, 0x6000, 0x6400, 0x6428, 6834 - 0x6800, 0x6848, 0x684c, 0x6860, 6835 - 0x6888, 0x6910, 0x8000 }; 6814 + static const u32 reg_boundaries[] = { 6815 + 0x0000, 0x0098, 0x0400, 0x045c, 6816 + 0x0800, 0x0880, 0x0c00, 0x0c10, 6817 + 0x0c30, 0x0d08, 0x1000, 0x101c, 6818 + 0x1040, 0x1048, 0x1080, 0x10a4, 6819 + 0x1400, 0x1490, 0x1498, 0x14f0, 6820 + 0x1500, 0x155c, 0x1580, 0x15dc, 6821 + 0x1600, 0x1658, 0x1680, 0x16d8, 6822 + 0x1800, 0x1820, 0x1840, 0x1854, 6823 + 0x1880, 0x1894, 0x1900, 0x1984, 6824 + 0x1c00, 0x1c0c, 0x1c40, 0x1c54, 6825 + 0x1c80, 0x1c94, 0x1d00, 0x1d84, 6826 + 0x2000, 0x2030, 0x23c0, 0x2400, 6827 + 0x2800, 0x2820, 0x2830, 0x2850, 6828 + 0x2b40, 0x2c10, 0x2fc0, 0x3058, 6829 + 0x3c00, 0x3c94, 0x4000, 0x4010, 6830 + 0x4080, 0x4090, 0x43c0, 0x4458, 6831 + 0x4c00, 0x4c18, 0x4c40, 0x4c54, 6832 + 0x4fc0, 0x5010, 0x53c0, 0x5444, 6833 + 0x5c00, 0x5c18, 0x5c80, 0x5c90, 6834 + 0x5fc0, 0x6000, 0x6400, 0x6428, 6835 + 0x6800, 0x6848, 0x684c, 0x6860, 6836 + 0x6888, 0x6910, 0x8000 6837 + }; 6836 6838 6837 6839 regs->version = 0; 6838 6840
+1 -1
drivers/net/e2100.c
··· 216 216 printk(" %02X", station_addr[i]); 217 217 218 218 if (dev->irq < 2) { 219 - int irqlist[] = {15, 11, 10, 12, 5, 9, 3, 4}; 219 + static const int irqlist[] = {15, 11, 10, 12, 5, 9, 3, 4}; 220 220 for (i = 0; i < ARRAY_SIZE(irqlist); i++) 221 221 if (request_irq (irqlist[i], NULL, 0, "bogus", NULL) != -EBUSY) { 222 222 dev->irq = irqlist[i];
+5 -4
drivers/net/eepro.c
··· 891 891 there is non-reboot way to recover if something goes wrong. 892 892 */ 893 893 894 - static char irqrmap[] = {-1,-1,0,1,-1,2,-1,-1,-1,0,3,4,-1,-1,-1,-1}; 895 - static char irqrmap2[] = {-1,-1,4,0,1,2,-1,3,-1,4,5,6,7,-1,-1,-1}; 894 + static const char irqrmap[] = {-1,-1,0,1,-1,2,-1,-1,-1,0,3,4,-1,-1,-1,-1}; 895 + static const char irqrmap2[] = {-1,-1,4,0,1,2,-1,3,-1,4,5,6,7,-1,-1,-1}; 896 896 static int eepro_grab_irq(struct net_device *dev) 897 897 { 898 - int irqlist[] = { 3, 4, 5, 7, 9, 10, 11, 12, 0 }; 899 - int *irqp = irqlist, temp_reg, ioaddr = dev->base_addr; 898 + static const int irqlist[] = { 3, 4, 5, 7, 9, 10, 11, 12, 0 }; 899 + const int *irqp = irqlist; 900 + int temp_reg, ioaddr = dev->base_addr; 900 901 901 902 eepro_sw2bank1(ioaddr); /* be CAREFUL, BANK 1 now */ 902 903
+1 -1
drivers/net/eexpress.c
··· 1103 1103 dev->dev_addr[i] = ((unsigned char *)hw_addr)[5-i]; 1104 1104 1105 1105 { 1106 - static char irqmap[]={0, 9, 3, 4, 5, 10, 11, 0}; 1106 + static const char irqmap[] = { 0, 9, 3, 4, 5, 10, 11, 0 }; 1107 1107 unsigned short setupval = eexp_hw_readeeprom(ioaddr,0); 1108 1108 1109 1109 /* Use the IRQ from EEPROM if none was given */
+6 -4
drivers/net/gianfar.c
··· 143 143 static void gfar_halt_nodisable(struct net_device *dev); 144 144 void gfar_start(struct net_device *dev); 145 145 static void gfar_clear_exact_match(struct net_device *dev); 146 - static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr); 146 + static void gfar_set_mac_for_addr(struct net_device *dev, int num, 147 + const u8 *addr); 147 148 static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 148 149 149 150 MODULE_AUTHOR("Freescale Semiconductor, Inc"); ··· 3095 3094 static void gfar_clear_exact_match(struct net_device *dev) 3096 3095 { 3097 3096 int idx; 3098 - u8 zero_arr[MAC_ADDR_LEN] = {0,0,0,0,0,0}; 3097 + static const u8 zero_arr[MAC_ADDR_LEN] = {0, 0, 0, 0, 0, 0}; 3099 3098 3100 3099 for(idx = 1;idx < GFAR_EM_NUM + 1;idx++) 3101 - gfar_set_mac_for_addr(dev, idx, (u8 *)zero_arr); 3100 + gfar_set_mac_for_addr(dev, idx, zero_arr); 3102 3101 } 3103 3102 3104 3103 /* Set the appropriate hash bit for the given addr */ ··· 3133 3132 /* There are multiple MAC Address register pairs on some controllers 3134 3133 * This function sets the numth pair to a given address 3135 3134 */ 3136 - static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr) 3135 + static void gfar_set_mac_for_addr(struct net_device *dev, int num, 3136 + const u8 *addr) 3137 3137 { 3138 3138 struct gfar_private *priv = netdev_priv(dev); 3139 3139 struct gfar __iomem *regs = priv->gfargrp[0].regs;
+3 -3
drivers/net/hp.c
··· 162 162 163 163 /* Snarf the interrupt now. Someday this could be moved to open(). */ 164 164 if (dev->irq < 2) { 165 - int irq_16list[] = { 11, 10, 5, 3, 4, 7, 9, 0}; 166 - int irq_8list[] = { 7, 5, 3, 4, 9, 0}; 167 - int *irqp = wordmode ? irq_16list : irq_8list; 165 + static const int irq_16list[] = { 11, 10, 5, 3, 4, 7, 9, 0}; 166 + static const int irq_8list[] = { 7, 5, 3, 4, 9, 0}; 167 + const int *irqp = wordmode ? irq_16list : irq_8list; 168 168 do { 169 169 int irq = *irqp; 170 170 if (request_irq (irq, NULL, 0, "bogus", NULL) != -EBUSY) {
+2 -2
drivers/net/jme.c
··· 135 135 136 136 static void 137 137 jme_setup_wakeup_frame(struct jme_adapter *jme, 138 - u32 *mask, u32 crc, int fnr) 138 + const u32 *mask, u32 crc, int fnr) 139 139 { 140 140 int i; 141 141 ··· 163 163 static inline void 164 164 jme_reset_mac_processor(struct jme_adapter *jme) 165 165 { 166 - u32 mask[WAKEUP_FRAME_MASK_DWNR] = {0, 0, 0, 0}; 166 + static const u32 mask[WAKEUP_FRAME_MASK_DWNR] = {0, 0, 0, 0}; 167 167 u32 crc = 0xCDCDCDCD; 168 168 u32 gpreg0; 169 169 int i;
+10 -10
drivers/net/ksz884x.c
··· 3570 3570 * This routine is used to program Wake-on-LAN pattern. 3571 3571 */ 3572 3572 static void hw_set_wol_frame(struct ksz_hw *hw, int i, uint mask_size, 3573 - u8 *mask, uint frame_size, u8 *pattern) 3573 + const u8 *mask, uint frame_size, const u8 *pattern) 3574 3574 { 3575 3575 int bits; 3576 3576 int from; ··· 3626 3626 * 3627 3627 * This routine is used to add ARP pattern for waking up the host. 3628 3628 */ 3629 - static void hw_add_wol_arp(struct ksz_hw *hw, u8 *ip_addr) 3629 + static void hw_add_wol_arp(struct ksz_hw *hw, const u8 *ip_addr) 3630 3630 { 3631 - u8 mask[6] = { 0x3F, 0xF0, 0x3F, 0x00, 0xC0, 0x03 }; 3631 + static const u8 mask[6] = { 0x3F, 0xF0, 0x3F, 0x00, 0xC0, 0x03 }; 3632 3632 u8 pattern[42] = { 3633 3633 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 3634 3634 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ··· 3651 3651 */ 3652 3652 static void hw_add_wol_bcast(struct ksz_hw *hw) 3653 3653 { 3654 - u8 mask[] = { 0x3F }; 3655 - u8 pattern[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 3654 + static const u8 mask[] = { 0x3F }; 3655 + static const u8 pattern[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 3656 3656 3657 3657 hw_set_wol_frame(hw, 2, 1, mask, MAC_ADDR_LEN, pattern); 3658 3658 } ··· 3669 3669 */ 3670 3670 static void hw_add_wol_mcast(struct ksz_hw *hw) 3671 3671 { 3672 - u8 mask[] = { 0x3F }; 3672 + static const u8 mask[] = { 0x3F }; 3673 3673 u8 pattern[] = { 0x33, 0x33, 0xFF, 0x00, 0x00, 0x00 }; 3674 3674 3675 3675 memcpy(&pattern[3], &hw->override_addr[3], 3); ··· 3687 3687 */ 3688 3688 static void hw_add_wol_ucast(struct ksz_hw *hw) 3689 3689 { 3690 - u8 mask[] = { 0x3F }; 3690 + static const u8 mask[] = { 0x3F }; 3691 3691 3692 3692 hw_set_wol_frame(hw, 0, 1, mask, MAC_ADDR_LEN, hw->override_addr); 3693 3693 } ··· 3700 3700 * 3701 3701 * This routine is used to enable Wake-on-LAN depending on driver settings. 3702 3702 */ 3703 - static void hw_enable_wol(struct ksz_hw *hw, u32 wol_enable, u8 *net_addr) 3703 + static void hw_enable_wol(struct ksz_hw *hw, u32 wol_enable, const u8 *net_addr) 3704 3704 { 3705 3705 hw_cfg_wol(hw, KS8841_WOL_MAGIC_ENABLE, (wol_enable & WAKE_MAGIC)); 3706 3706 hw_cfg_wol(hw, KS8841_WOL_FRAME0_ENABLE, (wol_enable & WAKE_UCAST)); ··· 6208 6208 struct dev_info *hw_priv = priv->adapter; 6209 6209 6210 6210 /* Need to find a way to retrieve the device IP address. */ 6211 - u8 net_addr[] = { 192, 168, 1, 1 }; 6211 + static const u8 net_addr[] = { 192, 168, 1, 1 }; 6212 6212 6213 6213 if (wol->wolopts & ~hw_priv->wol_support) 6214 6214 return -EINVAL; ··· 7241 7241 struct ksz_hw *hw = &hw_priv->hw; 7242 7242 7243 7243 /* Need to find a way to retrieve the device IP address. */ 7244 - u8 net_addr[] = { 192, 168, 1, 1 }; 7244 + static const u8 net_addr[] = { 192, 168, 1, 1 }; 7245 7245 7246 7246 for (i = 0; i < hw->dev_count; i++) { 7247 7247 if (info->netdev[i]) {
+2 -2
drivers/net/ni52.c
··· 388 388 struct net_device * __init ni52_probe(int unit) 389 389 { 390 390 struct net_device *dev = alloc_etherdev(sizeof(struct priv)); 391 - static int ports[] = {0x300, 0x280, 0x360 , 0x320 , 0x340, 0}; 391 + static const int ports[] = {0x300, 0x280, 0x360, 0x320, 0x340, 0}; 392 + const int *port; 392 393 struct priv *p; 393 - int *port; 394 394 int err = 0; 395 395 396 396 if (!dev)
+2 -2
drivers/net/ni65.c
··· 361 361 struct net_device * __init ni65_probe(int unit) 362 362 { 363 363 struct net_device *dev = alloc_etherdev(0); 364 - static int ports[] = {0x360,0x300,0x320,0x340, 0}; 365 - int *port; 364 + static const int ports[] = { 0x360, 0x300, 0x320, 0x340, 0 }; 365 + const int *port; 366 366 int err = 0; 367 367 368 368 if (!dev)
+1 -1
drivers/net/r8169.c
··· 2526 2526 2527 2527 val = mdio_read(ioaddr, 0x0d); 2528 2528 if ((val & 0x00ff) != 0x006c) { 2529 - u32 set[] = { 2529 + static const u32 set[] = { 2530 2530 0x0065, 0x0066, 0x0067, 0x0068, 2531 2531 0x0069, 0x006a, 0x006b, 0x006c 2532 2532 };
+2 -2
drivers/net/skge.c
··· 1191 1191 1192 1192 static void genesis_reset(struct skge_hw *hw, int port) 1193 1193 { 1194 - const u8 zero[8] = { 0 }; 1194 + static const u8 zero[8] = { 0 }; 1195 1195 u32 reg; 1196 1196 1197 1197 skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); ··· 1557 1557 int jumbo = hw->dev[port]->mtu > ETH_DATA_LEN; 1558 1558 int i; 1559 1559 u32 r; 1560 - const u8 zero[6] = { 0 }; 1560 + static const u8 zero[6] = { 0 }; 1561 1561 1562 1562 for (i = 0; i < 10; i++) { 1563 1563 skge_write16(hw, SK_REG(port, TX_MFF_CTRL1),
+6 -2
drivers/net/smc-ultra.c
··· 277 277 dev->base_addr = ioaddr+ULTRA_NIC_OFFSET; 278 278 279 279 { 280 - int addr_tbl[4] = {0x0C0000, 0x0E0000, 0xFC0000, 0xFE0000}; 281 - short num_pages_tbl[4] = {0x20, 0x40, 0x80, 0xff}; 280 + static const int addr_tbl[4] = { 281 + 0x0C0000, 0x0E0000, 0xFC0000, 0xFE0000 282 + }; 283 + static const short num_pages_tbl[4] = { 284 + 0x20, 0x40, 0x80, 0xff 285 + }; 282 286 283 287 dev->mem_start = ((addr & 0x0f) << 13) + addr_tbl[(addr >> 6) & 3] ; 284 288 num_pages = num_pages_tbl[(addr >> 4) & 3];
+1 -1
drivers/net/wd.c
··· 275 275 dev->base_addr = ioaddr+WD_NIC_OFFSET; 276 276 277 277 if (dev->irq < 2) { 278 - int irqmap[] = {9,3,5,7,10,11,15,4}; 278 + static const int irqmap[] = {9, 3, 5, 7, 10, 11, 15, 4}; 279 279 int reg1 = inb(ioaddr+1); 280 280 int reg4 = inb(ioaddr+4); 281 281 if (ancient || reg1 == 0xff) { /* Ack!! No way to read the IRQ! */