Commit 3c34ac36 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Jeff Garzik

e1000: Fix for 32 bits platforms with 64 bits resources

The e1000 driver stores the content of the PCI resources into
unsigned long's before ioremapping. This breaks on 32 bits
platforms that support 64 bits MMIO resources such as ppc 44x.

This fixes it by removing those temporary variables and passing
directly the result of pci_resource_start/len to ioremap.

The side effect is that I removed the assignments to the netdev
fields mem_start, mem_end and base_addr, which are totally useless
for PCI devices.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
--

 drivers/net/e1000/e1000_main.c |   18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 09dde54c
...@@ -926,8 +926,6 @@ e1000_probe(struct pci_dev *pdev, ...@@ -926,8 +926,6 @@ e1000_probe(struct pci_dev *pdev,
{ {
struct net_device *netdev; struct net_device *netdev;
struct e1000_adapter *adapter; struct e1000_adapter *adapter;
unsigned long mmio_start, mmio_len;
unsigned long flash_start, flash_len;
static int cards_found = 0; static int cards_found = 0;
static int global_quad_port_a = 0; /* global ksp3 port a indication */ static int global_quad_port_a = 0; /* global ksp3 port a indication */
...@@ -970,11 +968,9 @@ e1000_probe(struct pci_dev *pdev, ...@@ -970,11 +968,9 @@ e1000_probe(struct pci_dev *pdev,
adapter->hw.back = adapter; adapter->hw.back = adapter;
adapter->msg_enable = (1 << debug) - 1; adapter->msg_enable = (1 << debug) - 1;
mmio_start = pci_resource_start(pdev, BAR_0);
mmio_len = pci_resource_len(pdev, BAR_0);
err = -EIO; err = -EIO;
adapter->hw.hw_addr = ioremap(mmio_start, mmio_len); adapter->hw.hw_addr = ioremap(pci_resource_start(pdev, BAR_0),
pci_resource_len(pdev, BAR_0));
if (!adapter->hw.hw_addr) if (!adapter->hw.hw_addr)
goto err_ioremap; goto err_ioremap;
...@@ -1009,10 +1005,6 @@ e1000_probe(struct pci_dev *pdev, ...@@ -1009,10 +1005,6 @@ e1000_probe(struct pci_dev *pdev,
#endif #endif
strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
netdev->mem_start = mmio_start;
netdev->mem_end = mmio_start + mmio_len;
netdev->base_addr = adapter->hw.io_base;
adapter->bd_number = cards_found; adapter->bd_number = cards_found;
/* setup the private structure */ /* setup the private structure */
...@@ -1025,9 +1017,9 @@ e1000_probe(struct pci_dev *pdev, ...@@ -1025,9 +1017,9 @@ e1000_probe(struct pci_dev *pdev,
* because it depends on mac_type */ * because it depends on mac_type */
if ((adapter->hw.mac_type == e1000_ich8lan) && if ((adapter->hw.mac_type == e1000_ich8lan) &&
(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { (pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
flash_start = pci_resource_start(pdev, 1); adapter->hw.flash_address =
flash_len = pci_resource_len(pdev, 1); ioremap(pci_resource_start(pdev, 1),
adapter->hw.flash_address = ioremap(flash_start, flash_len); pci_resource_len(pdev, 1));
if (!adapter->hw.flash_address) if (!adapter->hw.flash_address)
goto err_flashmap; goto err_flashmap;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment