staging: rtl8192e: Store mem_start in priv struct
authorMike McCormack <mikem@ring3k.org>
Thu, 10 Mar 2011 13:32:16 +0000 (22:32 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Mar 2011 19:24:42 +0000 (12:24 -0700)
Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rtl8192e/r8192E.h
drivers/staging/rtl8192e/r8192E_core.c

index c18705ff8160398c40d799a0778c50590cfc5907..d59fc0e796da074e61ea45244af2f46ad4cffb92 100644 (file)
@@ -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;
index 06b35a234b49cb3f466ea5220b794d6f860cf3c0..8715d2cee8f1a50b687e9b16fd55b592f0809926 100644 (file)
@@ -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) );
                }