Skip to content

Commit

Permalink
[pci] Make driver PCI ID a property of the PCI device
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Feb 17, 2011
1 parent abb5590 commit 5bde349
Show file tree
Hide file tree
Showing 45 changed files with 77 additions and 107 deletions.
3 changes: 1 addition & 2 deletions src/arch/i386/drivers/net/undi.c
Expand Up @@ -62,8 +62,7 @@ static struct undi_rom * undipci_find_rom ( struct pci_device *pci ) {
* @v id PCI ID
* @ret rc Return status code
*/
static int undipci_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused ) {
static int undipci_probe ( struct pci_device *pci ) {
struct undi_device *undi;
struct undi_rom *undirom;
int rc;
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/bus/pci.c
Expand Up @@ -192,9 +192,9 @@ static int pci_probe ( struct pci_device *pci ) {
( id->device != pci->device ) )
continue;
pci->driver = driver;
pci->driver_name = id->name;
DBGC ( pci, "...using driver %s\n", pci->driver_name );
if ( ( rc = driver->probe ( pci, id ) ) != 0 ) {
pci->id = id;
DBGC ( pci, "...using driver %s\n", pci->id->name );
if ( ( rc = driver->probe ( pci ) ) != 0 ) {
DBGC ( pci, "......probe failed: %s\n",
strerror ( rc ) );
continue;
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/infiniband/arbel.c
Expand Up @@ -2642,8 +2642,7 @@ static int arbel_configure_special_qps ( struct arbel *arbel ) {
* @v id PCI ID
* @ret rc Return status code
*/
static int arbel_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused ) {
static int arbel_probe ( struct pci_device *pci ) {
struct arbel *arbel;
struct ib_device *ibdev;
struct arbelprm_init_hca init_hca;
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/infiniband/hermon.c
Expand Up @@ -3332,8 +3332,7 @@ static void hermon_reset ( struct hermon *hermon,
* @v id PCI ID
* @ret rc Return status code
*/
static int hermon_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused ) {
static int hermon_probe ( struct pci_device *pci ) {
struct hermon *hermon;
struct ib_device *ibdev;
struct net_device *netdev;
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/infiniband/linda.c
Expand Up @@ -2316,8 +2316,7 @@ static int linda_init_ib_serdes ( struct linda *linda ) {
* @v id PCI ID
* @ret rc Return status code
*/
static int linda_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused ) {
static int linda_probe ( struct pci_device *pci ) {
struct ib_device *ibdev;
struct linda *linda;
struct QIB_7220_Revision revision;
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/infiniband/qib7322.c
Expand Up @@ -2281,8 +2281,7 @@ static void qib7322_reset ( struct qib7322 *qib7322, struct pci_device *pci ) {
* @v id PCI ID
* @ret rc Return status code
*/
static int qib7322_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused ) {
static int qib7322_probe ( struct pci_device *pci ) {
struct qib7322 *qib7322;
struct QIB_7322_Revision revision;
struct ib_device *ibdev;
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/net/3c90x.c
Expand Up @@ -865,8 +865,7 @@ static struct net_device_operations a3c90x_operations = {
*
* @ret rc Returns 0 on success, negative on failure
*/
static int a3c90x_probe(struct pci_device *pci,
const struct pci_device_id *pci_id __unused)
static int a3c90x_probe(struct pci_device *pci)
{

struct net_device *netdev;
Expand Down
8 changes: 3 additions & 5 deletions src/drivers/net/ath5k/ath5k.c
Expand Up @@ -157,8 +157,7 @@ static const struct {
/*
* Prototypes - PCI stack related functions
*/
static int ath5k_probe(struct pci_device *pdev,
const struct pci_device_id *id);
static int ath5k_probe(struct pci_device *pdev);
static void ath5k_remove(struct pci_device *pdev);

struct pci_driver ath5k_pci_driver __pci_driver = {
Expand Down Expand Up @@ -284,8 +283,7 @@ ath5k_chip_name(enum ath5k_srev_type type, u16 val)
}
#endif

static int ath5k_probe(struct pci_device *pdev,
const struct pci_device_id *id)
static int ath5k_probe(struct pci_device *pdev)
{
void *mem;
struct ath5k_softc *sc;
Expand Down Expand Up @@ -371,7 +369,7 @@ static int ath5k_probe(struct pci_device *pdev,
dev->netdev->dev = (struct device *)pdev;

/* Initialize device */
ret = ath5k_hw_attach(sc, id->driver_data, &sc->ah);
ret = ath5k_hw_attach(sc, pdev->id->driver_data, &sc->ah);
if (ret)
goto err_free_hwinfo;

Expand Down
3 changes: 1 addition & 2 deletions src/drivers/net/atl1e.c
Expand Up @@ -1123,8 +1123,7 @@ static void atl1e_init_netdev(struct net_device *netdev, struct pci_device *pdev
* The OS initialization, configuring of the adapter private structure,
* and a hardware reset occur.
*/
static int atl1e_probe(struct pci_device *pdev,
const struct pci_device_id *ent __unused)
static int atl1e_probe(struct pci_device *pdev)
{
struct net_device *netdev;
struct atl1e_adapter *adapter = NULL;
Expand Down
7 changes: 4 additions & 3 deletions src/drivers/net/b44.c
Expand Up @@ -638,7 +638,7 @@ static void b44_set_rx_mode(struct net_device *netdev)
* @v id Matching entry in ID table
* @ret rc Return status code
*/
static int b44_probe(struct pci_device *pci, const struct pci_device_id *id)
static int b44_probe(struct pci_device *pci)
{
struct net_device *netdev;
struct b44_private *bp;
Expand Down Expand Up @@ -694,8 +694,9 @@ static int b44_probe(struct pci_device *pci, const struct pci_device_id *id)

b44_chip_reset(bp, B44_CHIP_RESET_FULL);

DBG("b44 %s (%04x:%04x) regs=%p MAC=%s\n", id->name, id->vendor,
id->device, bp->regs, eth_ntoa(netdev->ll_addr));
DBG("b44 %s (%04x:%04x) regs=%p MAC=%s\n", pci->id->name,
pci->id->vendor, pci->id->device, bp->regs,
eth_ntoa(netdev->ll_addr));

return 0;
}
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/net/b44.h
Expand Up @@ -453,8 +453,7 @@ static void b44_free_rx_ring ( struct b44_private *bp );
static void b44_rx_refill ( struct b44_private *bp, u32 pending );
static void b44_populate_rx_descriptor (struct b44_private *bp, u32 index);

static int b44_probe ( struct pci_device *pci,
const struct pci_device_id *id );
static int b44_probe ( struct pci_device *pci );
static void b44_remove ( struct pci_device *pci );

static int b44_open ( struct net_device *netdev );
Expand Down
5 changes: 3 additions & 2 deletions src/drivers/net/dmfe.c
Expand Up @@ -458,7 +458,7 @@ static int dmfe_probe ( struct nic *nic, struct pci_device *pci ) {

BASE = pci->ioaddr;
printf("dmfe.c: Found %s Vendor=0x%hX Device=0x%hX\n",
pci->driver_name, pci->vendor, pci->device);
pci->id->name, pci->vendor, pci->device);

/* Read Chip revision */
pci_read_config_dword(pci, PCI_REVISION_ID, &dev_rev);
Expand Down Expand Up @@ -489,7 +489,8 @@ static int dmfe_probe ( struct nic *nic, struct pci_device *pci ) {
nic->node_addr[i] = db->srom[20 + i];

/* Print out some hardware info */
DBG ( "%s: %s at ioaddr %4.4lx\n", pci->driver_name, eth_ntoa ( nic->node_addr ), BASE );
DBG ( "%s: %s at ioaddr %4.4lx\n",
pci->id->name, eth_ntoa ( nic->node_addr ), BASE );

/* Set the card as PCI Bus Master */
adjust_pci_device(pci);
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/net/e1000/e1000_api.h
Expand Up @@ -121,8 +121,7 @@ s32 e1000_mng_write_dhcp_info(struct e1000_hw * hw,
u8 *buffer, u16 length);
u32 e1000_translate_register_82542(u32 reg) __attribute__((weak));

extern int e1000_probe(struct pci_device *pdev,
const struct pci_device_id *id __unused);
extern int e1000_probe(struct pci_device *pdev);
extern void e1000_remove(struct pci_device *pdev);

#endif
3 changes: 1 addition & 2 deletions src/drivers/net/e1000/e1000_main.c
Expand Up @@ -689,8 +689,7 @@ static struct net_device_operations e1000_operations;
*
* @ret rc Return status code
**/
int e1000_probe ( struct pci_device *pdev,
const struct pci_device_id *id __unused )
int e1000_probe ( struct pci_device *pdev )
{
int i, err;
struct net_device *netdev;
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/net/e1000e/e1000e.h
Expand Up @@ -276,8 +276,7 @@ extern void e1000e_init_function_pointers_80003es2lan(struct e1000_hw *hw)
extern void e1000e_init_function_pointers_ich8lan(struct e1000_hw *hw)
__attribute__((weak));

extern int e1000e_probe(struct pci_device *pdev,
const struct pci_device_id *id __unused);
extern int e1000e_probe(struct pci_device *pdev);

extern void e1000e_remove(struct pci_device *pdev);

Expand Down
5 changes: 2 additions & 3 deletions src/drivers/net/e1000e/e1000e_main.c
Expand Up @@ -1005,16 +1005,15 @@ static struct net_device_operations e1000e_operations;
*
* @ret rc Return status code
**/
int e1000e_probe ( struct pci_device *pdev,
const struct pci_device_id *ent)
int e1000e_probe ( struct pci_device *pdev )
{
int i, err;
struct net_device *netdev;
struct e1000_adapter *adapter;
unsigned long mmio_start, mmio_len;
unsigned long flash_start, flash_len;
struct e1000_hw *hw;
const struct e1000_info *ei = e1000_info_tbl[ent->driver_data];
const struct e1000_info *ei = e1000_info_tbl[pdev->id->driver_data];

DBGP ( "e1000_probe\n" );

Expand Down
3 changes: 1 addition & 2 deletions src/drivers/net/eepro100.c
Expand Up @@ -167,8 +167,7 @@ static struct net_device_operations ifec_operations = {
* This function is called very early on, while iPXE is initializing.
* This is a iPXE PCI Device Driver API function.
*/
static int ifec_pci_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused )
static int ifec_pci_probe ( struct pci_device *pci )
{
struct net_device *netdev;
struct ifec_private *priv;
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/eepro100.h
Expand Up @@ -171,7 +171,7 @@ struct ifec_private {
/**************************** Function prototypes ****************************/

/* PCI device API prototypes */
static int ifec_pci_probe ( struct pci_device*, const struct pci_device_id*);
static int ifec_pci_probe ( struct pci_device *pci );
static void ifec_pci_remove ( struct pci_device *pci );

/* Network device API prototypes */
Expand Down
5 changes: 2 additions & 3 deletions src/drivers/net/etherfabric.c
Expand Up @@ -4129,8 +4129,7 @@ efab_remove ( struct pci_device *pci )
}

static int
efab_probe ( struct pci_device *pci,
const struct pci_device_id *id )
efab_probe ( struct pci_device *pci )
{
struct net_device *netdev;
struct efab_nic *efab;
Expand Down Expand Up @@ -4190,7 +4189,7 @@ efab_probe ( struct pci_device *pci,
goto fail5;
}

EFAB_LOG ( "Found %s EtherFabric %s %s revision %d\n", id->name,
EFAB_LOG ( "Found %s EtherFabric %s %s revision %d\n", pci->id->name,
efab->is_asic ? "ASIC" : "FPGA",
efab->phy_10g ? "10G" : "1G",
efab->pci_revision );
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/net/forcedeth.c
Expand Up @@ -1796,7 +1796,7 @@ forcedeth_map_regs ( struct forcedeth_private *priv )
* @ret rc Return status code
**/
static int
forcedeth_probe ( struct pci_device *pdev, const struct pci_device_id *ent )
forcedeth_probe ( struct pci_device *pdev )
{
struct net_device *netdev;
struct forcedeth_private *priv;
Expand All @@ -1806,7 +1806,7 @@ forcedeth_probe ( struct pci_device *pdev, const struct pci_device_id *ent )
DBGP ( "forcedeth_probe\n" );

DBG ( "Found %s, vendor = %#04x, device = %#04x\n",
pdev->driver_name, ent->vendor, ent->device );
pdev->id->name, pdev->id->vendor, pdev->id->device );

/* Allocate our private data */
netdev = alloc_etherdev ( sizeof ( *priv ) );
Expand All @@ -1829,7 +1829,7 @@ forcedeth_probe ( struct pci_device *pdev, const struct pci_device_id *ent )
/* We'll need these set up for the rest of the routines */
priv->pci_dev = pdev;
priv->netdev = netdev;
priv->driver_data = ent->driver_data;
priv->driver_data = pdev->id->driver_data;

adjust_pci_device ( pdev );

Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/igb/igb.h
Expand Up @@ -34,7 +34,7 @@ FILE_LICENCE ( GPL2_ONLY );

#include "igb_api.h"

extern int igb_probe ( struct pci_device *pdev, const struct pci_device_id *ent);
extern int igb_probe ( struct pci_device *pdev );
extern void igb_remove ( struct pci_device *pdev );

struct igb_adapter;
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/net/igb/igb_main.c
Expand Up @@ -771,8 +771,7 @@ static struct net_device_operations igb_operations;
*
* @ret rc Return status code
**/
int igb_probe ( struct pci_device *pdev,
const struct pci_device_id *ent __unused)
int igb_probe ( struct pci_device *pdev )
{
int i, err;
struct net_device *netdev;
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/net/igbvf/igbvf_main.c
Expand Up @@ -779,8 +779,7 @@ void igbvf_get_hw_control ( struct igbvf_adapter *adapter )
* The OS initialization, configuring of the adapter private structure,
* and a hardware reset occur.
**/
int igbvf_probe ( struct pci_device *pdev,
const struct pci_device_id *ent __unused )
int igbvf_probe ( struct pci_device *pdev )
{
int err;
struct net_device *netdev;
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/jme.c
Expand Up @@ -1175,7 +1175,7 @@ jme_load_macaddr(struct net_device *netdev)
* @ret rc Return status code
*/
static int
jme_probe(struct pci_device *pci, const struct pci_device_id *id __unused)
jme_probe(struct pci_device *pci)
{
struct net_device *netdev;
struct jme_adapter *jme;
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/net/mtd80x.c
Expand Up @@ -617,7 +617,7 @@ static int mtd_probe ( struct nic *nic, struct pci_device *pci ) {
nic->ioaddr = pci->ioaddr;
nic->irqno = 0;

mtdx.nic_name = pci->driver_name;
mtdx.nic_name = pci->id->name;
mtdx.dev_id = pci->device;
mtdx.ioaddr = nic->ioaddr;

Expand Down
6 changes: 2 additions & 4 deletions src/drivers/net/myri10ge.c
Expand Up @@ -94,8 +94,7 @@ FILE_LICENCE ( GPL2_ONLY );

/* PCI driver entry points */

static int myri10ge_pci_probe ( struct pci_device*,
const struct pci_device_id* );
static int myri10ge_pci_probe ( struct pci_device* );
static void myri10ge_pci_remove ( struct pci_device* );

/* Network device operations */
Expand Down Expand Up @@ -771,8 +770,7 @@ myri10ge_nv_fini ( struct myri10ge_private *priv )
* This function is called very early on, while iPXE is initializing.
* This is a iPXE PCI Device Driver API function.
*/
static int myri10ge_pci_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused )
static int myri10ge_pci_probe ( struct pci_device *pci )
{
static struct net_device_operations myri10ge_operations = {
.open = myri10ge_net_open,
Expand Down
5 changes: 2 additions & 3 deletions src/drivers/net/natsemi.c
Expand Up @@ -83,7 +83,7 @@ FILE_LICENCE ( GPL_ANY );
static int natsemi_spi_read_bit ( struct bit_basher *, unsigned int );
static void natsemi_spi_write_bit ( struct bit_basher *,unsigned int, unsigned long );
static void natsemi_init_eeprom ( struct natsemi_private * );
static int natsemi_probe (struct pci_device *pci, const struct pci_device_id *id);
static int natsemi_probe (struct pci_device *pci);
static void natsemi_reset (struct net_device *netdev);
static int natsemi_open (struct net_device *netdev);
static int natsemi_transmit (struct net_device *netdev, struct io_buffer *iobuf);
Expand Down Expand Up @@ -164,8 +164,7 @@ static void natsemi_init_eeprom ( struct natsemi_private *np ) {
* @v id PCI ID
* @ret rc Return status code
*/
static int natsemi_probe (struct pci_device *pci,
const struct pci_device_id *id __unused) {
static int natsemi_probe (struct pci_device *pci) {
struct net_device *netdev;
struct natsemi_private *np = NULL;
uint8_t ll_addr_encoded[MAX_LL_ADDR_LEN];
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/net/ns83820.c
Expand Up @@ -824,7 +824,7 @@ static int ns83820_probe ( struct nic *nic, struct pci_device *pci ) {
return 0;

printf("ns83820.c: Found %s, vendor=0x%hX, device=0x%hX\n",
pci->driver_name, pci->vendor, pci->device);
pci->id->name, pci->vendor, pci->device);

/* point to private storage */
ns = &nsx;
Expand Down Expand Up @@ -862,12 +862,12 @@ static int ns83820_probe ( struct nic *nic, struct pci_device *pci ) {
ns->CFG_cache = readl(ns->base + CFG);

if ((ns->CFG_cache & CFG_PCI64_DET)) {
printf("%s: detected 64 bit PCI data bus.\n", pci->driver_name);
printf("%s: detected 64 bit PCI data bus.\n", pci->id->name);
/*dev->CFG_cache |= CFG_DATA64_EN; */
if (!(ns->CFG_cache & CFG_DATA64_EN))
printf
("%s: EEPROM did not enable 64 bit bus. Disabled.\n",
pci->driver_name);
pci->id->name);
} else
ns->CFG_cache &= ~(CFG_DATA64_EN);

Expand Down

0 comments on commit 5bde349

Please sign in to comment.