Skip to content

Commit

Permalink
staging: ft1000: Remove PSEUDO_HDR typedef usage.
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Belisko <marek.belisko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Marek Belisko authored and Greg Kroah-Hartman committed Oct 15, 2010
1 parent e27d96d commit b13e39b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 63 deletions.
6 changes: 3 additions & 3 deletions drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
//IOCTL_DPRAM_COMMAND dpram_command;
USHORT qtype;
USHORT msgsz;
PPSEUDO_HDR ppseudo_hdr;
struct pseudo_hdr *ppseudo_hdr;
PUSHORT pmsg;
USHORT total_len;
USHORT app_index;
Expand Down Expand Up @@ -768,7 +768,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
// Need to put sequence number plus new checksum for message
//pmsg = (PUSHORT)&dpram_command.dpram_blk.pseudohdr;
pmsg = (PUSHORT)&dpram_data->pseudohdr;
ppseudo_hdr = (PPSEUDO_HDR)pmsg;
ppseudo_hdr = (struct pseudo_hdr *)pmsg;
total_len = msgsz+2;
if (total_len & 0x1) {
total_len++;
Expand All @@ -785,7 +785,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
//DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum);
}
pmsg++;
ppseudo_hdr = (PPSEUDO_HDR)pmsg;
ppseudo_hdr = (struct pseudo_hdr *)pmsg;
#if 0
ptr = dpram_data;
DEBUG("FT1000:ft1000_ChIoctl: Command Send\n");
Expand Down
14 changes: 7 additions & 7 deletions drivers/staging/ft1000/ft1000-usb/ft1000_download.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ static void put_request_value(struct ft1000_device *ft1000dev, long lvalue)
//---------------------------------------------------------------------------
// Function: hdr_checksum
//
// Parameters: PPSEUDO_HDR pHdr - Pseudo header pointer
// Parameters: struct pseudo_hdr *pHdr - Pseudo header pointer
//
// Returns: checksum - success
//
Expand All @@ -516,7 +516,7 @@ static void put_request_value(struct ft1000_device *ft1000dev, long lvalue)
// Notes:
//
//---------------------------------------------------------------------------
static USHORT hdr_checksum(PPSEUDO_HDR pHdr)
static USHORT hdr_checksum(struct pseudo_hdr *pHdr)
{
USHORT *usPtr = (USHORT *)pHdr;
USHORT chksum;
Expand Down Expand Up @@ -775,7 +775,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe
u16 Status = STATUS_SUCCESS;
UINT uiState;
USHORT handshake;
PPSEUDO_HDR pHdr;
struct pseudo_hdr *pHdr;
USHORT usHdrLength;
long word_length;
USHORT request;
Expand Down Expand Up @@ -1167,7 +1167,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe

case STATE_SECTION_PROV:
DEBUG("FT1000:download:STATE_SECTION_PROV\n");
pHdr = (PPSEUDO_HDR)pUcFile;
pHdr = (struct pseudo_hdr *)pUcFile;

if (pHdr->checksum == hdr_checksum(pHdr))
{
Expand All @@ -1179,16 +1179,16 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe
usHdrLength = ntohs(pHdr->length); /* Byte length for PROV records */

// Get buffer for provisioning data
pbuffer = kmalloc ( (usHdrLength + sizeof(PSEUDO_HDR) ), GFP_ATOMIC );
pbuffer = kmalloc((usHdrLength + sizeof(struct pseudo_hdr)), GFP_ATOMIC);
if (pbuffer) {
memcpy(pbuffer, (void *)pUcFile, (UINT)(usHdrLength + sizeof(PSEUDO_HDR)));
memcpy(pbuffer, (void *)pUcFile, (UINT)(usHdrLength + sizeof(struct pseudo_hdr)));
// link provisioning data
pprov_record = kmalloc(sizeof(struct prov_record), GFP_ATOMIC);
if (pprov_record) {
pprov_record->pprov_data = pbuffer;
list_add_tail (&pprov_record->list, &pft1000info->prov_list);
// Move to next entry if available
pUcFile = (UCHAR *)((unsigned long)pUcFile + (UINT)((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(PSEUDO_HDR));
pUcFile = (UCHAR *)((unsigned long)pUcFile + (UINT)((usHdrLength + 1) & 0xFFFFFFFE) + sizeof(struct pseudo_hdr));
if ( (unsigned long)(pUcFile) - (unsigned long)(pFileStart) >= (unsigned long)FileLength) {
uiState = STATE_DONE_FILE;
}
Expand Down
22 changes: 11 additions & 11 deletions drivers/staging/ft1000/ft1000-usb/ft1000_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,7 @@ static int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len)
}
#endif

count = sizeof (PSEUDO_HDR) + len;
count = sizeof(struct pseudo_hdr) + len;
if(count > MAX_BUF_SIZE)
{
DEBUG("Error:ft1000_copy_down_pkt:Message Size Overflow!\n");
Expand All @@ -1466,7 +1466,7 @@ static int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len)
checksum ^= *pTemp ++;
}
*pTemp++ = checksum;
memcpy (&(pFt1000Dev->tx_buf[sizeof(PSEUDO_HDR)]), packet, len);
memcpy(&(pFt1000Dev->tx_buf[sizeof(struct pseudo_hdr)]), packet, len);

//usb_init_urb(pFt1000Dev->tx_urb); //mbelian

Expand Down Expand Up @@ -1685,7 +1685,7 @@ static int ft1000_copy_up_pkt (struct urb *urb)



memcpy(pbuffer, ft1000dev->rx_buf+sizeof(PSEUDO_HDR), len-sizeof(PSEUDO_HDR));
memcpy(pbuffer, ft1000dev->rx_buf+sizeof(struct pseudo_hdr), len-sizeof(struct pseudo_hdr));

//DEBUG("ft1000_copy_up_pkt: Data passed to Protocol layer\n");
/*for (i=0; i<len+12; i++)
Expand Down Expand Up @@ -1997,7 +1997,7 @@ static int ft1000_dsp_prov(void *arg)
u16 len;
u16 i=0;
struct prov_record *ptr;
PPSEUDO_HDR ppseudo_hdr;
struct pseudo_hdr *ppseudo_hdr;
PUSHORT pmsg;
u16 status;
USHORT TempShortBuf [256];
Expand Down Expand Up @@ -2039,7 +2039,7 @@ static int ft1000_dsp_prov(void *arg)
//len = htons(len);

pmsg = (PUSHORT)ptr->pprov_data;
ppseudo_hdr = (PPSEUDO_HDR)pmsg;
ppseudo_hdr = (struct pseudo_hdr *)pmsg;
// Insert slow queue sequence number
ppseudo_hdr->seq_num = info->squeseqnum++;
ppseudo_hdr->portsrc = 0;
Expand Down Expand Up @@ -2084,7 +2084,7 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
struct dsp_init_msg *pdspinitmsg;
PDRVMSG pdrvmsg;
u16 i;
PPSEUDO_HDR ppseudo_hdr;
struct pseudo_hdr *ppseudo_hdr;
PUSHORT pmsg;
u16 status;
//struct timeval tv; //mbelian
Expand Down Expand Up @@ -2255,7 +2255,7 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
pmsg = (PUSHORT)info->DSPInfoBlk;
*pmsg++ = 0;
*pmsg++ = htons(info->DSPInfoBlklen+20+info->DSPInfoBlklen);
ppseudo_hdr = (PPSEUDO_HDR)(PUSHORT)&info->DSPInfoBlk[2];
ppseudo_hdr = (struct pseudo_hdr *)(PUSHORT)&info->DSPInfoBlk[2];
ppseudo_hdr->length = htons(info->DSPInfoBlklen+4+info->DSPInfoBlklen);
ppseudo_hdr->source = 0x10;
ppseudo_hdr->destination = 0x20;
Expand Down Expand Up @@ -2303,7 +2303,7 @@ static int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) {
// Put message into Slow Queue
// Form Pseudo header
pmsg = (PUSHORT)&tempbuffer[0];
ppseudo_hdr = (PPSEUDO_HDR)pmsg;
ppseudo_hdr = (struct pseudo_hdr *)pmsg;
ppseudo_hdr->length = htons(0x0012);
ppseudo_hdr->source = 0x10;
ppseudo_hdr->destination = 0x20;
Expand Down Expand Up @@ -2377,7 +2377,7 @@ int ft1000_poll(void* dev_id) {
USHORT portid;
u16 nxtph;
PDPRAM_BLK pdpram_blk;
PPSEUDO_HDR ppseudo_hdr;
struct pseudo_hdr *ppseudo_hdr;
unsigned long flags;

//DEBUG("Enter ft1000_poll...\n");
Expand Down Expand Up @@ -2431,7 +2431,7 @@ int ft1000_poll(void* dev_id) {
pdpram_blk = ft1000_get_buffer (&freercvpool);
if (pdpram_blk != NULL) {
if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE, &nxtph) ) {
ppseudo_hdr = (PPSEUDO_HDR)pdpram_blk->pbuffer;
ppseudo_hdr = (struct pseudo_hdr *)pdpram_blk->pbuffer;
// Put message into the appropriate application block
info->app_info[i].nRxMsg++;
spin_lock_irqsave(&free_buff_lock, flags);
Expand Down Expand Up @@ -2461,7 +2461,7 @@ int ft1000_poll(void* dev_id) {
//DEBUG("Memory allocated = 0x%8x\n", (u32)pdpram_blk);
if (pdpram_blk != NULL) {
if ( ft1000_receive_cmd(dev, pdpram_blk->pbuffer, MAX_CMD_SQSIZE, &nxtph) ) {
ppseudo_hdr = (PPSEUDO_HDR)pdpram_blk->pbuffer;
ppseudo_hdr = (struct pseudo_hdr *)pdpram_blk->pbuffer;
// Search for correct application block
for (i=0; i<MAX_NUM_APP; i++) {
if (info->app_info[i].app_id == ppseudo_hdr->portdest) {
Expand Down
7 changes: 3 additions & 4 deletions drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
#define MAX_DNLD_BLKSZ 1024

// Standard Flarion Pseudo header
typedef struct _PSEUDO_HDR
{
struct pseudo_hdr {
unsigned short length; //length of msg body
unsigned char source; //source address (0x10=Host 0x20=DSP)
unsigned char destination; //destination address (refer to source address)
Expand All @@ -57,7 +56,7 @@ typedef struct _PSEUDO_HDR
unsigned char rsvd2; //reserved
unsigned short qos_class; //Quality of Service class (Not applicable on Mobile)
unsigned short checksum; //Psuedo header checksum
} __attribute__ ((packed)) PSEUDO_HDR, *PPSEUDO_HDR;
} __attribute__ ((packed));

typedef struct _IOCTL_GET_VER
{
Expand Down Expand Up @@ -106,7 +105,7 @@ typedef struct _IOCTL_GET_DSP_STAT
typedef struct _IOCTL_DPRAM_BLK
{
unsigned short total_len;
PSEUDO_HDR pseudohdr;
struct pseudo_hdr pseudohdr;
unsigned char buffer[1780];
} __attribute__ ((packed)) IOCTL_DPRAM_BLK, *PIOCTL_DPRAM_BLK;

Expand Down
41 changes: 3 additions & 38 deletions drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@


struct media_msg {
PSEUDO_HDR pseudo;
struct pseudo_hdr pseudo;
u16 type;
u16 length;
u16 state;
Expand All @@ -64,7 +64,7 @@ struct media_msg {
} __attribute__ ((packed));

struct dsp_init_msg {
PSEUDO_HDR pseudo;
struct pseudo_hdr pseudo;
u16 type;
u16 length;
u8 DspVer[DSPVERSZ]; // DSP version number
Expand Down Expand Up @@ -455,43 +455,8 @@ struct prov_record {

#define MAX_BUF_SIZE 4096


#if 0 //Removed by Jim
typedef struct _PSEUDO_HDR

{

unsigned short length;

unsigned char source;

unsigned char destination;

unsigned char portdest;

unsigned char portsrc;

unsigned short sh_str_id;

unsigned char control;

unsigned char rsvd1;

unsigned char seq_num;

unsigned char rsvd2;

unsigned short qos_class;

unsigned short checksum;



} PSEUDO_HDR, *PPSEUDO_HDR;
#endif //end of Jim

typedef struct _DRVMSG {
PSEUDO_HDR pseudo;
struct pseudo_hdr pseudo;
u16 type;
u16 length;
u8 data[0];
Expand Down

0 comments on commit b13e39b

Please sign in to comment.