Commit 9a1261f3 authored by Kelley Nielsen's avatar Kelley Nielsen Committed by Greg Kroah-Hartman

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: default avatarKelley Nielsen <kelleynnn@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f3802bdb
......@@ -1517,11 +1517,10 @@ static int handle_misc_portid(struct ft1000_usb *dev)
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_info *info = netdev_priv(dev->net);
u16 tempword;
int status;
u16 size;
......@@ -1534,31 +1533,25 @@ int ft1000_poll(void* dev_id)
DEBUG("ft1000_poll::ft1000_chkcard: failed\n");
return -1;
}
status = ft1000_read_register (dev, &tempword, FT1000_REG_DOORBELL);
if ( !status )
{
status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL);
if (!status) {
if (tempword & FT1000_DB_DPRAM_RX) {
status = ft1000_read_dpram16(dev, 0x200, (u8 *)&data, 0);
status = ft1000_read_dpram16(dev,
0x200, (u8 *)&data, 0);
size = ntohs(data) + 16 + 2;
if (size % 4) {
modulo = 4 - (size % 4);
size = size + modulo;
}
status = ft1000_read_dpram16(dev, 0x201, (u8 *)&portid, 1);
status = ft1000_read_dpram16(dev, 0x201,
(u8 *)&portid, 1);
portid &= 0xff;
if (size < MAX_CMD_SQSIZE) {
switch (portid)
{
switch (portid) {
case DRIVERID:
DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_DPRAM_RX : portid DRIVERID\n");
status = ft1000_proc_drvmsg (dev, size);
if (status != 0 )
status = ft1000_proc_drvmsg(dev, size);
if (status != 0)
return status;
break;
case DSPBCMSGID:
......@@ -1568,74 +1561,89 @@ int ft1000_poll(void* dev_id)
status = handle_misc_portid(dev);
break;
}
}
else {
} else
DEBUG("FT1000:dpc:Invalid total length for SlowQ = %d\n", size);
}
status = ft1000_write_register (dev, FT1000_DB_DPRAM_RX, FT1000_REG_DOORBELL);
}
else if (tempword & FT1000_DSP_ASIC_RESET) {
// Let's reset the ASIC from the Host side as well
status = ft1000_write_register (dev, ASIC_RESET_BIT, FT1000_REG_RESET);
status = ft1000_read_register (dev, &tempword, FT1000_REG_RESET);
status = ft1000_write_register(dev,
FT1000_DB_DPRAM_RX,
FT1000_REG_DOORBELL);
} else if (tempword & FT1000_DSP_ASIC_RESET) {
/* Let's reset the ASIC from the Host side as well */
status = ft1000_write_register(dev, ASIC_RESET_BIT,
FT1000_REG_RESET);
status = ft1000_read_register(dev, &tempword,
FT1000_REG_RESET);
i = 0;
while (tempword & ASIC_RESET_BIT) {
status = ft1000_read_register (dev, &tempword, FT1000_REG_RESET);
msleep(10);
status = ft1000_read_register(dev, &tempword,
FT1000_REG_RESET);
usleep_range(9000, 11000);
i++;
if (i==100)
if (i == 100)
break;
}
if (i==100) {
if (i == 100) {
DEBUG("Unable to reset ASIC\n");
return 0;
}
msleep(10);
// Program WMARK register
status = ft1000_write_register (dev, 0x600, FT1000_REG_MAG_WATERMARK);
// clear ASIC reset doorbell
status = ft1000_write_register (dev, FT1000_DSP_ASIC_RESET, FT1000_REG_DOORBELL);
msleep(10);
}
else if (tempword & FT1000_ASIC_RESET_REQ) {
usleep_range(9000, 11000);
/* Program WMARK register */
status = ft1000_write_register(dev, 0x600,
FT1000_REG_MAG_WATERMARK);
/* clear ASIC reset doorbell */
status = ft1000_write_register(dev,
FT1000_DSP_ASIC_RESET,
FT1000_REG_DOORBELL);
usleep_range(9000, 11000);
} else if (tempword & FT1000_ASIC_RESET_REQ) {
DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_ASIC_RESET_REQ\n");
// clear ASIC reset request from DSP
status = ft1000_write_register (dev, FT1000_ASIC_RESET_REQ, FT1000_REG_DOORBELL);
status = ft1000_write_register (dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL);
// copy dsp session record from Adapter block
status = ft1000_write_dpram32 (dev, 0, (u8 *)&info->DSPSess.Rec[0], 1024);
// Program WMARK register
status = ft1000_write_register (dev, 0x600, FT1000_REG_MAG_WATERMARK);
// ring doorbell to tell DSP that ASIC is out of reset
status = ft1000_write_register (dev, FT1000_ASIC_RESET_DSP, FT1000_REG_DOORBELL);
}
else if (tempword & FT1000_DB_COND_RESET) {
/* clear ASIC reset request from DSP */
status = ft1000_write_register(dev,
FT1000_ASIC_RESET_REQ,
FT1000_REG_DOORBELL);
status = ft1000_write_register(dev, HOST_INTF_BE,
FT1000_REG_SUP_CTRL);
/* copy dsp session record from Adapter block */
status = ft1000_write_dpram32(dev, 0,
(u8 *)&info->DSPSess.Rec[0], 1024);
status = ft1000_write_register(dev, 0x600,
FT1000_REG_MAG_WATERMARK);
/* ring doorbell to tell DSP that
* ASIC is out of reset
* */
status = ft1000_write_register(dev,
FT1000_ASIC_RESET_DSP,
FT1000_REG_DOORBELL);
} else if (tempword & FT1000_DB_COND_RESET) {
DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n");
if (!dev->fAppMsgPend) {
// Reset ASIC and DSP
status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0, (u8 *)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_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, FT1000_MAG_DSP_TIMER2, (u8 *)&(info->DSP_TIME[2]), FT1000_MAG_DSP_TIMER2_INDX);
status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (u8 *)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX);
/* Reset ASIC and DSP */
status = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER0,
(u8 *)&(info->DSP_TIME[0]),
FT1000_MAG_DSP_TIMER0_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,
FT1000_MAG_DSP_TIMER2,
(u8 *)&(info->DSP_TIME[2]),
FT1000_MAG_DSP_TIMER2_INDX);
status = ft1000_read_dpram16(dev,
FT1000_MAG_DSP_TIMER3,
(u8 *)&(info->DSP_TIME[3]),
FT1000_MAG_DSP_TIMER3_INDX);
info->CardReady = 0;
info->DrvErrNum = DSP_CONDRESET_INFO;
DEBUG("ft1000_hw:DSP conditional reset requested\n");
info->ft1000_reset(dev->net);
}
else {
} else {
dev->fProvComplete = false;
dev->fCondResetPend = true;
}
ft1000_write_register(dev, FT1000_DB_COND_RESET, FT1000_REG_DOORBELL);
ft1000_write_register(dev, FT1000_DB_COND_RESET,
FT1000_REG_DOORBELL);
}
}
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment