Skip to content

Commit

Permalink
[netdrvr] Remove Becker-template 'io_size' member, when invariant
Browse files Browse the repository at this point in the history
Becker-derived drivers often have the 'io_size' member in their chip
info struct, indicating the minimum required size of the I/O resource
(usually a PCI BAR).  For many situations, this number is either
constant or irrelevant (due to pci_iomap convenience behavior).

This change removes the io_size invariant member, and replaces it with a
compile-time constant.

Drivers updated: fealnx, gt96100eth, winbond-840, yellowfin

Additionally,
- gt96100eth: unused 'drv_flags' removed from gt96100eth
- winbond-840: unused struct match_info removed
- winbond-840: mark pci_id_tbl[] const, __devinitdata

Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Jeff Garzik committed Jul 5, 2006
1 parent 03a8c66 commit c3d8e68
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 28 deletions.
7 changes: 3 additions & 4 deletions drivers/net/fealnx.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,13 @@ enum phy_type_flags {

struct chip_info {
char *chip_name;
int io_size;
int flags;
};

static const struct chip_info skel_netdrv_tbl[] = {
{"100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
{"100/10M Ethernet PCI Adapter", 136, HAS_CHIP_XCVR},
{"1000/100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
{ "100/10M Ethernet PCI Adapter", HAS_MII_XCVR },
{ "100/10M Ethernet PCI Adapter", HAS_CHIP_XCVR },
{ "1000/100/10M Ethernet PCI Adapter", HAS_MII_XCVR },
};

/* Offsets to the Command and Status Registers. */
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/gt96100eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ static int __init gt96100_probe1(struct pci_dev *pci, int port_num)
memset(gp, 0, sizeof(*gp)); // clear it

gp->port_num = port_num;
gp->io_size = GT96100_ETH_IO_SIZE;
gp->port_offset = port_num * GT96100_ETH_IO_SIZE;
gp->phy_addr = phy_addr;
gp->chip_rev = chip_rev;
Expand Down Expand Up @@ -1531,7 +1530,7 @@ static void gt96100_cleanup_module(void)
+ sizeof(gt96100_td_t) * TX_RING_SIZE,
gp->rx_ring);
free_netdev(gtif->dev);
release_region(gtif->iobase, gp->io_size);
release_region(gtif->iobase, GT96100_ETH_IO_SIZE);
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/gt96100eth.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ struct gt96100_private {
mib_counters_t mib;
struct net_device_stats stats;

int io_size;
int port_num; // 0 or 1
int chip_rev;
u32 port_offset;
Expand All @@ -340,7 +339,6 @@ struct gt96100_private {
u32 last_psr; // last value of the port status register

int options; /* User-settable misc. driver options. */
int drv_flags;
struct timer_list timer;
spinlock_t lock; /* Serialise access to device */
};
Expand Down
29 changes: 13 additions & 16 deletions drivers/net/tulip/winbond-840.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,24 +224,21 @@ static const struct pci_device_id w840_pci_tbl[] = {
};
MODULE_DEVICE_TABLE(pci, w840_pci_tbl);

enum {
netdev_res_size = 128, /* size of PCI BAR resource */
};

struct pci_id_info {
const char *name;
struct match_info {
int pci, pci_mask, subsystem, subsystem_mask;
int revision, revision_mask; /* Only 8 bits. */
} id;
int io_size; /* Needed for I/O region check or ioremap(). */
int drv_flags; /* Driver use, intended as capability flags. */
int drv_flags; /* Driver use, intended as capability flags. */
};
static struct pci_id_info pci_id_tbl[] = {
{"Winbond W89c840", /* Sometime a Level-One switch card. */
{ 0x08401050, 0xffffffff, 0x81530000, 0xffff0000 },
128, CanHaveMII | HasBrokenTx | FDXOnNoMII},
{"Winbond W89c840", { 0x08401050, 0xffffffff, },
128, CanHaveMII | HasBrokenTx},
{"Compex RL100-ATX", { 0x201111F6, 0xffffffff,},
128, CanHaveMII | HasBrokenTx},
{NULL,}, /* 0 terminated list. */

static const struct pci_id_info pci_id_tbl[] __devinitdata = {
{ /* Sometime a Level-One switch card. */
"Winbond W89c840", CanHaveMII | HasBrokenTx | FDXOnNoMII},
{ "Winbond W89c840", CanHaveMII | HasBrokenTx},
{ "Compex RL100-ATX", CanHaveMII | HasBrokenTx},
{ } /* terminate list. */
};

/* This driver was written to use PCI memory space, however some x86 systems
Expand Down Expand Up @@ -399,7 +396,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
#ifdef USE_IO_OPS
bar = 0;
#endif
ioaddr = pci_iomap(pdev, bar, pci_id_tbl[chip_idx].io_size);
ioaddr = pci_iomap(pdev, bar, netdev_res_size);
if (!ioaddr)
goto err_out_free_res;

Expand Down
9 changes: 5 additions & 4 deletions drivers/net/yellowfin.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,25 +215,26 @@ enum capability_flags {
HasMACAddrBug=32, /* Only on early revs. */
DontUseEeprom=64, /* Don't read the MAC from the EEPROm. */
};

/* The PCI I/O space extent. */
#define YELLOWFIN_SIZE 0x100
enum {
YELLOWFIN_SIZE = 0x100,
};

struct pci_id_info {
const char *name;
struct match_info {
int pci, pci_mask, subsystem, subsystem_mask;
int revision, revision_mask; /* Only 8 bits. */
} id;
int io_size; /* Needed for I/O region check or ioremap(). */
int drv_flags; /* Driver use, intended as capability flags. */
};

static const struct pci_id_info pci_id_tbl[] = {
{"Yellowfin G-NIC Gigabit Ethernet", { 0x07021000, 0xffffffff},
YELLOWFIN_SIZE,
FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug | DontUseEeprom},
{"Symbios SYM83C885", { 0x07011000, 0xffffffff},
YELLOWFIN_SIZE, HasMII | DontUseEeprom },
HasMII | DontUseEeprom },
{ }
};

Expand Down

0 comments on commit c3d8e68

Please sign in to comment.