mirror of https://gitee.com/openkylin/linux.git
staging: ft1000: Fix coding style in init_ft1000_netdev function.
Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
cb3aa5d5b5
commit
6c284c7b06
|
@ -712,7 +712,7 @@ static const struct net_device_ops ftnet_ops =
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
|
u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
|
||||||
{
|
{
|
||||||
struct net_device *netdev;
|
struct net_device *netdev;
|
||||||
struct ft1000_info *pInfo = NULL;
|
struct ft1000_info *pInfo = NULL;
|
||||||
struct dpram_blk *pdpram_blk;
|
struct dpram_blk *pdpram_blk;
|
||||||
int i, ret_val;
|
int i, ret_val;
|
||||||
|
@ -720,27 +720,23 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
|
||||||
char card_nr[2];
|
char card_nr[2];
|
||||||
unsigned long gCardIndex = 0;
|
unsigned long gCardIndex = 0;
|
||||||
|
|
||||||
DEBUG("Enter init_ft1000_netdev...\n");
|
DEBUG("Enter init_ft1000_netdev...\n");
|
||||||
|
|
||||||
|
|
||||||
netdev = alloc_etherdev(sizeof(struct ft1000_info));
|
netdev = alloc_etherdev(sizeof(struct ft1000_info));
|
||||||
if (!netdev )
|
if (!netdev) {
|
||||||
{
|
DEBUG("init_ft1000_netdev: can not allocate network device\n");
|
||||||
DEBUG("init_ft1000_netdev: can not allocate network device\n");
|
return -ENOMEM;
|
||||||
return -ENOMEM;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pInfo = netdev_priv(netdev);
|
pInfo = netdev_priv(netdev);
|
||||||
|
|
||||||
//DEBUG("init_ft1000_netdev: gFt1000Info=%x, netdev=%x, ft1000dev=%x\n", gFt1000Info, netdev, ft1000dev);
|
|
||||||
|
|
||||||
memset(pInfo, 0, sizeof(struct ft1000_info));
|
memset(pInfo, 0, sizeof(struct ft1000_info));
|
||||||
|
|
||||||
dev_alloc_name(netdev, netdev->name);
|
dev_alloc_name(netdev, netdev->name);
|
||||||
|
|
||||||
DEBUG("init_ft1000_netdev: network device name is %s\n", netdev->name);
|
DEBUG("init_ft1000_netdev: network device name is %s\n", netdev->name);
|
||||||
|
|
||||||
if ( strncmp(netdev->name,"eth", 3) == 0) {
|
if (strncmp(netdev->name, "eth", 3) == 0) {
|
||||||
card_nr[0] = netdev->name[3];
|
card_nr[0] = netdev->name[3];
|
||||||
card_nr[1] = '\0';
|
card_nr[1] = '\0';
|
||||||
ret_val = strict_strtoul(card_nr, 10, &gCardIndex);
|
ret_val = strict_strtoul(card_nr, 10, &gCardIndex);
|
||||||
|
@ -749,89 +745,83 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
|
||||||
goto err_net;
|
goto err_net;
|
||||||
}
|
}
|
||||||
|
|
||||||
pInfo->CardNumber = gCardIndex;
|
pInfo->CardNumber = gCardIndex;
|
||||||
DEBUG("card number = %d\n", pInfo->CardNumber);
|
DEBUG("card number = %d\n", pInfo->CardNumber);
|
||||||
}
|
} else {
|
||||||
else {
|
printk(KERN_ERR "ft1000: Invalid device name\n");
|
||||||
printk(KERN_ERR "ft1000: Invalid device name\n");
|
|
||||||
ret_val = -ENXIO;
|
ret_val = -ENXIO;
|
||||||
goto err_net;
|
goto err_net;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&pInfo->stats, 0, sizeof(struct net_device_stats) );
|
memset(&pInfo->stats, 0, sizeof(struct net_device_stats));
|
||||||
|
|
||||||
spin_lock_init(&pInfo->dpram_lock);
|
spin_lock_init(&pInfo->dpram_lock);
|
||||||
pInfo->pFt1000Dev = ft1000dev;
|
pInfo->pFt1000Dev = ft1000dev;
|
||||||
pInfo->DrvErrNum = 0;
|
pInfo->DrvErrNum = 0;
|
||||||
pInfo->ASICResetNum = 0;
|
pInfo->ASICResetNum = 0;
|
||||||
pInfo->registered = 1;
|
pInfo->registered = 1;
|
||||||
pInfo->ft1000_reset = ft1000_reset;
|
pInfo->ft1000_reset = ft1000_reset;
|
||||||
pInfo->mediastate = 0;
|
pInfo->mediastate = 0;
|
||||||
pInfo->fifo_cnt = 0;
|
pInfo->fifo_cnt = 0;
|
||||||
pInfo->DeviceCreated = FALSE;
|
pInfo->DeviceCreated = FALSE;
|
||||||
pInfo->CurrentInterruptEnableMask = ISR_DEFAULT_MASK;
|
pInfo->CurrentInterruptEnableMask = ISR_DEFAULT_MASK;
|
||||||
pInfo->InterruptsEnabled = FALSE;
|
pInfo->InterruptsEnabled = FALSE;
|
||||||
pInfo->CardReady = 0;
|
pInfo->CardReady = 0;
|
||||||
pInfo->DSP_TIME[0] = 0;
|
pInfo->DSP_TIME[0] = 0;
|
||||||
pInfo->DSP_TIME[1] = 0;
|
pInfo->DSP_TIME[1] = 0;
|
||||||
pInfo->DSP_TIME[2] = 0;
|
pInfo->DSP_TIME[2] = 0;
|
||||||
pInfo->DSP_TIME[3] = 0;
|
pInfo->DSP_TIME[3] = 0;
|
||||||
pInfo->fAppMsgPend = 0;
|
pInfo->fAppMsgPend = 0;
|
||||||
pInfo->fCondResetPend = 0;
|
pInfo->fCondResetPend = 0;
|
||||||
pInfo->usbboot = 0;
|
pInfo->usbboot = 0;
|
||||||
pInfo->dspalive = 0;
|
pInfo->dspalive = 0;
|
||||||
memset(&pInfo->tempbuf[0], 0, sizeof(pInfo->tempbuf));
|
memset(&pInfo->tempbuf[0], 0, sizeof(pInfo->tempbuf));
|
||||||
|
|
||||||
INIT_LIST_HEAD(&pInfo->prov_list);
|
INIT_LIST_HEAD(&pInfo->prov_list);
|
||||||
|
|
||||||
INIT_LIST_HEAD(&pInfo->nodes.list);
|
INIT_LIST_HEAD(&pInfo->nodes.list);
|
||||||
//mbelian
|
|
||||||
#ifdef HAVE_NET_DEVICE_OPS
|
#ifdef HAVE_NET_DEVICE_OPS
|
||||||
netdev->netdev_ops = &ftnet_ops;
|
netdev->netdev_ops = &ftnet_ops;
|
||||||
#else
|
#else
|
||||||
netdev->hard_start_xmit = &ft1000_start_xmit;
|
netdev->hard_start_xmit = &ft1000_start_xmit;
|
||||||
netdev->get_stats = &ft1000_netdev_stats;
|
netdev->get_stats = &ft1000_netdev_stats;
|
||||||
netdev->open = &ft1000_open;
|
netdev->open = &ft1000_open;
|
||||||
netdev->stop = &ft1000_close;
|
netdev->stop = &ft1000_close;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ft1000dev->net = netdev;
|
ft1000dev->net = netdev;
|
||||||
|
|
||||||
|
DEBUG("Initialize free_buff_lock and freercvpool\n");
|
||||||
|
spin_lock_init(&free_buff_lock);
|
||||||
|
|
||||||
|
/* initialize a list of buffers to be use for queuing
|
||||||
|
* up receive command data
|
||||||
|
*/
|
||||||
|
INIT_LIST_HEAD(&freercvpool);
|
||||||
|
|
||||||
//init free_buff_lock, freercvpool, numofmsgbuf, pdpram_blk
|
/* create list of free buffers */
|
||||||
//only init once per card
|
for (i = 0; i < NUM_OF_FREE_BUFFERS; i++) {
|
||||||
//Jim
|
/* Get memory for DPRAM_DATA link list */
|
||||||
DEBUG("Initialize free_buff_lock and freercvpool\n");
|
|
||||||
spin_lock_init(&free_buff_lock);
|
|
||||||
|
|
||||||
// initialize a list of buffers to be use for queuing up receive command data
|
|
||||||
INIT_LIST_HEAD (&freercvpool);
|
|
||||||
|
|
||||||
// create list of free buffers
|
|
||||||
for (i=0; i<NUM_OF_FREE_BUFFERS; i++) {
|
|
||||||
// Get memory for DPRAM_DATA link list
|
|
||||||
pdpram_blk = kmalloc(sizeof(struct dpram_blk), GFP_KERNEL);
|
pdpram_blk = kmalloc(sizeof(struct dpram_blk), GFP_KERNEL);
|
||||||
if (pdpram_blk == NULL) {
|
if (pdpram_blk == NULL) {
|
||||||
ret_val = -ENOMEM;
|
ret_val = -ENOMEM;
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
// Get a block of memory to store command data
|
/* Get a block of memory to store command data */
|
||||||
pdpram_blk->pbuffer = kmalloc ( MAX_CMD_SQSIZE, GFP_KERNEL );
|
pdpram_blk->pbuffer = kmalloc(MAX_CMD_SQSIZE, GFP_KERNEL);
|
||||||
if (pdpram_blk->pbuffer == NULL) {
|
if (pdpram_blk->pbuffer == NULL) {
|
||||||
ret_val = -ENOMEM;
|
ret_val = -ENOMEM;
|
||||||
kfree(pdpram_blk);
|
kfree(pdpram_blk);
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
// link provisioning data
|
/* link provisioning data */
|
||||||
list_add_tail (&pdpram_blk->list, &freercvpool);
|
list_add_tail(&pdpram_blk->list, &freercvpool);
|
||||||
}
|
}
|
||||||
numofmsgbuf = NUM_OF_FREE_BUFFERS;
|
numofmsgbuf = NUM_OF_FREE_BUFFERS;
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
err_free:
|
err_free:
|
||||||
list_for_each_safe(cur, tmp, &freercvpool) {
|
list_for_each_safe(cur, tmp, &freercvpool) {
|
||||||
pdpram_blk = list_entry(cur, struct dpram_blk, list);
|
pdpram_blk = list_entry(cur, struct dpram_blk, list);
|
||||||
|
@ -844,8 +834,6 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev)
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Function: reg_ft1000_netdev
|
// Function: reg_ft1000_netdev
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue