staging: vt6655: remove multiple instances of driver loading.
PATCH 1/3 staging: vt6655: remove multiple instances of driver loading.
The driver can only load once from the instance provided by pci_dev.
struct vnt_private next, prev and pDevice_Infos are removed.
Signed-off-by Malcolm Priestley <[email protected]>
--- drivers/staging/vt6655/device.h | 3 --- drivers/staging/vt6655/device_main.c | 31 +++---------------------------- 2 files changed, 3 insertions(+), 31 deletions(-)
drivers/staging/vt6655/device.h +0 -3
@@ -331,9 +331,6 @@ typedef struct __device_opt { }OPTIONS , *POPTIONS ;struct vnt_private { -struct vnt_private *next; -struct vnt_private *prev; -struct pci_dev *pcid;#ifdef CONFIG_PM
drivers/staging/vt6655/device_main.c +3 -28
@@ -247,7 +247,6 @@ DEVICE_PARAM(bDiversityANTEnable, "ANT diversity mode");// static int device_nics =0 ; -static struct vnt_private *pDevice_Infos =NULL ;static struct net_device *root_device_dev =NULL ;static CHIP_INFO chip_info_table[] = {
@@ -979,19 +978,8 @@ static void vt6655_init_info(struct pci_dev *pcid, struct vnt_private **ppDevice, PCHIP_INFO pChip_info) { -struct vnt_private *p; -memset (*ppDevice,0 ,sizeof (**ppDevice)); -if (pDevice_Infos ==NULL ) { - pDevice_Infos = *ppDevice; - }else { -for (p = pDevice_Infos; p->next !=NULL ; p = p->next) -do {}while (0 ); - p->next = *ppDevice; - (*ppDevice)->prev = p; - } - (*ppDevice)->pcid = pcid; (*ppDevice)->chip_id = pChip_info->chip_id; (*ppDevice)->io_size = pChip_info->io_size;
@@ -1030,9 +1018,11 @@ static bool device_get_pci_info(struct vnt_private *pDevice,static void device_free_info (struct vnt_private *pDevice) { -struct vnt_private *ptr;struct net_device *dev = pDevice->dev; +if (!pDevice) +return ; +ASSERT (pDevice);//2008-0714-01<Add>by chester device_release_WPADEV (pDevice);
@@ -1042,21 +1032,6 @@ static void device_free_info(struct vnt_private *pDevice)if (wpa_set_wpadev (pDevice,0 ) !=0 )pr_err ("unregister wpadev fail?\n" ); -if (pDevice_Infos ==NULL ) -return ; - -for (ptr = pDevice_Infos; ptr && (ptr != pDevice); ptr = ptr->next) -do {}while (0 ); - -if (ptr == pDevice) { -if (ptr == pDevice_Infos) - pDevice_Infos = ptr->next; -else - ptr->prev->next = ptr->next; - }else { -pr_err ("info struct not found\n" ); -return ; - }#ifdef HOSTAP if (dev)vt6655_hostap_set_hostapd (pDevice,0 ,0 );
Signature · 1 line
1.9.1
PATCH 2/3 staging: vt6655: remove multiple instances of netdevice.
netdevice can only be created once.
Signed-off-by Malcolm Priestley <[email protected]>
--- drivers/staging/vt6655/device.h | 1 - drivers/staging/vt6655/device_main.c | 3 --- 2 files changed, 4 deletions(-)
drivers/staging/vt6655/device.h +0 -1
@@ -339,7 +339,6 @@ struct vnt_private {// netdev struct net_device *dev; -struct net_device *next_module;struct net_device_stats stats;//dma addr, rx/tx pool
drivers/staging/vt6655/device_main.c +0 -3
@@ -247,7 +247,6 @@ DEVICE_PARAM(bDiversityANTEnable, "ANT diversity mode");// static int device_nics =0 ; -static struct net_device *root_device_dev =NULL ;static CHIP_INFO chip_info_table[] = { {VT3253 ,"VIA Networking Solomon-A/B/G Wireless LAN Adapter " ,
@@ -851,8 +850,6 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)vt6655_init_info (pcid, &pDevice, pChip_info); pDevice->dev = dev; - pDevice->next_module = root_device_dev; - root_device_dev = dev;if (pci_enable_device (pcid)) {device_free_info (pDevice);
Signature · 1 line
1.9.1
PATCH 3/3 staging: vt6655: dead code remove device_nics variable
In reply to Malcolm PriestleyThe module can not load more than once.
Remove device_nics, MAX_UINTS and OPTION_DEFAULT
Remove dead index variable from device_get_options
Signed-off-by Malcolm Priestley <[email protected]>
--- drivers/staging/vt6655/device_cfg.h | 3 --- drivers/staging/vt6655/device_main.c | 12 ++---------- 2 files changed, 2 insertions(+), 13 deletions(-)
drivers/staging/vt6655/device_cfg.h +0 -3
@@ -67,9 +67,6 @@ struct _version {#define PKT_BUF_SZ 2390 -#define MAX_UINTS 8 -#define OPTION_DEFAULT { [0 ... MAX_UINTS-1] = -1} -typedef enum _chip_type {VT3253 =1 }CHIP_TYPE , *PCHIP_TYPE ;
drivers/staging/vt6655/device_main.c +2 -10
@@ -245,9 +245,6 @@ DEVICE_PARAM(bDiversityANTEnable, "ANT diversity mode");// // Static vars definitions // - -static int device_nics =0 ; -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 },
@@ -336,7 +333,7 @@ static void vt6655_remove(struct pci_dev *pcid) }static void device_get_options (struct vnt_private *pDevice, -int index,char *devname) +char *devname) {POPTIONS pOpts = &(pDevice->sOpts);
@@ -825,11 +822,6 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)struct vnt_private *pDevice;int rc; -if (device_nics++ >=MAX_UINTS ) { -pr_notice (DEVICE_NAME ": already found %d NICs\n" , device_nics); -return -ENODEV ; - } - dev =alloc_etherdev (sizeof (*pDevice)); pDevice =netdev_priv (dev);
@@ -934,7 +926,7 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)MACvInitialize (pDevice->PortOffset);MACvReadEtherAddress (pDevice->PortOffset, dev->dev_addr); -device_get_options (pDevice, device_nics-1 , dev->name); +device_get_options (pDevice, dev->name);device_set_options (pDevice);//Mask out the options cannot be set to the chip pDevice->sOpts.flags &= pChip_info->flags;
Signature · 1 line
1.9.1