summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorMike McCormack <mikem@ring3k.org>2011-03-10 22:32:16 +0900
committerGreg Kroah-Hartman <gregkh@suse.de>2011-03-14 12:24:42 -0700
commit9a77bd58f6bfe05df7ec807c22be40fb2dc62e23 (patch)
treeffae2907545cf9668ffd4a20a9cea8d71c3ec10d /drivers/staging
parentf19dbc0ca8aa8bac415857c14be4252c38b1d925 (diff)
staging: rtl8192e: Store mem_start in priv struct
Signed-off-by: Mike McCormack <mikem@ring3k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/rtl8192e/r8192E.h2
-rw-r--r--drivers/staging/rtl8192e/r8192E_core.c38
2 files changed, 17 insertions, 23 deletions
diff --git a/drivers/staging/rtl8192e/r8192E.h b/drivers/staging/rtl8192e/r8192E.h
index c18705ff816..d59fc0e796d 100644
--- a/drivers/staging/rtl8192e/r8192E.h
+++ b/drivers/staging/rtl8192e/r8192E.h
@@ -868,6 +868,8 @@ struct rtl8192_tx_ring {
typedef struct r8192_priv
{
struct pci_dev *pdev;
+ u8 *mem_start;
+
/* maintain info from eeprom */
short epromtype;
u16 eeprom_vid;
diff --git a/drivers/staging/rtl8192e/r8192E_core.c b/drivers/staging/rtl8192e/r8192E_core.c
index 06b35a234b4..8715d2cee8f 100644
--- a/drivers/staging/rtl8192e/r8192E_core.c
+++ b/drivers/staging/rtl8192e/r8192E_core.c
@@ -210,40 +210,34 @@ u32 read_cam(struct r8192_priv *priv, u8 addr)
u8 read_nic_byte(struct r8192_priv *priv, int x)
{
- struct net_device *dev = priv->ieee80211->dev;
- return 0xff&readb((u8*)dev->mem_start +x);
+ return 0xff & readb(priv->mem_start + x);
}
u32 read_nic_dword(struct r8192_priv *priv, int x)
{
- struct net_device *dev = priv->ieee80211->dev;
- return readl((u8*)dev->mem_start +x);
+ return readl(priv->mem_start + x);
}
u16 read_nic_word(struct r8192_priv *priv, int x)
{
- struct net_device *dev = priv->ieee80211->dev;
- return readw((u8*)dev->mem_start +x);
+ return readw(priv->mem_start + x);
}
void write_nic_byte(struct r8192_priv *priv, int x,u8 y)
{
- struct net_device *dev = priv->ieee80211->dev;
- writeb(y,(u8*)dev->mem_start +x);
+ writeb(y, priv->mem_start + x);
udelay(20);
}
void write_nic_dword(struct r8192_priv *priv, int x,u32 y)
{
- struct net_device *dev = priv->ieee80211->dev;
- writel(y,(u8*)dev->mem_start +x);
+ writel(y, priv->mem_start + x);
udelay(20);
}
void write_nic_word(struct r8192_priv *priv, int x,u16 y)
{
- struct net_device *dev = priv->ieee80211->dev;
- writew(y,(u8*)dev->mem_start +x);
+ writew(y, priv->mem_start + x);
udelay(20);
}
@@ -4568,7 +4562,6 @@ static const struct net_device_ops rtl8192_netdev_ops = {
static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
- unsigned long ioaddr = 0;
struct net_device *dev = NULL;
struct r8192_priv *priv= NULL;
u8 unit = 0;
@@ -4619,16 +4612,15 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
goto fail;
}
-
- ioaddr = (unsigned long)ioremap_nocache( pmem_start, pmem_len);
- if( ioaddr == (unsigned long)NULL ){
+ priv->mem_start = ioremap_nocache(pmem_start, pmem_len);
+ if (!priv->mem_start) {
RT_TRACE(COMP_ERR,"ioremap failed!\n");
- // release_mem_region( pmem_start, pmem_len );
goto fail1;
}
- dev->mem_start = ioaddr; // shared mem start
- dev->mem_end = ioaddr + pci_resource_len(pdev, 0); // shared mem end
+ dev->mem_start = (unsigned long) priv->mem_start;
+ dev->mem_end = (unsigned long) (priv->mem_start +
+ pci_resource_len(pdev, 0));
/* We disable the RETRY_TIMEOUT register (0x41) to keep
* PCI Tx retries from interfering with C3 CPU state */
@@ -4670,8 +4662,8 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
fail1:
- if( dev->mem_start != (unsigned long)NULL ){
- iounmap( (void *)dev->mem_start );
+ if (priv->mem_start) {
+ iounmap(priv->mem_start);
release_mem_region( pci_resource_start(pdev, 1),
pci_resource_len(pdev, 1) );
}
@@ -4747,8 +4739,8 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev)
priv->irq=0;
}
- if( dev->mem_start != (unsigned long)NULL ){
- iounmap( (void *)dev->mem_start );
+ if (priv->mem_start) {
+ iounmap(priv->mem_start);
release_mem_region( pci_resource_start(pdev, 1),
pci_resource_len(pdev, 1) );
}