rt2x00: Allocate eeprom memory
Subsystems (3)
PATCH 14/32 rt2x00: Allocate eeprom memory
From: Ivo van Doorn <[email protected]>
Make the EEPROM array in rt2x00_pci and rt2x00_usb a pointer, and allocate the memory seperately. This is needed for make the structures more generic for all rt2x00 pci or usb modules.
Signed-off-by Ivo van Doorn <[email protected]>
drivers/net/wireless/d80211/rt2x00/rt2400pci.c +7 -2
@@ -1831,7 +1831,6 @@ rt2400pci_init_eeprom(struct rt2x00_pciu32 reg;u16 value;u16 eeprom; -int counter;/* * 1 - Detect EEPROM width.
@@ -1886,8 +1885,12 @@ rt2400pci_init_eeprom(struct rt2x00_pci/* * 7 - Read BBP data from EEPROM and store in private structure. */ + rt2x00pci->eeprom =kzalloc (EEPROM_BBP_SIZE *sizeof (u16),GFP_KERNEL ); +if (!rt2x00pci->eeprom) +return -ENOMEM ; +rt2x00_eeprom_multiread (rt2x00pci,EEPROM_BBP_START , - &rt2x00pci->eeprom,EEPROM_BBP_SIZE *sizeof (u16)); + rt2x00pci->eeprom,EEPROM_BBP_SIZE *sizeof (u16));return 0 ; }
@@ -2197,6 +2200,8 @@ rt2400pci_uninitialize(struct net_devicedel_timer_sync (&rt2x00pci->poll_timer);#endif /* CONFIG_RT2400PCI_BUTTON */ +kfree (rt2x00pci->eeprom); +if (likely (rt2x00pci->csr_addr)) {iounmap (rt2x00pci->csr_addr); rt2x00pci->csr_addr =NULL ;
drivers/net/wireless/d80211/rt2x00/rt2400pci.h +1 -1
@@ -945,7 +945,7 @@ struct rt2x00_pci{/* * EEPROM BBP data. */ -u16 eeprom[EEPROM_BBP_SIZE ]; +u16 *eeprom;/* * Low level statistics which will have
drivers/net/wireless/d80211/rt2x00/rt2500pci.c +7 -2
@@ -1939,7 +1939,6 @@ rt2500pci_init_eeprom(struct rt2x00_pciu32 reg;u16 value;u16 eeprom; -int counter;/* * 1 - Detect EEPROM width.
@@ -1998,8 +1997,12 @@ rt2500pci_init_eeprom(struct rt2x00_pci/* * 7 - Read BBP data from EEPROM and store in private structure. */ + rt2x00pci->eeprom =kzalloc (EEPROM_BBP_SIZE *sizeof (u16),GFP_KERNEL ); +if (!rt2x00pci->eeprom) +return -ENOMEM ; +rt2x00_eeprom_multiread (rt2x00pci,EEPROM_BBP_START , - &rt2x00pci->eeprom,EEPROM_BBP_SIZE *sizeof (u16)); + rt2x00pci->eeprom,EEPROM_BBP_SIZE *sizeof (u16));return 0 ; }
@@ -2495,6 +2498,8 @@ rt2500pci_uninitialize(struct net_devicedel_timer_sync (&rt2x00pci->poll_timer);#endif /* CONFIG_RT2500PCI_BUTTON */ +kfree (rt2x00pci->eeprom); +if (likely (rt2x00pci->csr_addr)) {iounmap (rt2x00pci->csr_addr); rt2x00pci->csr_addr =NULL ;
drivers/net/wireless/d80211/rt2x00/rt2500pci.h +1 -1
@@ -1215,7 +1215,7 @@ struct rt2x00_pci{/* * EEPROM BBP data. */ -u16 eeprom[EEPROM_BBP_SIZE ]; +u16 *eeprom;/* * Low level statistics which will have
drivers/net/wireless/d80211/rt2x00/rt2500usb.c +8 -3
@@ -1657,9 +1657,12 @@ rt2500usb_init_eeprom(struct rt2x00_usb/* * 5 - Read BBP data from EEPROM and store in private structure. */ -memset (&rt2x00usb->eeprom,0x00 ,sizeof (rt2x00usb->eeprom)); + rt2x00usb->eeprom =kzalloc (EEPROM_BBP_SIZE *sizeof (u16),GFP_KERNEL ); +if (!rt2x00usb->eeprom) +return -ENOMEM ; +rt2x00_eeprom_multiread (rt2x00usb,EEPROM_BBP_START , - &rt2x00usb->eeprom[0 ],EEPROM_BBP_SIZE ); + rt2x00usb->eeprom,EEPROM_BBP_SIZE *sizeof (u16));return 0 ; }
@@ -2116,6 +2119,8 @@ rt2500usb_uninitialize(struct net_device {struct rt2x00_usb *rt2x00usb =ieee80211_dev_hw_data (net_dev); +kfree (rt2x00usb->eeprom); +if (rt2x00usb->scan) { rt2x00usb->scan->cancelled =1 ;complete_all (&rt2x00usb->scan->completion);
@@ -2129,7 +2134,7 @@ rt2500usb_uninitialize(struct net_devicekfree (rt2x00usb->hw.modes); rt2x00usb->hw.modes =NULL ; - } +}/* * USB driver handlers.
drivers/net/wireless/d80211/rt2x00/rt2500usb.h +1 -1
@@ -727,7 +727,7 @@ struct rt2x00_usb{/* * EEPROM BBP data. */ -u16 eeprom[EEPROM_BBP_SIZE ]; +u16 *eeprom;/* * Low level statistics which will have