staging: ft1000: Fix coding style in ft1000_proc_drvmsg 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:
Marek Belisko 2011-03-10 11:51:35 +01:00 committed by Greg Kroah-Hartman
parent fc796a6502
commit 6d2b672195

View File

@ -1530,7 +1530,8 @@ static int ft1000_dsp_prov(void *arg)
return STATUS_SUCCESS;
}
static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
static int ft1000_proc_drvmsg(struct ft1000_device *dev, u16 size)
{
struct ft1000_info *info = netdev_priv(dev->net);
u16 msgtype;
u16 tempword;
@ -1546,23 +1547,20 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
u16 wrd;
} convert;
char *cmdbuffer = kmalloc(1600, GFP_KERNEL);
if (!cmdbuffer)
return STATUS_FAILURE;
status = ft1000_read_dpram32(dev, 0x200, cmdbuffer, size);
#ifdef JDEBUG
DEBUG("ft1000_proc_drvmsg:cmdbuffer\n");
for(i = 0; i < size; i+=5)
{
if( (i + 5) < size )
DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", cmdbuffer[i], cmdbuffer[i+1], cmdbuffer[i+2], cmdbuffer[i+3], cmdbuffer[i+4]);
else
{
for (i = 0; i < size; i += 5) {
if ((i + 5) < size)
DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", cmdbuffer[i],
cmdbuffer[i + 1], cmdbuffer[i + 2],
cmdbuffer[i + 3], cmdbuffer[i + 4]);
else {
for (j = i; j < size; j++)
DEBUG("0x%x ", cmdbuffer[j]);
DEBUG("\n");
@ -1574,43 +1572,40 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
msgtype = ntohs(pdrvmsg->type);
DEBUG("ft1000_proc_drvmsg:Command message type = 0x%x\n", msgtype);
switch (msgtype) {
case MEDIA_STATE: {
DEBUG("ft1000_proc_drvmsg:Command message type = MEDIA_STATE");
case MEDIA_STATE:{
DEBUG
("ft1000_proc_drvmsg:Command message type = MEDIA_STATE");
pmediamsg = (struct media_msg *)&cmdbuffer[0];
if (info->ProgConStat != 0xFF) {
if (pmediamsg->state) {
DEBUG("Media is up\n");
if (info->mediastate == 0) {
if ( info->NetDevRegDone )
{
if (info->NetDevRegDone) {
//netif_carrier_on(dev->net);//mbelian
netif_wake_queue(dev->net);
netif_wake_queue(dev->
net);
}
info->mediastate = 1;
/*do_gettimeofday(&tv);
info->ConTm = tv.tv_sec;*/ //mbelian
info->ConTm = tv.tv_sec; *///mbelian
}
}
else {
} else {
DEBUG("Media is down\n");
if (info->mediastate == 1) {
info->mediastate = 0;
if ( info->NetDevRegDone )
{
if (info->NetDevRegDone) {
//netif_carrier_off(dev->net); mbelian
//netif_stop_queue(dev->net);
}
info->ConTm = 0;
}
}
}
else {
} else {
DEBUG("Media is down\n");
if (info->mediastate == 1) {
info->mediastate = 0;
if ( info->NetDevRegDone)
{
if (info->NetDevRegDone) {
//netif_carrier_off(dev->net); //mbelian
//netif_stop_queue(dev->net);
}
@ -1619,16 +1614,23 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
}
break;
}
case DSP_INIT_MSG: {
DEBUG("ft1000_proc_drvmsg:Command message type = DSP_INIT_MSG");
case DSP_INIT_MSG:{
DEBUG
("ft1000_proc_drvmsg:Command message type = DSP_INIT_MSG");
pdspinitmsg = (struct dsp_init_msg *)&cmdbuffer[2];
memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ);
DEBUG("DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n", info->DspVer[0], info->DspVer[1], info->DspVer[2], info->DspVer[3]);
memcpy(info->HwSerNum, pdspinitmsg->HwSerNum, HWSERNUMSZ);
DEBUG("DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n",
info->DspVer[0], info->DspVer[1], info->DspVer[2],
info->DspVer[3]);
memcpy(info->HwSerNum, pdspinitmsg->HwSerNum,
HWSERNUMSZ);
memcpy(info->Sku, pdspinitmsg->Sku, SKUSZ);
memcpy(info->eui64, pdspinitmsg->eui64, EUISZ);
DEBUG("EUI64=%2x.%2x.%2x.%2x.%2x.%2x.%2x.%2x\n", info->eui64[0],info->eui64[1], info->eui64[2], info->eui64[3], info->eui64[4], info->eui64[5],info->eui64[6], info->eui64[7]);
DEBUG("EUI64=%2x.%2x.%2x.%2x.%2x.%2x.%2x.%2x\n",
info->eui64[0], info->eui64[1], info->eui64[2],
info->eui64[3], info->eui64[4], info->eui64[5],
info->eui64[6], info->eui64[7]);
dev->net->dev_addr[0] = info->eui64[0];
dev->net->dev_addr[1] = info->eui64[1];
dev->net->dev_addr[2] = info->eui64[2];
@ -1636,78 +1638,98 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
dev->net->dev_addr[4] = info->eui64[6];
dev->net->dev_addr[5] = info->eui64[7];
if (ntohs(pdspinitmsg->length) == (sizeof(struct dsp_init_msg) - 20)) {
memcpy(info->ProductMode, pdspinitmsg->ProductMode, MODESZ);
memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, CALVERSZ);
memcpy(info->RfCalDate, pdspinitmsg->RfCalDate, CALDATESZ);
DEBUG("RFCalVer = 0x%2x 0x%2x\n", info->RfCalVer[0], info->RfCalVer[1]);
if (ntohs(pdspinitmsg->length) ==
(sizeof(struct dsp_init_msg) - 20)) {
memcpy(info->ProductMode,
pdspinitmsg->ProductMode, MODESZ);
memcpy(info->RfCalVer, pdspinitmsg->RfCalVer,
CALVERSZ);
memcpy(info->RfCalDate, pdspinitmsg->RfCalDate,
CALDATESZ);
DEBUG("RFCalVer = 0x%2x 0x%2x\n",
info->RfCalVer[0], info->RfCalVer[1]);
}
break;
}
case DSP_PROVISION: {
DEBUG("ft1000_proc_drvmsg:Command message type = DSP_PROVISION\n");
case DSP_PROVISION:{
DEBUG
("ft1000_proc_drvmsg:Command message type = DSP_PROVISION\n");
// kick off dspprov routine to start provisioning
// Send provisioning data to DSP
if (list_empty(&info->prov_list) == 0)
{
/* kick off dspprov routine to start provisioning
* Send provisioning data to DSP
*/
if (list_empty(&info->prov_list) == 0) {
info->fProvComplete = 0;
status = ft1000_dsp_prov(dev);
if (status != STATUS_SUCCESS)
goto out;
}
else {
} else {
info->fProvComplete = 1;
status = ft1000_write_register (dev, FT1000_DB_HB, FT1000_REG_DOORBELL);
DEBUG("FT1000:drivermsg:No more DSP provisioning data in dsp image\n");
status =
ft1000_write_register(dev, FT1000_DB_HB,
FT1000_REG_DOORBELL);
DEBUG
("FT1000:drivermsg:No more DSP provisioning data in dsp image\n");
}
DEBUG("ft1000_proc_drvmsg:DSP PROVISION is done\n");
break;
}
case DSP_STORE_INFO: {
DEBUG("ft1000_proc_drvmsg:Command message type = DSP_STORE_INFO");
case DSP_STORE_INFO:{
DEBUG
("ft1000_proc_drvmsg:Command message type = DSP_STORE_INFO");
DEBUG("FT1000:drivermsg:Got DSP_STORE_INFO\n");
tempword = ntohs(pdrvmsg->length);
info->DSPInfoBlklen = tempword;
if (tempword < (MAX_DSP_SESS_REC-4) ) {
pmsg = (u16 *)&pdrvmsg->data[0];
for (i=0; i<((tempword+1)/2); i++) {
DEBUG("FT1000:drivermsg:dsp info data = 0x%x\n", *pmsg);
info->DSPInfoBlk[i+10] = *pmsg++;
if (tempword < (MAX_DSP_SESS_REC - 4)) {
pmsg = (u16 *) &pdrvmsg->data[0];
for (i = 0; i < ((tempword + 1) / 2); i++) {
DEBUG
("FT1000:drivermsg:dsp info data = 0x%x\n",
*pmsg);
info->DSPInfoBlk[i + 10] = *pmsg++;
}
}
else {
} else {
info->DSPInfoBlklen = 0;
}
break;
}
case DSP_GET_INFO: {
case DSP_GET_INFO:{
DEBUG("FT1000:drivermsg:Got DSP_GET_INFO\n");
// copy dsp info block to dsp
/* copy dsp info block to dsp */
info->DrvMsgPend = 1;
// allow any outstanding ioctl to finish
/* allow any outstanding ioctl to finish */
mdelay(10);
status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
status =
ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) {
mdelay(10);
status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
status =
ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) {
mdelay(10);
status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) {
status =
ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX)
break;
}
}
}
// Put message into Slow Queue
// Form Pseudo header
pmsg = (u16 *)info->DSPInfoBlk;
/* Put message into Slow Queue
* Form Pseudo header
*/
pmsg = (u16 *) info->DSPInfoBlk;
*pmsg++ = 0;
*pmsg++ = htons(info->DSPInfoBlklen+20+info->DSPInfoBlklen);
ppseudo_hdr = (struct pseudo_hdr *)(u16 *)&info->DSPInfoBlk[2];
ppseudo_hdr->length = htons(info->DSPInfoBlklen+4+info->DSPInfoBlklen);
*pmsg++ =
htons(info->DSPInfoBlklen + 20 +
info->DSPInfoBlklen);
ppseudo_hdr =
(struct pseudo_hdr *)(u16 *) &info->DSPInfoBlk[2];
ppseudo_hdr->length =
htons(info->DSPInfoBlklen + 4 +
info->DSPInfoBlklen);
ppseudo_hdr->source = 0x10;
ppseudo_hdr->destination = 0x20;
ppseudo_hdr->portdest = 0;
@ -1717,43 +1739,54 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
ppseudo_hdr->rsvd1 = 0;
ppseudo_hdr->rsvd2 = 0;
ppseudo_hdr->qos_class = 0;
// Insert slow queue sequence number
/* Insert slow queue sequence number */
ppseudo_hdr->seq_num = info->squeseqnum++;
// Insert application id
/* Insert application id */
ppseudo_hdr->portsrc = 0;
// Calculate new checksum
/* Calculate new checksum */
ppseudo_hdr->checksum = *pmsg++;
for (i=1; i<7; i++) {
for (i = 1; i < 7; i++)
ppseudo_hdr->checksum ^= *pmsg++;
}
info->DSPInfoBlk[10] = 0x7200;
info->DSPInfoBlk[11] = htons(info->DSPInfoBlklen);
status = ft1000_write_dpram32 (dev, 0, (u8 *)&info->DSPInfoBlk[0], (unsigned short)(info->DSPInfoBlklen+22));
status = ft1000_write_register (dev, FT1000_DB_DPRAM_TX, FT1000_REG_DOORBELL);
status =
ft1000_write_dpram32(dev, 0,
(u8 *) &info->DSPInfoBlk[0],
(unsigned short)(info->
DSPInfoBlklen
+ 22));
status =
ft1000_write_register(dev, FT1000_DB_DPRAM_TX,
FT1000_REG_DOORBELL);
info->DrvMsgPend = 0;
break;
}
case GET_DRV_ERR_RPT_MSG: {
case GET_DRV_ERR_RPT_MSG:{
DEBUG("FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n");
// copy driver error message to dsp
/* copy driver error message to dsp */
info->DrvMsgPend = 1;
// allow any outstanding ioctl to finish
/* allow any outstanding ioctl to finish */
mdelay(10);
status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
status =
ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) {
mdelay(10);
status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX) {
status =
ft1000_read_register(dev, &tempword,
FT1000_REG_DOORBELL);
if (tempword & FT1000_DB_DPRAM_TX)
mdelay(10);
}
}
if ( (tempword & FT1000_DB_DPRAM_TX) == 0) {
// Put message into Slow Queue
// Form Pseudo header
pmsg = (u16 *)&tempbuffer[0];
if ((tempword & FT1000_DB_DPRAM_TX) == 0) {
/* Put message into Slow Queue
* Form Pseudo header
*/
pmsg = (u16 *) &tempbuffer[0];
ppseudo_hdr = (struct pseudo_hdr *)pmsg;
ppseudo_hdr->length = htons(0x0012);
ppseudo_hdr->source = 0x10;
@ -1765,16 +1798,16 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
ppseudo_hdr->rsvd1 = 0;
ppseudo_hdr->rsvd2 = 0;
ppseudo_hdr->qos_class = 0;
// Insert slow queue sequence number
/* Insert slow queue sequence number */
ppseudo_hdr->seq_num = info->squeseqnum++;
// Insert application id
/* Insert application id */
ppseudo_hdr->portsrc = 0;
// Calculate new checksum
/* Calculate new checksum */
ppseudo_hdr->checksum = *pmsg++;
for (i=1; i<7; i++) {
for (i = 1; i < 7; i++)
ppseudo_hdr->checksum ^= *pmsg++;
}
pmsg = (u16 *)&tempbuffer[16];
pmsg = (u16 *) &tempbuffer[16];
*pmsg++ = htons(RSP_DRV_ERR_RPT_MSG);
*pmsg++ = htons(0x000e);
*pmsg++ = htons(info->DSP_TIME[0]);
@ -1789,7 +1822,9 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
*pmsg++ = convert.wrd;
*pmsg++ = htons(info->DrvErrNum);
card_send_command (dev, (unsigned char*)&tempbuffer[0], (u16)(0x0012 + PSEUDOSZ));
card_send_command(dev,
(unsigned char *)&tempbuffer[0],
(u16) (0x0012 + PSEUDOSZ));
info->DrvErrNum = 0;
}
info->DrvMsgPend = 0;
@ -1801,7 +1836,6 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
break;
}
status = STATUS_SUCCESS;
out:
kfree(cmdbuffer);
@ -1809,8 +1843,6 @@ out:
return status;
}
int ft1000_poll(void* dev_id) {
struct ft1000_device *dev = (struct ft1000_device *)dev_id;