staging: vt6655: vt6655_probe remove PCI debug info
PATCH 1/11 staging: vt6655: vt6655_probe remove PCI debug info
Remove unnecessary debug PCI info that can be obtained by lspci.
--- drivers/staging/vt6655/device_main.c | 46 ------------------------------------ 1 file changed, 46 deletions(-)
drivers/staging/vt6655/device_main.c +0 -46
@@ -1692,52 +1692,6 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)return -ENODEV ; } -#ifdef DEBUG -dev_dbg (&pcid->dev, -"after get pci_info memaddr is %x, io addr is %x,io_size is %d\n" , - priv->memaddr, priv->ioaddr, priv->io_size); - { -int i; -u32 bar, len; -u32 address[] = { -PCI_BASE_ADDRESS_0 , -PCI_BASE_ADDRESS_1 , -PCI_BASE_ADDRESS_2 , -PCI_BASE_ADDRESS_3 , -PCI_BASE_ADDRESS_4 , -PCI_BASE_ADDRESS_5 , -0 }; -for (i =0 ; address[i]; i++) { -pci_read_config_dword (pcid, address[i], &bar); - -dev_dbg (&pcid->dev,"bar %d is %x\n" , i, bar); - -if (!bar) { -dev_dbg (&pcid->dev, -"bar %d not implemented\n" , i); -continue ; - } - -if (bar &PCI_BASE_ADDRESS_SPACE_IO ) { -/* This is IO */ - - len = bar & (PCI_BASE_ADDRESS_IO_MASK &0xffff ); - len = len & ~(len -1 ); - -dev_dbg (&pcid->dev, -"IO space: len in IO %x, BAR %d\n" , - len, i); - }else { - len = bar &0xfffffff0 ; - len = ~len +1 ; - -dev_dbg (&pcid->dev, -"len in MEM %x, BAR %d\n" , len, i); - } - } - } -#endif - priv->PortOffset =ioremap (priv->memaddr &PCI_BASE_ADDRESS_MEM_MASK , priv->io_size);if (!priv->PortOffset) {
Signature · 1 line
2.5.0
PATCH 2/11 staging: vt6655: remove get_chip_name and info message.
This prints "VIA Networking Solomon-A/B/G Wireless LAN Adapter" which has already printed once in vt6655_probe.
--- drivers/staging/vt6655/device_main.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/staging/vt6655/device_main.c +0 -12
@@ -168,16 +168,6 @@ static void device_free_rings(struct vnt_private *pDevice);/*--------------------- Export Functions --------------------------*/ -static char *get_chip_name (int chip_id) -{ -int i; - -for (i =0 ; chip_info_table[i].name !=NULL ; i++) -if (chip_info_table[i].chip_id == chip_id) -break ; -return chip_info_table[i].name; -} -static void vt6655_remove (struct pci_dev *pcid) {struct vnt_private *pDevice =pci_get_drvdata (pcid);
@@ -447,8 +437,6 @@ static void device_init_registers(struct vnt_private *pDevice)static void device_print_info (struct vnt_private *pDevice) { -dev_info (&pDevice->pcid->dev,"%s\n" ,get_chip_name (pDevice->chip_id)); -dev_info (&pDevice->pcid->dev,"MAC=%pM IO=0x%lx Mem=0x%lx IRQ=%d\n" , pDevice->abyCurrentNetAddr, (unsigned long )pDevice->ioaddr, (unsigned long )pDevice->PortOffset, pDevice->pcid->irq);
Signature · 1 line
2.5.0
PATCH 3/11 staging: vt6655: Remove typedef struct __chip_info_tbl
In reply to Malcolm PriestleyOnly two values that are assigned from this table.
DEVICE_FLAGS_TX_ALIGN and the value of io_size which is used as the size of ioremap which is 256.
Remove all variables, DEVICE_FLAGS_TX_ALIGN check, apply io_size value and chip_info_table.
--- drivers/staging/vt6655/device.h | 12 ----------- drivers/staging/vt6655/device_main.c | 40 ++++++++++-------------------------- 2 files changed, 11 insertions(+), 41 deletions(-)
drivers/staging/vt6655/device.h +0 -12
@@ -157,14 +157,6 @@#define PK_TYPE_11GB 2#define PK_TYPE_11GA 3 -typedef struct __chip_info_tbl { -CHIP_TYPE chip_id; -char *name; -int io_size; -int nTxQueue; -u32 flags; -}CHIP_INFO , *PCHIP_INFO ; - typedef enum { OWNED_BY_HOST = 0, OWNED_BY_NIC = 1
@@ -235,12 +227,9 @@ struct vnt_private {unsigned char *tx1_bufs;unsigned char *tx_beacon_bufs; -CHIP_TYPE chip_id; -void __iomem *PortOffset;u32 memaddr;u32 ioaddr; -u32 io_size;unsigned char byRevId;unsigned char byRxMode;
@@ -249,7 +238,6 @@ struct vnt_private {spinlock_t lock; -int nTxQueues;volatile int iTDUsed[TYPE_MAXTD ];struct vnt_tx_desc *apCurrTD[TYPE_MAXTD ];
drivers/staging/vt6655/device_main.c +11 -29
@@ -128,14 +128,8 @@ DEVICE_PARAM(BasebandType, "baseband type");/* * Static vars definitions */ -static CHIP_INFO chip_info_table[] = { - {VT3253 ,"VIA Networking Solomon-A/B/G Wireless LAN Adapter " , -256 ,1 ,DEVICE_FLAGS_IP_ALIGN |DEVICE_FLAGS_TX_ALIGN }, - {0 ,NULL } -}; -static const struct pci_device_id vt6655_pci_id_table[] = { - {PCI_VDEVICE (VIA ,0x3253 ), (kernel_ulong_t )chip_info_table}, + {PCI_VDEVICE (VIA ,0x3253 ) }, {0 , } };
@@ -143,7 +137,7 @@ static const struct pci_device_id vt6655_pci_id_table[] = {static int vt6655_probe (struct pci_dev *pcid,const struct pci_device_id *ent);static void vt6655_init_info (struct pci_dev *pcid, -struct vnt_private **ppDevice,PCHIP_INFO ); +struct vnt_private **ppDevice);static void device_free_info (struct vnt_private *pDevice);static bool device_get_pci_info (struct vnt_private *,struct pci_dev *pcid);static void device_print_info (struct vnt_private *pDevice);
@@ -443,15 +437,11 @@ static void device_print_info(struct vnt_private *pDevice) }static void vt6655_init_info (struct pci_dev *pcid, -struct vnt_private **ppDevice, -PCHIP_INFO pChip_info) +struct vnt_private **ppDevice) {memset (*ppDevice,0 ,sizeof (**ppDevice)); (*ppDevice)->pcid = pcid; - (*ppDevice)->chip_id = pChip_info->chip_id; - (*ppDevice)->io_size = pChip_info->io_size; - (*ppDevice)->nTxQueues = pChip_info->nTxQueue; (*ppDevice)->multicast_limit =32 ;spin_lock_init (&((*ppDevice)->lock));
@@ -695,10 +685,9 @@ static void device_init_td0_ring(struct vnt_private *pDevice) pDesc = &(pDevice->apTD0Rings[i]); pDesc->td_info =alloc_td_info (); -if (pDevice->flags &DEVICE_FLAGS_TX_ALIGN ) { - pDesc->td_info->buf = pDevice->tx0_bufs + (i)*PKT_BUF_SZ ; - pDesc->td_info->buf_dma = pDevice->tx_bufs_dma0 + (i)*PKT_BUF_SZ ; - } + pDesc->td_info->buf = pDevice->tx0_bufs + i *PKT_BUF_SZ ; + pDesc->td_info->buf_dma = pDevice->tx_bufs_dma0 + i *PKT_BUF_SZ ; + pDesc->next = &(pDevice->apTD0Rings[(i+1 ) % pDevice->sOpts.nTxDescs[0 ]]); pDesc->next_desc =cpu_to_le32 (curr +sizeof (struct vnt_tx_desc )); }
@@ -721,10 +710,9 @@ static void device_init_td1_ring(struct vnt_private *pDevice) pDesc = &(pDevice->apTD1Rings[i]); pDesc->td_info =alloc_td_info (); -if (pDevice->flags &DEVICE_FLAGS_TX_ALIGN ) { - pDesc->td_info->buf = pDevice->tx1_bufs + (i) *PKT_BUF_SZ ; - pDesc->td_info->buf_dma = pDevice->tx_bufs_dma1 + (i) *PKT_BUF_SZ ; - } + pDesc->td_info->buf = pDevice->tx1_bufs + i *PKT_BUF_SZ ; + pDesc->td_info->buf_dma = pDevice->tx_bufs_dma1 + i *PKT_BUF_SZ ; + pDesc->next = &(pDevice->apTD1Rings[(i +1 ) % pDevice->sOpts.nTxDescs[1 ]]); pDesc->next_desc =cpu_to_le32 (curr +sizeof (struct vnt_tx_desc )); }
@@ -1640,7 +1628,6 @@ static int vnt_init(struct vnt_private *priv)static int vt6655_probe (struct pci_dev *pcid,const struct pci_device_id *ent) { -PCHIP_INFO pChip_info = (PCHIP_INFO )ent->driver_data;struct vnt_private *priv;struct ieee80211_hw *hw;struct wiphy *wiphy;
@@ -1660,7 +1647,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) priv = hw->priv; -vt6655_init_info (pcid, &priv, pChip_info); +vt6655_init_info (pcid, &priv); priv->hw = hw;
@@ -1681,7 +1668,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) } priv->PortOffset =ioremap (priv->memaddr &PCI_BASE_ADDRESS_MEM_MASK , - priv->io_size); +256 );if (!priv->PortOffset) {dev_err (&pcid->dev,": Failed to IO remapping ..\n" );device_free_info (priv);
@@ -1721,11 +1708,6 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)device_get_options (priv);device_set_options (priv); -/* Mask out the options cannot be set to the chip */ - priv->sOpts.flags &= pChip_info->flags; - -/* Enable the chip specified capabilities */ - priv->flags = priv->sOpts.flags | (pChip_info->flags &0xff000000UL ); wiphy = priv->hw->wiphy;
Signature · 1 line
2.5.0
PATCH 4/11 staging: vt6655: remove unused multicast_limit.
In reply to Malcolm Priestleymulticast_limit is assigned a vale that is never used.
--- drivers/staging/vt6655/device.h | 1 - drivers/staging/vt6655/device_main.c | 1 - 2 files changed, 2 deletions(-)
drivers/staging/vt6655/device.h +0 -1
@@ -256,7 +256,6 @@ struct vnt_private {u32 rx_buf_sz;u8 rx_rate; -int multicast_limit;u32 rx_bytes;
drivers/staging/vt6655/device_main.c +0 -1
@@ -442,7 +442,6 @@ static void vt6655_init_info(struct pci_dev *pcid,memset (*ppDevice,0 ,sizeof (**ppDevice)); (*ppDevice)->pcid = pcid; - (*ppDevice)->multicast_limit =32 ;spin_lock_init (&((*ppDevice)->lock)); }
Signature · 1 line
2.5.0
PATCH 5/11 staging: vt6655: vt6655_init_info remove memset.
In reply to Malcolm Priestleyvnt_private is allocated with kzalloc so is already zero.
--- drivers/staging/vt6655/device_main.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/vt6655/device_main.c +0 -2
@@ -439,8 +439,6 @@ static void device_print_info(struct vnt_private *pDevice)static void vt6655_init_info (struct pci_dev *pcid,struct vnt_private **ppDevice) { -memset (*ppDevice,0 ,sizeof (**ppDevice)); - (*ppDevice)->pcid = pcid;spin_lock_init (&((*ppDevice)->lock));
Signature · 1 line
2.5.0
PATCH 6/11 staging: vt6655: remove and move vt6655_init_info
In reply to Malcolm Priestleymove code to vt6655_probe.
--- drivers/staging/vt6655/device_main.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/staging/vt6655/device_main.c +2 -12
@@ -28,7 +28,6 @@* * vt6655_probe - module initial (insmod) driver entry * vt6655_remove - module remove entry -* vt6655_init_info - device structure resource allocation function * device_free_info - device structure resource free function * device_get_pci_info - get allocated pci io/mem resource * device_print_info - print out resource
@@ -136,8 +135,6 @@ static const struct pci_device_id vt6655_pci_id_table[] = {/*--------------------- Static Functions --------------------------*/ static int vt6655_probe (struct pci_dev *pcid,const struct pci_device_id *ent); -static void vt6655_init_info (struct pci_dev *pcid, -struct vnt_private **ppDevice);static void device_free_info (struct vnt_private *pDevice);static bool device_get_pci_info (struct vnt_private *,struct pci_dev *pcid);static void device_print_info (struct vnt_private *pDevice);
@@ -436,14 +433,6 @@ static void device_print_info(struct vnt_private *pDevice) (unsigned long)pDevice->PortOffset, pDevice->pcid->irq); } -static void vt6655_init_info (struct pci_dev *pcid, -struct vnt_private **ppDevice) -{ - (*ppDevice)->pcid = pcid; - -spin_lock_init (&((*ppDevice)->lock)); -} -static bool device_get_pci_info (struct vnt_private *pDevice,struct pci_dev *pcid) {
@@ -1643,8 +1632,9 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent) } priv = hw->priv; + priv->pcid = pcid; -vt6655_init_info (pcid, &priv); +spin_lock_init (&priv->lock); priv->hw = hw;
Signature · 1 line
2.5.0
PATCH 7/11 staging: vt6655: device_get_pci_info remove unused pci_read_config_*
In reply to Malcolm PriestleyThese values are read from pci but never used.
Removing variables byRevId, SubSystemID, SubVendorID and pci_cmd.
--- drivers/staging/vt6655/device.h | 3 --- drivers/staging/vt6655/device_main.c | 9 --------- 2 files changed, 12 deletions(-)
drivers/staging/vt6655/device.h +0 -3
@@ -231,10 +231,7 @@ struct vnt_private {u32 memaddr;u32 ioaddr; -unsigned char byRevId;unsigned char byRxMode; -unsigned short SubSystemID; -unsigned short SubVendorID;spinlock_t lock;
drivers/staging/vt6655/device_main.c +0 -9
@@ -230,9 +230,6 @@ static void device_init_registers(struct vnt_private *pDevice) pDevice->byTopOFDMBasicRate =RATE_24M ; pDevice->byTopCCKBasicRate =RATE_1M ; -/* Target to IF pin while programming to RF chip. */ - pDevice->byRevId =0 ; -/* init MAC */ MACvInitialize (pDevice->PortOffset);
@@ -436,15 +433,9 @@ static void device_print_info(struct vnt_private *pDevice)static bool device_get_pci_info (struct vnt_private *pDevice,struct pci_dev *pcid) { -u16 pci_cmd;u8 b;unsigned int cis_addr; -pci_read_config_byte (pcid,PCI_REVISION_ID , &pDevice->byRevId); -pci_read_config_word (pcid,PCI_SUBSYSTEM_ID , &pDevice->SubSystemID); -pci_read_config_word (pcid,PCI_SUBSYSTEM_VENDOR_ID , &pDevice->SubVendorID); -pci_read_config_word (pcid,PCI_COMMAND , (u16 *)&(pci_cmd)); -pci_set_master (pcid); pDevice->memaddr =pci_resource_start (pcid,0 );
Signature · 1 line
2.5.0
PATCH 8/11 staging: vt6655: device_get_pci_info remove variable cis_addr.
In reply to Malcolm Priestleycis_addr is never used remove its call to pci_resource_start.
--- drivers/staging/vt6655/device_main.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/vt6655/device_main.c +0 -3
@@ -434,15 +434,12 @@ static bool device_get_pci_info(struct vnt_private *pDevice, struct pci_dev *pcid) {u8 b; -unsigned int cis_addr;pci_set_master (pcid); pDevice->memaddr =pci_resource_start (pcid,0 ); pDevice->ioaddr =pci_resource_start (pcid,1 ); - cis_addr =pci_resource_start (pcid,2 ); - pDevice->pcid = pcid;pci_read_config_byte (pcid,PCI_COMMAND , &b);
Signature · 1 line
2.5.0
PATCH 9/11 staging: vt6655: device_get_pci_info remove call to set master.
In reply to Malcolm Priestleya call to PCI_COMMAND is used to set master.
However, a call to pci_set_master earlier in function which does the same thing.
So remove the calls and variable b.
--- drivers/staging/vt6655/device_main.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/vt6655/device_main.c +0 -5
@@ -433,8 +433,6 @@ static void device_print_info(struct vnt_private *pDevice)static bool device_get_pci_info (struct vnt_private *pDevice,struct pci_dev *pcid) { -u8 b; -pci_set_master (pcid); pDevice->memaddr =pci_resource_start (pcid,0 );
@@ -442,9 +440,6 @@ static bool device_get_pci_info(struct vnt_private *pDevice, pDevice->pcid = pcid; -pci_read_config_byte (pcid,PCI_COMMAND , &b); -pci_write_config_byte (pcid,PCI_COMMAND , (b|PCI_COMMAND_MASTER )); -return true; }
Signature · 1 line
2.5.0
PATCH 10/11 staging: vt6655: device_get_pci_info pcid already assigned.
In reply to Malcolm Priestleypcid has already been assigned earlier in vt6655_probe.
--- drivers/staging/vt6655/device_main.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/vt6655/device_main.c +0 -2
@@ -438,8 +438,6 @@ static bool device_get_pci_info(struct vnt_private *pDevice, pDevice->memaddr =pci_resource_start (pcid,0 ); pDevice->ioaddr =pci_resource_start (pcid,1 ); - pDevice->pcid = pcid; -return true; }
Signature · 1 line
2.5.0
PATCH 11/11 staging: vt6655: Move code in device_get_pci_info
In reply to Malcolm PriestleyFunction always returns true and now only a few lines move to vt6655_probe.
--- drivers/staging/vt6655/device_main.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-)
drivers/staging/vt6655/device_main.c +3 -18
@@ -29,7 +29,6 @@* vt6655_probe - module initial (insmod) driver entry * vt6655_remove - module remove entry * device_free_info - device structure resource free function -* device_get_pci_info - get allocated pci io/mem resource * device_print_info - print out resource * device_rx_srv - rx service function * device_alloc_rx_buf - rx buffer pre-allocated function
@@ -136,7 +135,6 @@ static const struct pci_device_id vt6655_pci_id_table[] = {static int vt6655_probe (struct pci_dev *pcid,const struct pci_device_id *ent);static void device_free_info (struct vnt_private *pDevice); -static bool device_get_pci_info (struct vnt_private *,struct pci_dev *pcid);static void device_print_info (struct vnt_private *pDevice);static void device_init_rd0_ring (struct vnt_private *pDevice);
@@ -430,17 +428,6 @@ static void device_print_info(struct vnt_private *pDevice) (unsigned long)pDevice->PortOffset, pDevice->pcid->irq); } -static bool device_get_pci_info (struct vnt_private *pDevice, -struct pci_dev *pcid) -{ -pci_set_master (pcid); - - pDevice->memaddr =pci_resource_start (pcid,0 ); - pDevice->ioaddr =pci_resource_start (pcid,1 ); - -return true; -} -static void device_free_info (struct vnt_private *pDevice) {if (!pDevice)
@@ -1629,12 +1616,10 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)dev_dbg (&pcid->dev,"Before get pci_info memaddr is %x\n" , priv->memaddr); -if (!device_get_pci_info (priv, pcid)) { -dev_err (&pcid->dev,": Failed to find PCI device.\n" ); -device_free_info (priv); -return -ENODEV ; - } +pci_set_master (pcid); + priv->memaddr =pci_resource_start (pcid,0 ); + priv->ioaddr =pci_resource_start (pcid,1 ); priv->PortOffset =ioremap (priv->memaddr &PCI_BASE_ADDRESS_MEM_MASK ,256 );if (!priv->PortOffset) {
Signature · 1 line
2.5.0