[PATCH 06/18] Staging: rtl8187se: remove CONFIG_RTL8180_IO_MAP ifdefs

From: Bartlomiej Zolnierkiewicz
Date: Sun Jun 28 2009 - 10:13:55 EST


From: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
Subject: [PATCH] Staging: rtl8187se: remove CONFIG_RTL8180_IO_MAP ifdefs

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
---
drivers/staging/rtl8187se/Makefile | 1
drivers/staging/rtl8187se/r8180_core.c | 83 ---------------
drivers/staging/rtl8187se/r8185b_init.c | 168 --------------------------------
3 files changed, 252 deletions(-)

Index: b/drivers/staging/rtl8187se/Makefile
===================================================================
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -1,6 +1,5 @@

#EXTRA_CFLAGS += -DCONFIG_IEEE80211_NOWEP=y
-#EXTRA_CFLAGS += -DCONFIG_RTL8180_IOMAP
#EXTRA_CFLAGS += -std=gnu89
#EXTRA_CFLAGS += -O2
#CC = gcc
Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -59,7 +59,6 @@ double __extendsfdf2(float a) {return a;
//#define DEBUG_RX
//#define DEBUG_RX_SKB

-//#define CONFIG_RTL8180_IO_MAP
#include <linux/syscalls.h>
//#include <linux/fcntl.h>
//#include <asm/uaccess.h>
@@ -78,8 +77,6 @@ double __extendsfdf2(float a) {return a;

#include "ieee80211/dot11d.h"

-//#define CONFIG_RTL8180_IO_MAP
-
#ifndef PCI_VENDOR_ID_BELKIN
#define PCI_VENDOR_ID_BELKIN 0x1799
#endif
@@ -202,39 +199,6 @@ static struct pci_driver rtl8180_pci_dri



-#ifdef CONFIG_RTL8180_IO_MAP
-
-u8 read_nic_byte(struct net_device *dev, int x)
-{
- return 0xff&inb(dev->base_addr +x);
-}
-
-u32 read_nic_dword(struct net_device *dev, int x)
-{
- return inl(dev->base_addr +x);
-}
-
-u16 read_nic_word(struct net_device *dev, int x)
-{
- return inw(dev->base_addr +x);
-}
-
-void write_nic_byte(struct net_device *dev, int x,u8 y)
-{
- outb(y&0xff,dev->base_addr +x);
-}
-
-void write_nic_word(struct net_device *dev, int x,u16 y)
-{
- outw(y,dev->base_addr +x);
-}
-
-void write_nic_dword(struct net_device *dev, int x,u32 y)
-{
- outl(y,dev->base_addr +x);
-}
-
-#else /* RTL_IO_MAP */

u8 read_nic_byte(struct net_device *dev, int x)
{
@@ -269,7 +233,6 @@ void write_nic_word(struct net_device *d
udelay(20);
}

-#endif /* RTL_IO_MAP */



@@ -278,9 +241,7 @@ void write_nic_word(struct net_device *d
inline void force_pci_posting(struct net_device *dev)
{
read_nic_byte(dev,EPROM_CMD);
-#ifndef CONFIG_RTL8180_IO_MAP
mb();
-#endif
}


@@ -5411,11 +5372,7 @@ static int __devinit rtl8180_pci_probe(s
//u8 *ptr;
u8 unit = 0;

-#ifdef CONFIG_RTL8180_IO_MAP
- unsigned long pio_start, pio_len, pio_flags;
-#else
unsigned long pmem_start, pmem_len, pmem_flags;
-#endif //end #ifdef RTL_IO_MAP

DMESG("Configuring chip resources");

@@ -5442,27 +5399,6 @@ static int __devinit rtl8180_pci_probe(s
priv->pdev=pdev;


-#ifdef CONFIG_RTL8180_IO_MAP
-
- pio_start = (unsigned long)pci_resource_start (pdev, 0);
- pio_len = (unsigned long)pci_resource_len (pdev, 0);
- pio_flags = (unsigned long)pci_resource_flags (pdev, 0);
-
- if (!(pio_flags & IORESOURCE_IO)) {
- DMESG("region #0 not a PIO resource, aborting");
- goto fail;
- }
-
- //DMESG("IO space @ 0x%08lx", pio_start );
- if( ! request_region( pio_start, pio_len, RTL8180_MODULE_NAME ) ){
- DMESG("request_region failed!");
- goto fail;
- }
-
- ioaddr = pio_start;
- dev->base_addr = ioaddr; // device I/O address
-
-#else

pmem_start = pci_resource_start(pdev, 1);
pmem_len = pci_resource_len(pdev, 1);
@@ -5490,7 +5426,6 @@ static int __devinit rtl8180_pci_probe(s
dev->mem_start = ioaddr; // shared mem start
dev->mem_end = ioaddr + pci_resource_len(pdev, 0); // shared mem end

-#endif //end #ifdef RTL_IO_MAP

//pci_read_config_byte(pdev, 0x05, ptr);
//pci_write_config_byte(pdev, 0x05, (*ptr) & (~0x04));
@@ -5530,20 +5465,11 @@ static int __devinit rtl8180_pci_probe(s

fail1:

-#ifdef CONFIG_RTL8180_IO_MAP
-
- if( dev->base_addr != 0 ){
-
- release_region(dev->base_addr,
- pci_resource_len(pdev, 0) );
- }
-#else
if( dev->mem_start != (unsigned long)NULL ){
iounmap( (void *)dev->mem_start );
release_mem_region( pci_resource_start(pdev, 1),
pci_resource_len(pdev, 1) );
}
-#endif //end #ifdef RTL_IO_MAP


fail:
@@ -5598,20 +5524,11 @@ static void __devexit rtl8180_pci_remove
free_tx_desc_rings(dev);
// free_beacon_desc_ring(dev,priv->txbeaconcount);

-#ifdef CONFIG_RTL8180_IO_MAP
-
- if( dev->base_addr != 0 ){
-
- release_region(dev->base_addr,
- pci_resource_len(pdev, 0) );
- }
-#else
if( dev->mem_start != (unsigned long)NULL ){
iounmap( (void *)dev->mem_start );
release_mem_region( pci_resource_start(pdev, 1),
pci_resource_len(pdev, 1) );
}
-#endif /*end #ifdef RTL_IO_MAP*/

free_ieee80211(dev);
}
Index: b/drivers/staging/rtl8187se/r8185b_init.c
===================================================================
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -131,37 +131,9 @@ PlatformIOWrite1Byte(
u8 data
)
{
-#ifndef CONFIG_RTL8180_IO_MAP
write_nic_byte(dev, offset, data);
read_nic_byte(dev, offset); // To make sure write operation is completed, 2005.11.09, by rcnjko.

-#else // Port IO
- u32 Page = (offset >> 8);
-
- switch(Page)
- {
- case 0: // Page 0
- write_nic_byte(dev, offset, data);
- break;
-
- case 1: // Page 1
- case 2: // Page 2
- case 3: // Page 3
- {
- u8 psr = read_nic_byte(dev, PSR);
-
- write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
- write_nic_byte(dev, (offset & 0xff), data);
- write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
- }
- break;
-
- default:
- // Illegal page number.
- DMESGE("PlatformIOWrite1Byte(): illegal page number: %d, offset: %#X", Page, offset);
- break;
- }
-#endif
}

void
@@ -171,38 +143,10 @@ PlatformIOWrite2Byte(
u16 data
)
{
-#ifndef CONFIG_RTL8180_IO_MAP
write_nic_word(dev, offset, data);
read_nic_word(dev, offset); // To make sure write operation is completed, 2005.11.09, by rcnjko.


-#else // Port IO
- u32 Page = (offset >> 8);
-
- switch(Page)
- {
- case 0: // Page 0
- write_nic_word(dev, offset, data);
- break;
-
- case 1: // Page 1
- case 2: // Page 2
- case 3: // Page 3
- {
- u8 psr = read_nic_byte(dev, PSR);
-
- write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
- write_nic_word(dev, (offset & 0xff), data);
- write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
- }
- break;
-
- default:
- // Illegal page number.
- DMESGE("PlatformIOWrite2Byte(): illegal page number: %d, offset: %#X", Page, offset);
- break;
- }
-#endif
}
u8 PlatformIORead1Byte(struct net_device *dev, u32 offset);

@@ -213,7 +157,6 @@ PlatformIOWrite4Byte(
u32 data
)
{
-#ifndef CONFIG_RTL8180_IO_MAP
//{by amy 080312
if (offset == PhyAddr)
{//For Base Band configuration.
@@ -257,33 +200,6 @@ if (offset == PhyAddr)
write_nic_dword(dev, offset, data);
read_nic_dword(dev, offset); // To make sure write operation is completed, 2005.11.09, by rcnjko.
}
-#else // Port IO
- u32 Page = (offset >> 8);
-
- switch(Page)
- {
- case 0: // Page 0
- write_nic_word(dev, offset, data);
- break;
-
- case 1: // Page 1
- case 2: // Page 2
- case 3: // Page 3
- {
- u8 psr = read_nic_byte(dev, PSR);
-
- write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
- write_nic_dword(dev, (offset & 0xff), data);
- write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
- }
- break;
-
- default:
- // Illegal page number.
- DMESGE("PlatformIOWrite4Byte(): illegal page number: %d, offset: %#X", Page, offset);
- break;
- }
-#endif
}

u8
@@ -294,36 +210,8 @@ PlatformIORead1Byte(
{
u8 data = 0;

-#ifndef CONFIG_RTL8180_IO_MAP
data = read_nic_byte(dev, offset);

-#else // Port IO
- u32 Page = (offset >> 8);
-
- switch(Page)
- {
- case 0: // Page 0
- data = read_nic_byte(dev, offset);
- break;
-
- case 1: // Page 1
- case 2: // Page 2
- case 3: // Page 3
- {
- u8 psr = read_nic_byte(dev, PSR);
-
- write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
- data = read_nic_byte(dev, (offset & 0xff));
- write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
- }
- break;
-
- default:
- // Illegal page number.
- DMESGE("PlatformIORead1Byte(): illegal page number: %d, offset: %#X", Page, offset);
- break;
- }
-#endif

return data;
}
@@ -336,36 +224,8 @@ PlatformIORead2Byte(
{
u16 data = 0;

-#ifndef CONFIG_RTL8180_IO_MAP
data = read_nic_word(dev, offset);

-#else // Port IO
- u32 Page = (offset >> 8);
-
- switch(Page)
- {
- case 0: // Page 0
- data = read_nic_word(dev, offset);
- break;
-
- case 1: // Page 1
- case 2: // Page 2
- case 3: // Page 3
- {
- u8 psr = read_nic_byte(dev, PSR);
-
- write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
- data = read_nic_word(dev, (offset & 0xff));
- write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
- }
- break;
-
- default:
- // Illegal page number.
- DMESGE("PlatformIORead2Byte(): illegal page number: %d, offset: %#X", Page, offset);
- break;
- }
-#endif

return data;
}
@@ -378,36 +238,8 @@ PlatformIORead4Byte(
{
u32 data = 0;

-#ifndef CONFIG_RTL8180_IO_MAP
data = read_nic_dword(dev, offset);

-#else // Port IO
- u32 Page = (offset >> 8);
-
- switch(Page)
- {
- case 0: // Page 0
- data = read_nic_dword(dev, offset);
- break;
-
- case 1: // Page 1
- case 2: // Page 2
- case 3: // Page 3
- {
- u8 psr = read_nic_byte(dev, PSR);
-
- write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
- data = read_nic_dword(dev, (offset & 0xff));
- write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
- }
- break;
-
- default:
- // Illegal page number.
- DMESGE("PlatformIORead4Byte(): illegal page number: %d, offset: %#X\n", Page, offset);
- break;
- }
-#endif

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