staging: ft1000: fix checkpatch issues in ft1000_poll()

The function ft1000_poll(), in ft1000_hw.c, has many miscellaneous
coding style issues, such as improper indentation, C99 comments, use of
msleep(), and lines over 80 characters. Changes all spaces at the start
of lines to the proper number of tabs. Convert C99 comments to standard
/* */ style. Change calls to msleep(10) to usleep_range(9000, 11000).
Break lines over 80 characters, unless they are user visible strings.
Remove space before open paren in function calls. Fix any other issues
that checkpatch finds.

Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Kelley Nielsen 2013-11-06 05:09:30 -08:00 committed by Greg Kroah-Hartman
parent f3802bdb15
commit 9a1261f317
1 changed files with 126 additions and 118 deletions

View File

@ -1517,125 +1517,133 @@ exit_failure:
return -1; return -1;
} }
int ft1000_poll(void* dev_id) int ft1000_poll(void *dev_id)
{ {
struct ft1000_usb *dev = (struct ft1000_usb *)dev_id; struct ft1000_usb *dev = (struct ft1000_usb *)dev_id;
struct ft1000_info *info = netdev_priv(dev->net); struct ft1000_info *info = netdev_priv(dev->net);
u16 tempword;
int status;
u16 size;
int i;
u16 data;
u16 modulo;
u16 portid;
u16 tempword; if (ft1000_chkcard(dev) == FALSE) {
int status; DEBUG("ft1000_poll::ft1000_chkcard: failed\n");
u16 size; return -1;
int i; }
u16 data; status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
u16 modulo; if (!status) {
u16 portid; if (tempword & FT1000_DB_DPRAM_RX) {
status = ft1000_read_dpram16(dev,
if (ft1000_chkcard(dev) == FALSE) { 0x200, (u8 *)&data, 0);
DEBUG("ft1000_poll::ft1000_chkcard: failed\n"); size = ntohs(data) + 16 + 2;
return -1; if (size % 4) {
} modulo = 4 - (size % 4);
size = size + modulo;
status = ft1000_read_register (dev, &tempword, FT1000_REG_DOORBELL); }
status = ft1000_read_dpram16(dev, 0x201,
if ( !status ) (u8 *)&portid, 1);
{ portid &= 0xff;
if (size < MAX_CMD_SQSIZE) {
if (tempword & FT1000_DB_DPRAM_RX) { switch (portid) {
case DRIVERID:
status = ft1000_read_dpram16(dev, 0x200, (u8 *)&data, 0); DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_DPRAM_RX : portid DRIVERID\n");
size = ntohs(data) + 16 + 2; status = ft1000_proc_drvmsg(dev, size);
if (size % 4) { if (status != 0)
modulo = 4 - (size % 4); return status;
size = size + modulo; break;
} case DSPBCMSGID:
status = ft1000_read_dpram16(dev, 0x201, (u8 *)&portid, 1); status = dsp_broadcast_msg_id(dev);
portid &= 0xff; break;
default:
if (size < MAX_CMD_SQSIZE) { status = handle_misc_portid(dev);
switch (portid) break;
{ }
case DRIVERID: } else
DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_DPRAM_RX : portid DRIVERID\n"); DEBUG("FT1000:dpc:Invalid total length for SlowQ = %d\n", size);
status = ft1000_write_register(dev,
status = ft1000_proc_drvmsg (dev, size); FT1000_DB_DPRAM_RX,
if (status != 0 ) FT1000_REG_DOORBELL);
return status; } else if (tempword & FT1000_DSP_ASIC_RESET) {
break; /* Let's reset the ASIC from the Host side as well */
case DSPBCMSGID: status = ft1000_write_register(dev, ASIC_RESET_BIT,
status = dsp_broadcast_msg_id(dev); FT1000_REG_RESET);
break; status = ft1000_read_register(dev, &tempword,
default: FT1000_REG_RESET);
status = handle_misc_portid(dev); i = 0;
break; while (tempword & ASIC_RESET_BIT) {
} status = ft1000_read_register(dev, &tempword,
} FT1000_REG_RESET);
else { usleep_range(9000, 11000);
DEBUG("FT1000:dpc:Invalid total length for SlowQ = %d\n", size); i++;
} if (i == 100)
status = ft1000_write_register (dev, FT1000_DB_DPRAM_RX, FT1000_REG_DOORBELL); break;
} }
else if (tempword & FT1000_DSP_ASIC_RESET) { if (i == 100) {
DEBUG("Unable to reset ASIC\n");
// Let's reset the ASIC from the Host side as well return 0;
status = ft1000_write_register (dev, ASIC_RESET_BIT, FT1000_REG_RESET); }
status = ft1000_read_register (dev, &tempword, FT1000_REG_RESET); usleep_range(9000, 11000);
i = 0; /* Program WMARK register */
while (tempword & ASIC_RESET_BIT) { status = ft1000_write_register(dev, 0x600,
status = ft1000_read_register (dev, &tempword, FT1000_REG_RESET); FT1000_REG_MAG_WATERMARK);
msleep(10); /* clear ASIC reset doorbell */
i++; status = ft1000_write_register(dev,
if (i==100) FT1000_DSP_ASIC_RESET,
break; FT1000_REG_DOORBELL);
} usleep_range(9000, 11000);
if (i==100) { } else if (tempword & FT1000_ASIC_RESET_REQ) {
DEBUG("Unable to reset ASIC\n"); DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_ASIC_RESET_REQ\n");
return 0; /* clear ASIC reset request from DSP */
} status = ft1000_write_register(dev,
msleep(10); FT1000_ASIC_RESET_REQ,
// Program WMARK register FT1000_REG_DOORBELL);
status = ft1000_write_register (dev, 0x600, FT1000_REG_MAG_WATERMARK); status = ft1000_write_register(dev, HOST_INTF_BE,
// clear ASIC reset doorbell FT1000_REG_SUP_CTRL);
status = ft1000_write_register (dev, FT1000_DSP_ASIC_RESET, FT1000_REG_DOORBELL); /* copy dsp session record from Adapter block */
msleep(10); status = ft1000_write_dpram32(dev, 0,
} (u8 *)&info->DSPSess.Rec[0], 1024);
else if (tempword & FT1000_ASIC_RESET_REQ) { status = ft1000_write_register(dev, 0x600,
DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_ASIC_RESET_REQ\n"); FT1000_REG_MAG_WATERMARK);
/* ring doorbell to tell DSP that
// clear ASIC reset request from DSP * ASIC is out of reset
status = ft1000_write_register (dev, FT1000_ASIC_RESET_REQ, FT1000_REG_DOORBELL); * */
status = ft1000_write_register (dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL); status = ft1000_write_register(dev,
// copy dsp session record from Adapter block FT1000_ASIC_RESET_DSP,
status = ft1000_write_dpram32 (dev, 0, (u8 *)&info->DSPSess.Rec[0], 1024); FT1000_REG_DOORBELL);
// Program WMARK register } else if (tempword & FT1000_DB_COND_RESET) {
status = ft1000_write_register (dev, 0x600, FT1000_REG_MAG_WATERMARK); DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n");
// ring doorbell to tell DSP that ASIC is out of reset if (!dev->fAppMsgPend) {
status = ft1000_write_register (dev, FT1000_ASIC_RESET_DSP, FT1000_REG_DOORBELL); /* Reset ASIC and DSP */
} status = ft1000_read_dpram16(dev,
else if (tempword & FT1000_DB_COND_RESET) { FT1000_MAG_DSP_TIMER0,
DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n"); (u8 *)&(info->DSP_TIME[0]),
FT1000_MAG_DSP_TIMER0_INDX);
if (!dev->fAppMsgPend) { status = ft1000_read_dpram16(dev,
// Reset ASIC and DSP FT1000_MAG_DSP_TIMER1,
(u8 *)&(info->DSP_TIME[1]),
status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0, (u8 *)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX); FT1000_MAG_DSP_TIMER1_INDX);
status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1, (u8 *)&(info->DSP_TIME[1]), FT1000_MAG_DSP_TIMER1_INDX); status = ft1000_read_dpram16(dev,
status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2, (u8 *)&(info->DSP_TIME[2]), FT1000_MAG_DSP_TIMER2_INDX); FT1000_MAG_DSP_TIMER2,
status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (u8 *)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX); (u8 *)&(info->DSP_TIME[2]),
info->CardReady = 0; FT1000_MAG_DSP_TIMER2_INDX);
info->DrvErrNum = DSP_CONDRESET_INFO; status = ft1000_read_dpram16(dev,
DEBUG("ft1000_hw:DSP conditional reset requested\n"); FT1000_MAG_DSP_TIMER3,
info->ft1000_reset(dev->net); (u8 *)&(info->DSP_TIME[3]),
} FT1000_MAG_DSP_TIMER3_INDX);
else { info->CardReady = 0;
dev->fProvComplete = false; info->DrvErrNum = DSP_CONDRESET_INFO;
dev->fCondResetPend = true; DEBUG("ft1000_hw:DSP conditional reset requested\n");
} info->ft1000_reset(dev->net);
} else {
ft1000_write_register(dev, FT1000_DB_COND_RESET, FT1000_REG_DOORBELL); dev->fProvComplete = false;
} dev->fCondResetPend = true;
}
} ft1000_write_register(dev, FT1000_DB_COND_RESET,
FT1000_REG_DOORBELL);
return 0; }
}
return 0;
} }