lkml.org 
[lkml]   [2001]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: find struct pci_dev from struct net_device
Date
Take the value of dev->base_addr, mask it's lowest 4 bits, do a scan of all
PCI net devices and in each PCI device try to match to each of the 6 address
regs:

struct pci_dev* find_pci_device_by_baseddr(unsigned long base_addr)
{
struct pci_dev *pcid = NULL;
unsigned long reg;
int i;

base_addr &= ~(0x0000000F);

while ((pcid = pci_find_class(PCI_CLASS_NETWORK_ETHERNET << 8, pcid)))
{
for (i=0; i<6; i++) {
reg = pci_resource_start(pcid,i);
reg &= ~(0x0000000F);
if (reg == base_addr) {
return pcid;
}
}
}

return NULL;
}
-----Original Message-----
From: Sebastian Heidl [mailto:heidl@zib.de]
Sent: Wednesday, September 12, 2001 3:53 PM
To: linux-kernel@vger.kernel.org
Subject: find struct pci_dev from struct net_device



Hi,

What's the easiest way to find a corresponding struct pci_dev from a
struct net_device ? Especially, if the driver does not set
pci_dev.driver_data to it's net_device struct (such as the acenic
driver) ?

thanks,
_sh_

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:03    [W:0.032 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site