Commit 3aa2303a20e3aac5a8445777b665a433d60c2786

Authored by Ondrej Zary
Committed by Greg Kroah-Hartman
1 parent 8d915d8c9b

staging: ft1000: unify struct ft1000_info between USB and PCMCIA drivers

Unify struct ft1000_info between ft1000-usb and ft1000-pcmcia and move it to
common ft1000.h.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Tested-by: Marek Belisko <marek.belisko@open-nandra.com>
Review-by: Marek Belisko <marek.belisko@open-nandra.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 10 changed files with 238 additions and 266 deletions Side-by-side Diff

drivers/staging/ft1000/ft1000-pcmcia/ft1000.h
... ... @@ -31,41 +31,10 @@
31 31 #define SUCCESS 0x00
32 32 #define FAILURE 0x01
33 33  
34   -struct ft1000_info {
35   - struct net_device_stats stats;
36   - u16 DrvErrNum;
37   - u16 AsicID;
  34 +struct ft1000_pcmcia {
38 35 int PktIntfErr;
39   - int CardReady;
40   - int registered;
41   - int mediastate;
42 36 u16 packetseqnum;
43   - u8 squeseqnum; /* sequence number on slow queue */
44   - spinlock_t dpram_lock;
45   - u16 fifo_cnt;
46   - u8 DspVer[DSPVERSZ]; /* DSP version number */
47   - u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */
48   - u8 Sku[SKUSZ]; /* SKU */
49   - u8 eui64[EUISZ]; /* EUI64 */
50   - time_t ConTm; /* Connection Time */
51   - u16 LedStat;
52   - u16 ConStat;
53   - u16 ProgConStat;
54   - u8 ProductMode[MODESZ];
55   - u8 RfCalVer[CALVERSZ];
56   - u8 RfCalDate[CALDATESZ];
57   - u16 DSP_TIME[4];
58   - struct list_head prov_list;
59   - u16 DSPInfoBlklen;
60   - int (*ft1000_reset)(void *);
61 37 void *link;
62   - u16 DSPInfoBlk[MAX_DSP_SESS_REC];
63   - union {
64   - u16 Rec[MAX_DSP_SESS_REC];
65   - u32 MagRec[MAX_DSP_SESS_REC/2];
66   - } DSPSess;
67   - struct proc_dir_entry *proc_ft1000;
68   - char netdevname[IFNAMSIZ];
69 38 };
70 39  
71 40 struct pcmcia_device;
drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c
... ... @@ -328,11 +328,12 @@
328 328 static void ft1000_reset_asic(struct net_device *dev)
329 329 {
330 330 struct ft1000_info *info = netdev_priv(dev);
  331 + struct ft1000_pcmcia *pcmcia = info->priv;
331 332 u16 tempword;
332 333  
333 334 DEBUG(1, "ft1000_hw:ft1000_reset_asic called\n");
334 335  
335   - (*info->ft1000_reset) (info->link);
  336 + (*info->ft1000_reset) (pcmcia->link);
336 337  
337 338 // Let's use the register provided by the Magnemite ASIC to reset the
338 339 // ASIC and DSP.
339 340  
... ... @@ -1397,12 +1398,13 @@
1397 1398 static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum)
1398 1399 {
1399 1400 struct ft1000_info *info = netdev_priv(dev);
  1401 + struct ft1000_pcmcia *pcmcia = info->priv;
1400 1402 u16 i;
1401 1403 u32 templong;
1402 1404 u16 tempword;
1403 1405  
1404 1406 DEBUG(1, "ft1000:ft1000_hw:ft1000_flush_fifo called\n");
1405   - if (info->PktIntfErr > MAX_PH_ERR) {
  1407 + if (pcmcia->PktIntfErr > MAX_PH_ERR) {
1406 1408 if (info->AsicID == ELECTRABUZZ_ID) {
1407 1409 info->DSP_TIME[0] =
1408 1410 ft1000_read_dpram(dev, FT1000_DSP_TIMER0);
... ... @@ -1491,7 +1493,7 @@
1491 1493 FIFO_FLUSH_BADCNT;
1492 1494 } else {
1493 1495 // Let's assume that we really flush the FIFO
1494   - info->PktIntfErr++;
  1496 + pcmcia->PktIntfErr++;
1495 1497 return;
1496 1498 }
1497 1499 } else {
... ... @@ -1522,7 +1524,7 @@
1522 1524 DEBUG(0, "FT1000_REG_MAG_DFSR = 0x%x\n", tempword);
1523 1525 }
1524 1526 if (DrvErrNum) {
1525   - info->PktIntfErr++;
  1527 + pcmcia->PktIntfErr++;
1526 1528 }
1527 1529 }
1528 1530 }
... ... @@ -1731,6 +1733,7 @@
1731 1733 static int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len)
1732 1734 {
1733 1735 struct ft1000_info *info = netdev_priv(dev);
  1736 + struct ft1000_pcmcia *pcmcia = info->priv;
1734 1737 union {
1735 1738 struct pseudo_hdr blk;
1736 1739 u16 buff[sizeof(struct pseudo_hdr) >> 1];
... ... @@ -1780,7 +1783,7 @@
1780 1783 pseudo.blk.control = 0;
1781 1784 pseudo.blk.rsvd1 = 0;
1782 1785 pseudo.blk.seq_num = 0;
1783   - pseudo.blk.rsvd2 = info->packetseqnum++;
  1786 + pseudo.blk.rsvd2 = pcmcia->packetseqnum++;
1784 1787 pseudo.blk.qos_class = 0;
1785 1788 /* Calculate pseudo header checksum */
1786 1789 pseudo.blk.checksum = pseudo.buff[0];
... ... @@ -2058,6 +2061,8 @@
2058 2061 kfree(ptr);
2059 2062 }
2060 2063  
  2064 + kfree(info->priv);
  2065 +
2061 2066 if (info->registered) {
2062 2067 unregister_netdev(dev);
2063 2068 info->registered = 0;
... ... @@ -2100,6 +2105,7 @@
2100 2105 void *ft1000_reset)
2101 2106 {
2102 2107 struct ft1000_info *info;
  2108 + struct ft1000_pcmcia *pcmcia;
2103 2109 struct net_device *dev;
2104 2110  
2105 2111 static const struct net_device_ops ft1000ops = // Slavius 21.10.2009 due to kernel changes
2106 2112  
... ... @@ -2141,10 +2147,13 @@
2141 2147  
2142 2148 memset(&info->stats, 0, sizeof(struct net_device_stats));
2143 2149  
  2150 + info->priv = kzalloc(sizeof(struct ft1000_pcmcia), GFP_KERNEL);
  2151 + pcmcia = info->priv;
  2152 + pcmcia->link = link;
  2153 +
2144 2154 spin_lock_init(&info->dpram_lock);
2145 2155 info->DrvErrNum = 0;
2146 2156 info->registered = 1;
2147   - info->link = link;
2148 2157 info->ft1000_reset = ft1000_reset;
2149 2158 info->mediastate = 0;
2150 2159 info->fifo_cnt = 0;
drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c
... ... @@ -175,8 +175,8 @@
175 175  
176 176 switch (event) {
177 177 case NETDEV_CHANGENAME:
178   - remove_proc_entry(info->netdevname, info->proc_ft1000);
179   - create_proc_read_entry(dev->name, 0644, info->proc_ft1000,
  178 + remove_proc_entry(info->netdevname, info->ft1000_proc_dir);
  179 + create_proc_read_entry(dev->name, 0644, info->ft1000_proc_dir,
180 180 ft1000ReadProc, dev);
181 181 snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name);
182 182 break;
... ... @@ -194,8 +194,8 @@
194 194  
195 195 info = netdev_priv(dev);
196 196  
197   - info->proc_ft1000 = proc_mkdir(FT1000_PROC, init_net.proc_net);
198   - create_proc_read_entry(dev->name, 0644, info->proc_ft1000,
  197 + info->ft1000_proc_dir = proc_mkdir(FT1000_PROC, init_net.proc_net);
  198 + create_proc_read_entry(dev->name, 0644, info->ft1000_proc_dir,
199 199 ft1000ReadProc, dev);
200 200 snprintf(info->netdevname, IFNAMSIZ, "%s", dev->name);
201 201 register_netdevice_notifier(&ft1000_netdev_notifier);
... ... @@ -207,7 +207,7 @@
207 207  
208 208 info = netdev_priv(dev);
209 209  
210   - remove_proc_entry(dev->name, info->proc_ft1000);
  210 + remove_proc_entry(dev->name, info->ft1000_proc_dir);
211 211 remove_proc_entry(FT1000_PROC, init_net.proc_net);
212 212 unregister_netdevice_notifier(&ft1000_netdev_notifier);
213 213 }
drivers/staging/ft1000/ft1000-usb/ft1000_debug.c
... ... @@ -139,27 +139,26 @@
139 139 //---------------------------------------------------------------------------
140 140 int ft1000_create_dev(struct ft1000_device *dev)
141 141 {
142   - struct ft1000_info *info = netdev_priv(dev->net);
143 142 int result;
144 143 int i;
145 144 struct dentry *dir, *file;
146 145 struct ft1000_debug_dirs *tmp;
147 146  
148 147 // make a new device name
149   - sprintf(info->DeviceName, "%s%d", "FT1000_", info->CardNumber);
  148 + sprintf(dev->DeviceName, "%s%d", "FT1000_", dev->CardNumber);
150 149  
151 150 DEBUG("%s: number of instance = %d\n", __func__, ft1000_flarion_cnt);
152   - DEBUG("DeviceCreated = %x\n", info->DeviceCreated);
  151 + DEBUG("DeviceCreated = %x\n", dev->DeviceCreated);
153 152  
154   - if (info->DeviceCreated)
  153 + if (dev->DeviceCreated)
155 154 {
156   - DEBUG("%s: \"%s\" already registered\n", __func__, info->DeviceName);
  155 + DEBUG("%s: \"%s\" already registered\n", __func__, dev->DeviceName);
157 156 return -EIO;
158 157 }
159 158  
160 159  
161 160 // register the device
162   - DEBUG("%s: \"%s\" debugfs device registration\n", __func__, info->DeviceName);
  161 + DEBUG("%s: \"%s\" debugfs device registration\n", __func__, dev->DeviceName);
163 162  
164 163 tmp = kmalloc(sizeof(struct ft1000_debug_dirs), GFP_KERNEL);
165 164 if (tmp == NULL) {
... ... @@ -167,7 +166,7 @@
167 166 goto fail;
168 167 }
169 168  
170   - dir = debugfs_create_dir(info->DeviceName, NULL);
  169 + dir = debugfs_create_dir(dev->DeviceName, NULL);
171 170 if (IS_ERR(dir)) {
172 171 result = PTR_ERR(dir);
173 172 goto debug_dir_fail;
174 173  
175 174  
176 175  
177 176  
... ... @@ -182,27 +181,27 @@
182 181  
183 182 tmp->dent = dir;
184 183 tmp->file = file;
185   - tmp->int_number = info->CardNumber;
186   - list_add(&(tmp->list), &(info->nodes.list));
  184 + tmp->int_number = dev->CardNumber;
  185 + list_add(&(tmp->list), &(dev->nodes.list));
187 186  
188   - DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, info->DeviceName);
  187 + DEBUG("%s: registered debugfs directory \"%s\"\n", __func__, dev->DeviceName);
189 188  
190 189 // initialize application information
191   - info->appcnt = 0;
  190 + dev->appcnt = 0;
192 191 for (i=0; i<MAX_NUM_APP; i++) {
193   - info->app_info[i].nTxMsg = 0;
194   - info->app_info[i].nRxMsg = 0;
195   - info->app_info[i].nTxMsgReject = 0;
196   - info->app_info[i].nRxMsgMiss = 0;
197   - info->app_info[i].fileobject = NULL;
198   - info->app_info[i].app_id = i+1;
199   - info->app_info[i].DspBCMsgFlag = 0;
200   - info->app_info[i].NumOfMsg = 0;
201   - init_waitqueue_head(&info->app_info[i].wait_dpram_msg);
202   - INIT_LIST_HEAD (&info->app_info[i].app_sqlist);
  192 + dev->app_info[i].nTxMsg = 0;
  193 + dev->app_info[i].nRxMsg = 0;
  194 + dev->app_info[i].nTxMsgReject = 0;
  195 + dev->app_info[i].nRxMsgMiss = 0;
  196 + dev->app_info[i].fileobject = NULL;
  197 + dev->app_info[i].app_id = i+1;
  198 + dev->app_info[i].DspBCMsgFlag = 0;
  199 + dev->app_info[i].NumOfMsg = 0;
  200 + init_waitqueue_head(&dev->app_info[i].wait_dpram_msg);
  201 + INIT_LIST_HEAD (&dev->app_info[i].app_sqlist);
203 202 }
204 203  
205   - info->DeviceCreated = TRUE;
  204 + dev->DeviceCreated = TRUE;
206 205 ft1000_flarion_cnt++;
207 206  
208 207 return 0;
209 208  
... ... @@ -225,9 +224,10 @@
225 224 // Notes: Only called by cleanup_module().
226 225 //
227 226 //---------------------------------------------------------------------------
228   -void ft1000_destroy_dev(struct net_device *dev)
  227 +void ft1000_destroy_dev(struct net_device *netdev)
229 228 {
230   - struct ft1000_info *info = netdev_priv(dev);
  229 + struct ft1000_info *info = netdev_priv(netdev);
  230 + struct ft1000_device *dev = info->priv;
231 231 int i;
232 232 struct dpram_blk *pdpram_blk;
233 233 struct dpram_blk *ptr;
234 234  
235 235  
... ... @@ -238,12 +238,12 @@
238 238  
239 239  
240 240  
241   - if (info->DeviceCreated)
  241 + if (dev->DeviceCreated)
242 242 {
243 243 ft1000_flarion_cnt--;
244   - list_for_each_safe(pos, q, &info->nodes.list) {
  244 + list_for_each_safe(pos, q, &dev->nodes.list) {
245 245 dir = list_entry(pos, struct ft1000_debug_dirs, list);
246   - if (dir->int_number == info->CardNumber) {
  246 + if (dir->int_number == dev->CardNumber) {
247 247 debugfs_remove(dir->file);
248 248 debugfs_remove(dir->dent);
249 249 list_del(pos);
250 250  
251 251  
... ... @@ -251,17 +251,17 @@
251 251 }
252 252 }
253 253 DEBUG("%s: unregistered device \"%s\"\n", __func__,
254   - info->DeviceName);
  254 + dev->DeviceName);
255 255  
256 256 // Make sure we free any memory reserve for slow Queue
257 257 for (i=0; i<MAX_NUM_APP; i++) {
258   - while (list_empty(&info->app_info[i].app_sqlist) == 0) {
259   - pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, struct dpram_blk, list);
  258 + while (list_empty(&dev->app_info[i].app_sqlist) == 0) {
  259 + pdpram_blk = list_entry(dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
260 260 list_del(&pdpram_blk->list);
261 261 ft1000_free_buffer(pdpram_blk, &freercvpool);
262 262  
263 263 }
264   - wake_up_interruptible(&info->app_info[i].wait_dpram_msg);
  264 + wake_up_interruptible(&dev->app_info[i].wait_dpram_msg);
265 265 }
266 266  
267 267 // Remove buffer allocated for receive command data
... ... @@ -273,7 +273,7 @@
273 273 kfree(ptr);
274 274 }
275 275 }
276   - info->DeviceCreated = FALSE;
  276 + dev->DeviceCreated = FALSE;
277 277 }
278 278  
279 279  
280 280  
281 281  
... ... @@ -301,17 +301,17 @@
301 301  
302 302 info = file->private_data = netdev_priv(dev->net);
303 303  
304   - DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), info->appcnt );
  304 + DEBUG("f_owner = %p number of application = %d\n", (&file->f_owner), dev->appcnt );
305 305  
306 306 // Check if maximum number of application exceeded
307   - if (info->appcnt > MAX_NUM_APP) {
  307 + if (dev->appcnt > MAX_NUM_APP) {
308 308 DEBUG("Maximum number of application exceeded\n");
309 309 return -EACCES;
310 310 }
311 311  
312 312 // Search for available application info block
313 313 for (i=0; i<MAX_NUM_APP; i++) {
314   - if ( (info->app_info[i].fileobject == NULL) ) {
  314 + if ( (dev->app_info[i].fileobject == NULL) ) {
315 315 break;
316 316 }
317 317 }
... ... @@ -322,12 +322,12 @@
322 322 return -EACCES;
323 323 }
324 324  
325   - info->appcnt++;
326   - info->app_info[i].fileobject = &file->f_owner;
327   - info->app_info[i].nTxMsg = 0;
328   - info->app_info[i].nRxMsg = 0;
329   - info->app_info[i].nTxMsgReject = 0;
330   - info->app_info[i].nRxMsgMiss = 0;
  325 + dev->appcnt++;
  326 + dev->app_info[i].fileobject = &file->f_owner;
  327 + dev->app_info[i].nTxMsg = 0;
  328 + dev->app_info[i].nRxMsg = 0;
  329 + dev->app_info[i].nTxMsgReject = 0;
  330 + dev->app_info[i].nRxMsgMiss = 0;
331 331  
332 332 nonseekable_open(inode, file);
333 333 return 0;
... ... @@ -347,8 +347,9 @@
347 347  
348 348 static unsigned int ft1000_poll_dev(struct file *file, poll_table *wait)
349 349 {
350   - struct net_device *dev = file->private_data;
351   - struct ft1000_info *info;
  350 + struct net_device *netdev = file->private_data;
  351 + struct ft1000_info *info = netdev_priv(netdev);
  352 + struct ft1000_device *dev = info->priv;
352 353 int i;
353 354  
354 355 //DEBUG("ft1000_poll_dev called\n");
355 356  
... ... @@ -357,12 +358,10 @@
357 358 return (-EBADF);
358 359 }
359 360  
360   - info = netdev_priv(dev);
361   -
362 361 // Search for matching file object
363 362 for (i=0; i<MAX_NUM_APP; i++) {
364   - if ( info->app_info[i].fileobject == &file->f_owner) {
365   - //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", info->app_info[i].app_id);
  363 + if ( dev->app_info[i].fileobject == &file->f_owner) {
  364 + //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", dev->app_info[i].app_id);
366 365 break;
367 366 }
368 367 }
369 368  
... ... @@ -373,12 +372,12 @@
373 372 return ( -EACCES );
374 373 }
375 374  
376   - if (list_empty(&info->app_info[i].app_sqlist) == 0) {
  375 + if (list_empty(&dev->app_info[i].app_sqlist) == 0) {
377 376 DEBUG("FT1000:ft1000_poll_dev:Message detected in slow queue\n");
378 377 return(POLLIN | POLLRDNORM | POLLPRI);
379 378 }
380 379  
381   - poll_wait (file, &info->app_info[i].wait_dpram_msg, wait);
  380 + poll_wait (file, &dev->app_info[i].wait_dpram_msg, wait);
382 381 //DEBUG("FT1000:ft1000_poll_dev:Polling for data from DSP\n");
383 382  
384 383 return (0);
... ... @@ -428,7 +427,7 @@
428 427 //DEBUG("FT1000:ft1000_ioctl:command = 0x%x argument = 0x%8x\n", command, (u32)argument);
429 428  
430 429 info = file->private_data;
431   - ft1000dev = info->pFt1000Dev;
  430 + ft1000dev = info->priv;
432 431 cmd = _IOC_NR(command);
433 432 //DEBUG("FT1000:ft1000_ioctl:cmd = 0x%x\n", cmd);
434 433  
... ... @@ -444,8 +443,8 @@
444 443 if (tempword == DSPBCMSGID) {
445 444 // Search for matching file object
446 445 for (i=0; i<MAX_NUM_APP; i++) {
447   - if ( info->app_info[i].fileobject == &file->f_owner) {
448   - info->app_info[i].DspBCMsgFlag = 1;
  446 + if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
  447 + ft1000dev->app_info[i].DspBCMsgFlag = 1;
449 448 DEBUG("FT1000:ft1000_ioctl:Registered for broadcast messages\n");
450 449 break;
451 450 }
452 451  
453 452  
... ... @@ -534,15 +533,15 @@
534 533 return (-EBADF);
535 534 }
536 535  
537   - if (info->DrvMsgPend) {
  536 + if (ft1000dev->DrvMsgPend) {
538 537 return (-ENOTTY);
539 538 }
540 539  
541   - if ( (info->DspAsicReset) || (info->fProvComplete == 0) ) {
  540 + if (ft1000dev->fProvComplete == 0) {
542 541 return (-EACCES);
543 542 }
544 543  
545   - info->fAppMsgPend = 1;
  544 + ft1000dev->fAppMsgPend = 1;
546 545  
547 546 if (info->CardReady) {
548 547  
... ... @@ -571,7 +570,7 @@
571 570 else {
572 571 // Check if this message came from a registered application
573 572 for (i=0; i<MAX_NUM_APP; i++) {
574   - if ( info->app_info[i].fileobject == &file->f_owner) {
  573 + if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
575 574 break;
576 575 }
577 576 }
... ... @@ -632,7 +631,7 @@
632 631  
633 632 // Insert slow queue sequence number
634 633 ppseudo_hdr->seq_num = info->squeseqnum++;
635   - ppseudo_hdr->portsrc = info->app_info[app_index].app_id;
  634 + ppseudo_hdr->portsrc = ft1000dev->app_info[app_index].app_id;
636 635 // Calculate new checksum
637 636 ppseudo_hdr->checksum = *pmsg++;
638 637 //DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum);
... ... @@ -645,7 +644,7 @@
645 644 card_send_command(ft1000dev,(unsigned short*)dpram_data,total_len+2);
646 645  
647 646  
648   - info->app_info[app_index].nTxMsg++;
  647 + ft1000dev->app_info[app_index].nTxMsg++;
649 648 }
650 649 else {
651 650 result = -EINVAL;
... ... @@ -675,8 +674,8 @@
675 674  
676 675 // Search for matching file object
677 676 for (i=0; i<MAX_NUM_APP; i++) {
678   - if ( info->app_info[i].fileobject == &file->f_owner) {
679   - //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", info->app_info[i].app_id);
  677 + if (ft1000dev->app_info[i].fileobject == &file->f_owner) {
  678 + //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id);
680 679 break;
681 680 }
682 681 }
683 682  
684 683  
... ... @@ -690,13 +689,13 @@
690 689  
691 690 result = 0;
692 691 pioctl_dpram = argp;
693   - if (list_empty(&info->app_info[i].app_sqlist) == 0) {
  692 + if (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
694 693 //DEBUG("FT1000:ft1000_ioctl:Message detected in slow queue\n");
695 694 spin_lock_irqsave(&free_buff_lock, flags);
696   - pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, struct dpram_blk, list);
  695 + pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
697 696 list_del(&pdpram_blk->list);
698   - info->app_info[i].NumOfMsg--;
699   - //DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, info->app_info[i].NumOfMsg);
  697 + ft1000dev->app_info[i].NumOfMsg--;
  698 + //DEBUG("FT1000:ft1000_ioctl:NumOfMsg for app %d = %d\n", i, ft1000dev->app_info[i].NumOfMsg);
700 699 spin_unlock_irqrestore(&free_buff_lock, flags);
701 700 msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ;
702 701 result = get_user(msglen, &pioctl_dpram->total_len);
... ... @@ -723,7 +722,7 @@
723 722 result = -ENOTTY;
724 723 break;
725 724 }
726   - info->fAppMsgPend = 0;
  725 + ft1000dev->fAppMsgPend = 0;
727 726 return result;
728 727 }
729 728  
... ... @@ -741,6 +740,7 @@
741 740 {
742 741 struct ft1000_info *info;
743 742 struct net_device *dev;
  743 + struct ft1000_device *ft1000dev;
744 744 int i;
745 745 struct dpram_blk *pdpram_blk;
746 746  
747 747  
748 748  
... ... @@ -748,16 +748,17 @@
748 748  
749 749 dev = file->private_data;
750 750 info = netdev_priv(dev);
  751 + ft1000dev = info->priv;
751 752  
752 753 if (ft1000_flarion_cnt == 0) {
753   - info->appcnt--;
  754 + ft1000dev->appcnt--;
754 755 return (-EBADF);
755 756 }
756 757  
757 758 // Search for matching file object
758 759 for (i=0; i<MAX_NUM_APP; i++) {
759   - if ( info->app_info[i].fileobject == &file->f_owner) {
760   - //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", info->app_info[i].app_id);
  760 + if ( ft1000dev->app_info[i].fileobject == &file->f_owner) {
  761 + //DEBUG("FT1000:ft1000_ioctl: Message is for AppId = %d\n", ft1000dev->app_info[i].app_id);
761 762 break;
762 763 }
763 764 }
764 765  
765 766  
... ... @@ -765,17 +766,17 @@
765 766 if (i==MAX_NUM_APP)
766 767 return 0;
767 768  
768   - while (list_empty(&info->app_info[i].app_sqlist) == 0) {
  769 + while (list_empty(&ft1000dev->app_info[i].app_sqlist) == 0) {
769 770 DEBUG("Remove and free memory queue up on slow queue\n");
770   - pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, struct dpram_blk, list);
  771 + pdpram_blk = list_entry(ft1000dev->app_info[i].app_sqlist.next, struct dpram_blk, list);
771 772 list_del(&pdpram_blk->list);
772 773 ft1000_free_buffer(pdpram_blk, &freercvpool);
773 774 }
774 775  
775 776 // initialize application information
776   - info->appcnt--;
777   - DEBUG("ft1000_chdev:%s:appcnt = %d\n", __FUNCTION__, info->appcnt);
778   - info->app_info[i].fileobject = NULL;
  777 + ft1000dev->appcnt--;
  778 + DEBUG("ft1000_chdev:%s:appcnt = %d\n", __FUNCTION__, ft1000dev->appcnt);
  779 + ft1000dev->app_info[i].fileobject = NULL;
779 780  
780 781 return 0;
781 782 }
drivers/staging/ft1000/ft1000-usb/ft1000_download.c
... ... @@ -188,7 +188,6 @@
188 188 u16 handshake;
189 189 int loopcnt;
190 190 u32 status = 0;
191   - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
192 191  
193 192 loopcnt = 0;
194 193  
195 194  
... ... @@ -196,10 +195,10 @@
196 195 /* Need to clear downloader doorbell if Hartley ASIC */
197 196 status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_RX,
198 197 FT1000_REG_DOORBELL);
199   - if (pft1000info->fcodeldr) {
  198 + if (ft1000dev->fcodeldr) {
200 199 DEBUG(" get_handshake: fcodeldr is %d\n",
201   - pft1000info->fcodeldr);
202   - pft1000info->fcodeldr = 0;
  200 + ft1000dev->fcodeldr);
  201 + ft1000dev->fcodeldr = 0;
203 202 status = check_usb_db(ft1000dev);
204 203 if (status != STATUS_SUCCESS) {
205 204 DEBUG("get_handshake: check_usb_db failed\n");
206 205  
207 206  
208 207  
209 208  
210 209  
... ... @@ -270,29 +269,28 @@
270 269 u16 temp;
271 270 u32 status = 0;
272 271  
273   - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
274 272 loopcnt = 0;
275 273 handshake = 0;
276 274  
277 275 while (loopcnt < 100) {
278   - if (pft1000info->usbboot == 2) {
  276 + if (ft1000dev->usbboot == 2) {
279 277 status = ft1000_read_dpram32(ft1000dev, 0,
280   - (u8 *)&(pft1000info->tempbuf[0]), 64);
  278 + (u8 *)&(ft1000dev->tempbuf[0]), 64);
281 279 for (temp = 0; temp < 16; temp++) {
282 280 DEBUG("tempbuf %d = 0x%x\n", temp,
283   - pft1000info->tempbuf[temp]);
  281 + ft1000dev->tempbuf[temp]);
284 282 }
285 283 status = ft1000_read_dpram16(ft1000dev,
286 284 DWNLD_MAG1_HANDSHAKE_LOC,
287 285 (u8 *)&handshake, 1);
288 286 DEBUG("handshake from read_dpram16 = 0x%x\n",
289 287 handshake);
290   - if (pft1000info->dspalive == pft1000info->tempbuf[6]) {
  288 + if (ft1000dev->dspalive == ft1000dev->tempbuf[6]) {
291 289 handshake = 0;
292 290 } else {
293   - handshake = pft1000info->tempbuf[1];
294   - pft1000info->dspalive =
295   - pft1000info->tempbuf[6];
  291 + handshake = ft1000dev->tempbuf[1];
  292 + ft1000dev->dspalive =
  293 + ft1000dev->tempbuf[6];
296 294 }
297 295 } else {
298 296 status = ft1000_read_dpram16(ft1000dev,
299 297  
... ... @@ -336,9 +334,8 @@
336 334 u32 status;
337 335 u16 tempword;
338 336 u32 tempx;
339   - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
340 337  
341   - if (pft1000info->bootmode == 1) {
  338 + if (ft1000dev->bootmode == 1) {
342 339 status = fix_ft1000_read_dpram32(ft1000dev,
343 340 DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx);
344 341 tempx = ntohl(tempx);
345 342  
346 343  
... ... @@ -360,16 +357,15 @@
360 357 u32 status;
361 358 u16 tempword;
362 359 u32 tempx;
363   - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
364 360  
365   - if (pft1000info->bootmode == 1) {
  361 + if (ft1000dev->bootmode == 1) {
366 362 status = fix_ft1000_read_dpram32(ft1000dev,
367 363 DWNLD_MAG1_TYPE_LOC, (u8 *)&tempx);
368 364 tempx = ntohl(tempx);
369 365 } else {
370   - if (pft1000info->usbboot == 2) {
371   - tempx = pft1000info->tempbuf[2];
372   - tempword = pft1000info->tempbuf[3];
  366 + if (ft1000dev->usbboot == 2) {
  367 + tempx = ft1000dev->tempbuf[2];
  368 + tempword = ft1000dev->tempbuf[3];
373 369 } else {
374 370 tempx = 0;
375 371 status = ft1000_read_dpram16(ft1000dev,
376 372  
... ... @@ -401,9 +397,8 @@
401 397 u32 value;
402 398 u16 tempword;
403 399 u32 status;
404   - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
405 400  
406   - if (pft1000info->bootmode == 1) {
  401 + if (ft1000dev->bootmode == 1) {
407 402 status = fix_ft1000_read_dpram32(ft1000dev,
408 403 DWNLD_MAG1_SIZE_LOC, (u8 *)&value);
409 404 value = ntohl(value);
... ... @@ -507,7 +502,6 @@
507 502 u16 tempword;
508 503 u16 tempbuffer[64];
509 504 u16 resultbuffer[64];
510   - struct ft1000_info *pft1000info = netdev_priv(ft1000dev->net);
511 505  
512 506 //DEBUG("FT1000:download:start word_length = %d\n",(int)word_length);
513 507 dpram = (u16)DWNLD_MAG1_PS_HDR_LOC;
... ... @@ -548,7 +542,7 @@
548 542 //DEBUG("write_blk: loopcnt is %d\n", loopcnt);
549 543 //DEBUG("write_blk: bootmode = %d\n", bootmode);
550 544 //DEBUG("write_blk: dpram = %x\n", dpram);
551   - if (pft1000info->bootmode == 0)
  545 + if (ft1000dev->bootmode == 0)
552 546 {
553 547 if (dpram >= 0x3F4)
554 548 Status = ft1000_write_dpram32 (ft1000dev, dpram, (u8 *)&tempbuffer[0], 8);
... ... @@ -718,9 +712,9 @@
718 712  
719 713 DEBUG("Entered scram_dnldr...\n");
720 714  
721   - pft1000info->fcodeldr = 0;
722   - pft1000info->usbboot = 0;
723   - pft1000info->dspalive = 0xffff;
  715 + ft1000dev->fcodeldr = 0;
  716 + ft1000dev->usbboot = 0;
  717 + ft1000dev->dspalive = 0xffff;
724 718  
725 719 //
726 720 // Get version id of file, at first 4 bytes of file, for newer files.
... ... @@ -745,7 +739,7 @@
745 739 switch (state) {
746 740 case STATE_START_DWNLD:
747 741 DEBUG("FT1000:STATE_START_DWNLD\n");
748   - if (pft1000info->usbboot)
  742 + if (ft1000dev->usbboot)
749 743 handshake =
750 744 get_handshake_usb(ft1000dev,
751 745 HANDSHAKE_DSP_BL_READY);
... ... @@ -771,7 +765,7 @@
771 765  
772 766 case STATE_BOOT_DWNLD:
773 767 DEBUG("FT1000:STATE_BOOT_DWNLD\n");
774   - pft1000info->bootmode = 1;
  768 + ft1000dev->bootmode = 1;
775 769 handshake = get_handshake(ft1000dev, HANDSHAKE_REQUEST);
776 770 if (handshake == HANDSHAKE_REQUEST) {
777 771 /*
... ... @@ -797,7 +791,7 @@
797 791 //DEBUG("FT1000:download:s_file = 0x%8x\n", (int)s_file);
798 792 //DEBUG("FT1000:download:c_file = 0x%8x\n", (int)c_file);
799 793 state = STATE_CODE_DWNLD;
800   - pft1000info->fcodeldr = 1;
  794 + ft1000dev->fcodeldr = 1;
801 795 break;
802 796 case REQUEST_CODE_SEGMENT:
803 797 //DEBUG("FT1000:REQUEST_CODE_SEGMENT\n");
... ... @@ -842,7 +836,7 @@
842 836 status = STATUS_FAILURE;
843 837 break;
844 838 }
845   - if (pft1000info->usbboot)
  839 + if (ft1000dev->usbboot)
846 840 put_handshake_usb(ft1000dev,
847 841 HANDSHAKE_RESPONSE);
848 842 else
... ... @@ -858,8 +852,8 @@
858 852  
859 853 case STATE_CODE_DWNLD:
860 854 //DEBUG("FT1000:STATE_CODE_DWNLD\n");
861   - pft1000info->bootmode = 0;
862   - if (pft1000info->usbboot)
  855 + ft1000dev->bootmode = 0;
  856 + if (ft1000dev->usbboot)
863 857 handshake =
864 858 get_handshake_usb(ft1000dev,
865 859 HANDSHAKE_REQUEST);
... ... @@ -870,7 +864,7 @@
870 864 /*
871 865 * Get type associated with the request.
872 866 */
873   - if (pft1000info->usbboot)
  867 + if (ft1000dev->usbboot)
874 868 request =
875 869 get_request_type_usb(ft1000dev);
876 870 else
... ... @@ -916,7 +910,7 @@
916 910 }
917 911 break;
918 912 case REQUEST_DONE_CL:
919   - pft1000info->usbboot = 3;
  913 + ft1000dev->usbboot = 3;
920 914 /* Reposition ptrs to beginning of provisioning section */
921 915 s_file =
922 916 (u16 *) (pFileStart +
... ... @@ -965,9 +959,9 @@
965 959  
966 960 write_blk_fifo(ft1000dev, &s_file,
967 961 &c_file, word_length);
968   - if (pft1000info->usbboot == 0)
969   - pft1000info->usbboot++;
970   - if (pft1000info->usbboot == 1) {
  962 + if (ft1000dev->usbboot == 0)
  963 + ft1000dev->usbboot++;
  964 + if (ft1000dev->usbboot == 1) {
971 965 tempword = 0;
972 966 ft1000_write_dpram16(ft1000dev,
973 967 DWNLD_MAG1_PS_HDR_LOC,
... ... @@ -1117,7 +1111,7 @@
1117 1111 status = STATUS_FAILURE;
1118 1112 break;
1119 1113 }
1120   - if (pft1000info->usbboot)
  1114 + if (ft1000dev->usbboot)
1121 1115 put_handshake_usb(ft1000dev,
1122 1116 HANDSHAKE_RESPONSE);
1123 1117 else
drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
... ... @@ -29,7 +29,7 @@
29 29  
30 30 //#define JDEBUG
31 31  
32   -static int ft1000_reset(struct net_device *ft1000dev);
  32 +static int ft1000_reset(void *ft1000dev);
33 33 static int ft1000_submit_rx_urb(struct ft1000_info *info);
34 34 static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev);
35 35 static int ft1000_open (struct net_device *dev);
... ... @@ -588,7 +588,7 @@
588 588 static void ft1000_reset_asic(struct net_device *dev)
589 589 {
590 590 struct ft1000_info *info = netdev_priv(dev);
591   - struct ft1000_device *ft1000dev = info->pFt1000Dev;
  591 + struct ft1000_device *ft1000dev = info->priv;
592 592 u16 tempword;
593 593  
594 594 DEBUG("ft1000_hw:ft1000_reset_asic called\n");
595 595  
596 596  
... ... @@ -627,15 +627,15 @@
627 627 static int ft1000_reset_card(struct net_device *dev)
628 628 {
629 629 struct ft1000_info *info = netdev_priv(dev);
630   - struct ft1000_device *ft1000dev = info->pFt1000Dev;
  630 + struct ft1000_device *ft1000dev = info->priv;
631 631 u16 tempword;
632 632 struct prov_record *ptr;
633 633  
634 634 DEBUG("ft1000_hw:ft1000_reset_card called.....\n");
635 635  
636   - info->fCondResetPend = 1;
  636 + ft1000dev->fCondResetPend = 1;
637 637 info->CardReady = 0;
638   - info->fProvComplete = 0;
  638 + ft1000dev->fProvComplete = 0;
639 639  
640 640 /* Make sure we free any memory reserve for provisioning */
641 641 while (list_empty(&info->prov_list) == 0) {
... ... @@ -666,7 +666,7 @@
666 666  
667 667 info->CardReady = 1;
668 668  
669   - info->fCondResetPend = 0;
  669 + ft1000dev->fCondResetPend = 0;
670 670  
671 671 return TRUE;
672 672 }
... ... @@ -729,8 +729,8 @@
729 729 goto err_net;
730 730 }
731 731  
732   - pInfo->CardNumber = gCardIndex;
733   - DEBUG("card number = %d\n", pInfo->CardNumber);
  732 + ft1000dev->CardNumber = gCardIndex;
  733 + DEBUG("card number = %d\n", ft1000dev->CardNumber);
734 734 } else {
735 735 printk(KERN_ERR "ft1000: Invalid device name\n");
736 736 ret_val = -ENXIO;
737 737  
738 738  
739 739  
... ... @@ -740,27 +740,27 @@
740 740 memset(&pInfo->stats, 0, sizeof(struct net_device_stats));
741 741  
742 742 spin_lock_init(&pInfo->dpram_lock);
743   - pInfo->pFt1000Dev = ft1000dev;
  743 + pInfo->priv = ft1000dev;
744 744 pInfo->DrvErrNum = 0;
745 745 pInfo->registered = 1;
746 746 pInfo->ft1000_reset = ft1000_reset;
747 747 pInfo->mediastate = 0;
748 748 pInfo->fifo_cnt = 0;
749   - pInfo->DeviceCreated = FALSE;
  749 + ft1000dev->DeviceCreated = FALSE;
750 750 pInfo->CardReady = 0;
751 751 pInfo->DSP_TIME[0] = 0;
752 752 pInfo->DSP_TIME[1] = 0;
753 753 pInfo->DSP_TIME[2] = 0;
754 754 pInfo->DSP_TIME[3] = 0;
755   - pInfo->fAppMsgPend = 0;
756   - pInfo->fCondResetPend = 0;
757   - pInfo->usbboot = 0;
758   - pInfo->dspalive = 0;
759   - memset(&pInfo->tempbuf[0], 0, sizeof(pInfo->tempbuf));
  755 + ft1000dev->fAppMsgPend = 0;
  756 + ft1000dev->fCondResetPend = 0;
  757 + ft1000dev->usbboot = 0;
  758 + ft1000dev->dspalive = 0;
  759 + memset(&ft1000dev->tempbuf[0], 0, sizeof(ft1000dev->tempbuf));
760 760  
761 761 INIT_LIST_HEAD(&pInfo->prov_list);
762 762  
763   - INIT_LIST_HEAD(&pInfo->nodes.list);
  763 + INIT_LIST_HEAD(&ft1000dev->nodes.list);
764 764  
765 765 netdev->netdev_ops = &ftnet_ops;
766 766  
... ... @@ -854,7 +854,7 @@
854 854 return 0;
855 855 }
856 856  
857   -static int ft1000_reset(struct net_device *dev)
  857 +int ft1000_reset(void *dev)
858 858 {
859 859 ft1000_reset_card(dev);
860 860 return 0;
... ... @@ -902,7 +902,7 @@
902 902 static int ft1000_copy_down_pkt(struct net_device *netdev, u8 * packet, u16 len)
903 903 {
904 904 struct ft1000_info *pInfo = netdev_priv(netdev);
905   - struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev;
  905 + struct ft1000_device *pFt1000Dev = pInfo->priv;
906 906  
907 907 int count, ret;
908 908 u8 *t;
... ... @@ -981,7 +981,7 @@
981 981 static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev)
982 982 {
983 983 struct ft1000_info *pInfo = netdev_priv(dev);
984   - struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev;
  984 + struct ft1000_device *pFt1000Dev = pInfo->priv;
985 985 u8 *pdata;
986 986 int maxlen, pipe;
987 987  
... ... @@ -1039,7 +1039,7 @@
1039 1039 static int ft1000_copy_up_pkt(struct urb *urb)
1040 1040 {
1041 1041 struct ft1000_info *info = urb->context;
1042   - struct ft1000_device *ft1000dev = info->pFt1000Dev;
  1042 + struct ft1000_device *ft1000dev = info->priv;
1043 1043 struct net_device *net = ft1000dev->net;
1044 1044  
1045 1045 u16 tempword;
... ... @@ -1134,7 +1134,7 @@
1134 1134 static int ft1000_submit_rx_urb(struct ft1000_info *info)
1135 1135 {
1136 1136 int result;
1137   - struct ft1000_device *pFt1000Dev = info->pFt1000Dev;
  1137 + struct ft1000_device *pFt1000Dev = info->priv;
1138 1138  
1139 1139 if (pFt1000Dev->status & FT1000_STATUS_CLOSING) {
1140 1140 DEBUG("network driver is closed, return\n");
1141 1141  
... ... @@ -1177,9 +1177,10 @@
1177 1177 static int ft1000_open(struct net_device *dev)
1178 1178 {
1179 1179 struct ft1000_info *pInfo = netdev_priv(dev);
  1180 + struct ft1000_device *pFt1000Dev = pInfo->priv;
1180 1181 struct timeval tv;
1181 1182  
1182   - DEBUG("ft1000_open is called for card %d\n", pInfo->CardNumber);
  1183 + DEBUG("ft1000_open is called for card %d\n", pFt1000Dev->CardNumber);
1183 1184  
1184 1185 pInfo->stats.rx_bytes = 0;
1185 1186 pInfo->stats.tx_bytes = 0;
... ... @@ -1213,7 +1214,7 @@
1213 1214 int ft1000_close(struct net_device *net)
1214 1215 {
1215 1216 struct ft1000_info *pInfo = netdev_priv(net);
1216   - struct ft1000_device *ft1000dev = pInfo->pFt1000Dev;
  1217 + struct ft1000_device *ft1000dev = pInfo->priv;
1217 1218  
1218 1219 ft1000dev->status |= FT1000_STATUS_CLOSING;
1219 1220  
1220 1221  
... ... @@ -1251,9 +1252,8 @@
1251 1252 {
1252 1253 u16 tempword;
1253 1254 u16 status;
1254   - struct ft1000_info *info = netdev_priv(dev->net);
1255 1255  
1256   - if (info->fCondResetPend) {
  1256 + if (dev->fCondResetPend) {
1257 1257 DEBUG
1258 1258 ("ft1000_hw:ft1000_chkcard:Card is being reset, return FALSE\n");
1259 1259 return TRUE;
... ... @@ -1441,7 +1441,7 @@
1441 1441  
1442 1442 msleep(100);
1443 1443  
1444   - info->fProvComplete = 1;
  1444 + dev->fProvComplete = 1;
1445 1445 info->CardReady = 1;
1446 1446  
1447 1447 return STATUS_SUCCESS;
... ... @@ -1498,7 +1498,7 @@
1498 1498 if (pmediamsg->state) {
1499 1499 DEBUG("Media is up\n");
1500 1500 if (info->mediastate == 0) {
1501   - if (info->NetDevRegDone) {
  1501 + if (dev->NetDevRegDone) {
1502 1502 netif_wake_queue(dev->
1503 1503 net);
1504 1504 }
... ... @@ -1508,7 +1508,7 @@
1508 1508 DEBUG("Media is down\n");
1509 1509 if (info->mediastate == 1) {
1510 1510 info->mediastate = 0;
1511   - if (info->NetDevRegDone) {
  1511 + if (dev->NetDevRegDone) {
1512 1512 }
1513 1513 info->ConTm = 0;
1514 1514 }
1515 1515  
... ... @@ -1567,12 +1567,12 @@
1567 1567 * Send provisioning data to DSP
1568 1568 */
1569 1569 if (list_empty(&info->prov_list) == 0) {
1570   - info->fProvComplete = 0;
  1570 + dev->fProvComplete = 0;
1571 1571 status = ft1000_dsp_prov(dev);
1572 1572 if (status != STATUS_SUCCESS)
1573 1573 goto out;
1574 1574 } else {
1575   - info->fProvComplete = 1;
  1575 + dev->fProvComplete = 1;
1576 1576 status =
1577 1577 ft1000_write_register(dev, FT1000_DB_HB,
1578 1578 FT1000_REG_DOORBELL);
... ... @@ -1605,7 +1605,7 @@
1605 1605 case DSP_GET_INFO:{
1606 1606 DEBUG("FT1000:drivermsg:Got DSP_GET_INFO\n");
1607 1607 /* copy dsp info block to dsp */
1608   - info->DrvMsgPend = 1;
  1608 + dev->DrvMsgPend = 1;
1609 1609 /* allow any outstanding ioctl to finish */
1610 1610 mdelay(10);
1611 1611 status =
... ... @@ -1667,7 +1667,7 @@
1667 1667 status =
1668 1668 ft1000_write_register(dev, FT1000_DB_DPRAM_TX,
1669 1669 FT1000_REG_DOORBELL);
1670   - info->DrvMsgPend = 0;
  1670 + dev->DrvMsgPend = 0;
1671 1671  
1672 1672 break;
1673 1673 }
... ... @@ -1675,7 +1675,7 @@
1675 1675 case GET_DRV_ERR_RPT_MSG:{
1676 1676 DEBUG("FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n");
1677 1677 /* copy driver error message to dsp */
1678   - info->DrvMsgPend = 1;
  1678 + dev->DrvMsgPend = 1;
1679 1679 /* allow any outstanding ioctl to finish */
1680 1680 mdelay(10);
1681 1681 status =
... ... @@ -1735,7 +1735,7 @@
1735 1735 (u16) (0x0012 + PSEUDOSZ));
1736 1736 info->DrvErrNum = 0;
1737 1737 }
1738   - info->DrvMsgPend = 0;
  1738 + dev->DrvMsgPend = 0;
1739 1739  
1740 1740 break;
1741 1741 }
... ... @@ -1804,8 +1804,8 @@
1804 1804 // Check which application has registered for dsp broadcast messages
1805 1805  
1806 1806 for (i=0; i<MAX_NUM_APP; i++) {
1807   - if ( (info->app_info[i].DspBCMsgFlag) && (info->app_info[i].fileobject) &&
1808   - (info->app_info[i].NumOfMsg < MAX_MSG_LIMIT) )
  1807 + if ( (dev->app_info[i].DspBCMsgFlag) && (dev->app_info[i].fileobject) &&
  1808 + (dev->app_info[i].NumOfMsg < MAX_MSG_LIMIT) )
1809 1809 {
1810 1810 nxtph = FT1000_DPRAM_RX_BASE + 2;
1811 1811 pdpram_blk = ft1000_get_buffer (&freercvpool);
1812 1812  
1813 1813  
1814 1814  
... ... @@ -1813,15 +1813,15 @@
1813 1813 if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE, &nxtph) ) {
1814 1814 ppseudo_hdr = (struct pseudo_hdr *)pdpram_blk->pbuffer;
1815 1815 // Put message into the appropriate application block
1816   - info->app_info[i].nRxMsg++;
  1816 + dev->app_info[i].nRxMsg++;
1817 1817 spin_lock_irqsave(&free_buff_lock, flags);
1818   - list_add_tail(&pdpram_blk->list, &info->app_info[i].app_sqlist);
1819   - info->app_info[i].NumOfMsg++;
  1818 + list_add_tail(&pdpram_blk->list, &dev->app_info[i].app_sqlist);
  1819 + dev->app_info[i].NumOfMsg++;
1820 1820 spin_unlock_irqrestore(&free_buff_lock, flags);
1821   - wake_up_interruptible(&info->app_info[i].wait_dpram_msg);
  1821 + wake_up_interruptible(&dev->app_info[i].wait_dpram_msg);
1822 1822 }
1823 1823 else {
1824   - info->app_info[i].nRxMsgMiss++;
  1824 + dev->app_info[i].nRxMsgMiss++;
1825 1825 // Put memory back to free pool
1826 1826 ft1000_free_buffer(pdpram_blk, &freercvpool);
1827 1827 DEBUG("pdpram_blk::ft1000_get_buffer NULL\n");
... ... @@ -1829,7 +1829,7 @@
1829 1829 }
1830 1830 else {
1831 1831 DEBUG("Out of memory in free receive command pool\n");
1832   - info->app_info[i].nRxMsgMiss++;
  1832 + dev->app_info[i].nRxMsgMiss++;
1833 1833 }
1834 1834 }
1835 1835 }
... ... @@ -1842,7 +1842,7 @@
1842 1842 ppseudo_hdr = (struct pseudo_hdr *)pdpram_blk->pbuffer;
1843 1843 // Search for correct application block
1844 1844 for (i=0; i<MAX_NUM_APP; i++) {
1845   - if (info->app_info[i].app_id == ppseudo_hdr->portdest) {
  1845 + if (dev->app_info[i].app_id == ppseudo_hdr->portdest) {
1846 1846 break;
1847 1847 }
1848 1848 }
1849 1849  
1850 1850  
... ... @@ -1853,15 +1853,15 @@
1853 1853 ft1000_free_buffer(pdpram_blk, &freercvpool);
1854 1854 }
1855 1855 else {
1856   - if (info->app_info[i].NumOfMsg > MAX_MSG_LIMIT) {
  1856 + if (dev->app_info[i].NumOfMsg > MAX_MSG_LIMIT) {
1857 1857 // Put memory back to free pool
1858 1858 ft1000_free_buffer(pdpram_blk, &freercvpool);
1859 1859 }
1860 1860 else {
1861   - info->app_info[i].nRxMsg++;
  1861 + dev->app_info[i].nRxMsg++;
1862 1862 // Put message into the appropriate application block
1863   - list_add_tail(&pdpram_blk->list, &info->app_info[i].app_sqlist);
1864   - info->app_info[i].NumOfMsg++;
  1863 + list_add_tail(&pdpram_blk->list, &dev->app_info[i].app_sqlist);
  1864 + dev->app_info[i].NumOfMsg++;
1865 1865 }
1866 1866 }
1867 1867 }
... ... @@ -1921,7 +1921,7 @@
1921 1921 else if (tempword & FT1000_DB_COND_RESET) {
1922 1922 DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n");
1923 1923  
1924   - if (info->fAppMsgPend == 0) {
  1924 + if (dev->fAppMsgPend == 0) {
1925 1925 // Reset ASIC and DSP
1926 1926  
1927 1927 status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0, (u8 *)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX);
... ... @@ -1934,8 +1934,8 @@
1934 1934 info->ft1000_reset(dev->net);
1935 1935 }
1936 1936 else {
1937   - info->fProvComplete = 0;
1938   - info->fCondResetPend = 1;
  1937 + dev->fProvComplete = 0;
  1938 + dev->fCondResetPend = 1;
1939 1939 }
1940 1940  
1941 1941 ft1000_write_register(dev, FT1000_DB_COND_RESET, FT1000_REG_DOORBELL);
drivers/staging/ft1000/ft1000-usb/ft1000_proc.c
... ... @@ -94,11 +94,11 @@
94 94  
95 95  
96 96 if (info->ProgConStat != 0xFF) {
97   - ft1000_read_dpram16(info->pFt1000Dev, FT1000_MAG_DSP_LED,
  97 + ft1000_read_dpram16(info->priv, FT1000_MAG_DSP_LED,
98 98 (u8 *)&ledStat, FT1000_MAG_DSP_LED_INDX);
99 99 info->LedStat = ntohs(ledStat);
100 100  
101   - ft1000_read_dpram16(info->pFt1000Dev, FT1000_MAG_DSP_CON_STATE,
  101 + ft1000_read_dpram16(info->priv, FT1000_MAG_DSP_CON_STATE,
102 102 (u8 *)&conStat, FT1000_MAG_DSP_CON_STATE_INDX);
103 103 info->ConStat = ntohs(conStat);
104 104 do_gettimeofday(&tv);
drivers/staging/ft1000/ft1000-usb/ft1000_usb.c
... ... @@ -171,11 +171,11 @@
171 171 }
172 172  
173 173 gPollingfailed = FALSE;
174   - pft1000info->pPollThread =
  174 + ft1000dev->pPollThread =
175 175 kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll");
176 176  
177   - if (IS_ERR(pft1000info->pPollThread)) {
178   - ret = PTR_ERR(pft1000info->pPollThread);
  177 + if (IS_ERR(ft1000dev->pPollThread)) {
  178 + ret = PTR_ERR(ft1000dev->pPollThread);
179 179 goto err_load;
180 180 }
181 181  
... ... @@ -200,7 +200,7 @@
200 200 if (ret)
201 201 goto err_proc;
202 202  
203   - pft1000info->NetDevRegDone = 1;
  203 + ft1000dev->NetDevRegDone = 1;
204 204  
205 205 return 0;
206 206  
... ... @@ -208,7 +208,7 @@
208 208 unregister_netdev(ft1000dev->net);
209 209 free_netdev(ft1000dev->net);
210 210 err_thread:
211   - kthread_stop(pft1000info->pPollThread);
  211 + kthread_stop(ft1000dev->pPollThread);
212 212 err_load:
213 213 kfree(pFileStart);
214 214 err_fw:
... ... @@ -219,6 +219,7 @@
219 219 static void ft1000_disconnect(struct usb_interface *interface)
220 220 {
221 221 struct ft1000_info *pft1000info;
  222 + struct ft1000_device *ft1000dev;
222 223  
223 224 DEBUG("ft1000_disconnect is called\n");
224 225  
225 226  
226 227  
227 228  
228 229  
229 230  
230 231  
... ... @@ -226,28 +227,29 @@
226 227 DEBUG("In disconnect pft1000info=%p\n", pft1000info);
227 228  
228 229 if (pft1000info) {
  230 + ft1000dev = pft1000info->priv;
229 231 ft1000_cleanup_proc(pft1000info);
230   - if (pft1000info->pPollThread)
231   - kthread_stop(pft1000info->pPollThread);
  232 + if (ft1000dev->pPollThread)
  233 + kthread_stop(ft1000dev->pPollThread);
232 234  
233 235 DEBUG("ft1000_disconnect: threads are terminated\n");
234 236  
235   - if (pft1000info->pFt1000Dev->net) {
  237 + if (ft1000dev->net) {
236 238 DEBUG("ft1000_disconnect: destroy char driver\n");
237   - ft1000_destroy_dev(pft1000info->pFt1000Dev->net);
238   - unregister_netdev(pft1000info->pFt1000Dev->net);
  239 + ft1000_destroy_dev(ft1000dev->net);
  240 + unregister_netdev(ft1000dev->net);
239 241 DEBUG
240 242 ("ft1000_disconnect: network device unregistered\n");
241   - free_netdev(pft1000info->pFt1000Dev->net);
  243 + free_netdev(ft1000dev->net);
242 244  
243 245 }
244 246  
245   - usb_free_urb(pft1000info->pFt1000Dev->rx_urb);
246   - usb_free_urb(pft1000info->pFt1000Dev->tx_urb);
  247 + usb_free_urb(ft1000dev->rx_urb);
  248 + usb_free_urb(ft1000dev->tx_urb);
247 249  
248 250 DEBUG("ft1000_disconnect: urb freed\n");
249 251  
250   - kfree(pft1000info->pFt1000Dev);
  252 + kfree(ft1000dev);
251 253 }
252 254 kfree(pFileStart);
253 255  
drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
... ... @@ -55,6 +55,13 @@
55 55  
56 56 #define MAX_BUF_SIZE 4096
57 57  
  58 +struct ft1000_debug_dirs {
  59 + struct list_head list;
  60 + struct dentry *dent;
  61 + struct dentry *file;
  62 + int int_number;
  63 +};
  64 +
58 65 struct ft1000_device {
59 66 struct usb_device *dev;
60 67 struct net_device *net;
61 68  
62 69  
63 70  
64 71  
65 72  
66 73  
67 74  
68 75  
69 76  
70 77  
... ... @@ -69,71 +76,26 @@
69 76  
70 77 u8 bulk_in_endpointAddr;
71 78 u8 bulk_out_endpointAddr;
72   -} __packed;
73 79  
74   -struct ft1000_debug_dirs {
75   - struct list_head list;
76   - struct dentry *dent;
77   - struct dentry *file;
78   - int int_number;
79   -};
80   -
81   -struct ft1000_info {
82   - struct ft1000_device *pFt1000Dev;
83   - struct net_device_stats stats;
84   -
85 80 struct task_struct *pPollThread;
86   -
87 81 unsigned char fcodeldr;
88 82 unsigned char bootmode;
89 83 unsigned char usbboot;
90 84 unsigned short dspalive;
91   - u16 ASIC_ID;
92 85 bool fProvComplete;
93 86 bool fCondResetPend;
94 87 bool fAppMsgPend;
95   - u16 DrvErrNum;
96   - u16 AsicID;
97   - int DspAsicReset;
98 88 int DeviceCreated;
99   - int CardReady;
100 89 int NetDevRegDone;
101 90 u8 CardNumber;
102 91 u8 DeviceName[15];
103 92 struct ft1000_debug_dirs nodes;
104   - int registered;
105   - int mediastate;
106   - u8 squeseqnum; /* sequence number on slow queue */
107   - spinlock_t dpram_lock;
108 93 spinlock_t fifo_lock;
109   - u16 fifo_cnt;
110   - u8 DspVer[DSPVERSZ]; /* DSP version number */
111   - u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */
112   - u8 Sku[SKUSZ]; /* SKU */
113   - u8 eui64[EUISZ]; /* EUI64 */
114   - time_t ConTm; /* Connection Time */
115   - u8 ProductMode[MODESZ];
116   - u8 RfCalVer[CALVERSZ];
117   - u8 RfCalDate[CALDATESZ];
118   - u16 DSP_TIME[4];
119   - u16 LedStat;
120   - u16 ConStat;
121   - u16 ProgConStat;
122   - struct list_head prov_list;
123 94 int appcnt;
124 95 struct app_info_block app_info[MAX_NUM_APP];
125   - u16 DSPInfoBlklen;
126 96 u16 DrvMsgPend;
127   - int (*ft1000_reset)(struct net_device *dev);
128   - u16 DSPInfoBlk[MAX_DSP_SESS_REC];
129   - union {
130   - u16 Rec[MAX_DSP_SESS_REC];
131   - u32 MagRec[MAX_DSP_SESS_REC/2];
132   - } DSPSess;
133 97 unsigned short tempbuf[32];
134   - char netdevname[IFNAMSIZ];
135   - struct proc_dir_entry *ft1000_proc_dir;
136   -};
  98 +} __packed;
137 99  
138 100  
139 101 struct dpram_blk {
drivers/staging/ft1000/ft1000.h
... ... @@ -250,4 +250,39 @@
250 250 struct list_head list;
251 251 u8 *pprov_data;
252 252 };
  253 +
  254 +struct ft1000_info {
  255 + void *priv;
  256 + struct net_device_stats stats;
  257 + u16 DrvErrNum;
  258 + u16 AsicID;
  259 + int CardReady;
  260 + int registered;
  261 + int mediastate;
  262 + u8 squeseqnum; /* sequence number on slow queue */
  263 + spinlock_t dpram_lock;
  264 + u16 fifo_cnt;
  265 + u8 DspVer[DSPVERSZ]; /* DSP version number */
  266 + u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */
  267 + u8 Sku[SKUSZ]; /* SKU */
  268 + u8 eui64[EUISZ]; /* EUI64 */
  269 + time_t ConTm; /* Connection Time */
  270 + u8 ProductMode[MODESZ];
  271 + u8 RfCalVer[CALVERSZ];
  272 + u8 RfCalDate[CALDATESZ];
  273 + u16 DSP_TIME[4];
  274 + u16 LedStat;
  275 + u16 ConStat;
  276 + u16 ProgConStat;
  277 + struct list_head prov_list;
  278 + u16 DSPInfoBlklen;
  279 + int (*ft1000_reset)(void *);
  280 + u16 DSPInfoBlk[MAX_DSP_SESS_REC];
  281 + union {
  282 + u16 Rec[MAX_DSP_SESS_REC];
  283 + u32 MagRec[MAX_DSP_SESS_REC/2];
  284 + } DSPSess;
  285 + struct proc_dir_entry *ft1000_proc_dir;
  286 + char netdevname[IFNAMSIZ];
  287 +};