This patch applies on top of my previous one that removed the whitespace
bloat.
This patch now fixes the type horror in CpqTsGetSFQEntry():
-the destination buffer is now void* instead of ULONG*
-the offset is now done by a int (former ULONG) variable and not
adding bytes to the pointer address
-the last argument is not int, not boolean
-the second argument is compared to ULONG but is USHORT. And one (of two)
callers passes a ULONG casted to USHORT. Use ULONG instead.
-remove some of the comments
-don't use argument names in functions forward declaration: they don't match
the actual names anyway
While I'm at it, I fixed the coding style of this function. The rest of the
file is is still horror, but this no excuse for not fixing this function.
This shrinks the file by another 500 bytes and should not make any difference
in function.
Signed-off-by: Rolf Eike Beer <[email protected]>
--- 2.6.13-rc6/drivers/scsi/cpqfcTScontrol.c 2005-08-09 17:39:49.000000000 +0200
+++ b/drivers/scsi/cpqfcTScontrol.c 2005-08-09 17:49:41.000000000 +0200
@@ -52,8 +52,7 @@
//#define IMQ_DEBUG 1
static void fcParseLinkStatusCounters(TACHYON * fcChip);
-static void CpqTsGetSFQEntry(TACHYON * fcChip,
- USHORT pi, ULONG * buffr, BOOLEAN UpdateChip);
+static void CpqTsGetSFQEntry(TACHYON *, ULONG, void*, int);
static void
cpqfc_free_dma_consistent(CPQFCHBA *cpqfcHBAdata)
@@ -562,12 +561,11 @@ static int PeekIMQEntry( PTACHYON fcChip
TachFCHDR_GCMND* fchs;
#error This is too much stack
ULONG ulFibreFrame[2048/4]; // max DWORDS in incoming FC Frame
- USHORT SFQpi = (USHORT)(fcChip->IMQ->QEntry[CI].word[0] & 0x0fffL);
+ ULONG SFQpi = (fcChip->IMQ->QEntry[CI].word[0] & 0x0fffL);
CpqTsGetSFQEntry( fcChip,
SFQpi, // SFQ producer ndx
- ulFibreFrame, // contiguous dest. buffer
- FALSE); // DON'T update chip--this is a "lookahead"
+ ulFibreFrame, 0); // DON'T update chip--this is a "lookahead"
fchs = (TachFCHDR_GCMND*)&ulFibreFrame;
if( fchs->pl[0] == ELS_LILP_FRAME)
@@ -875,8 +873,8 @@ int CpqTsProcessIMQEntry(void *host)
// clears SFQ entry from Tachyon buffer; copies to contiguous ulBuff
CpqTsGetSFQEntry(
fcChip, // i.e. this Device Object
- (USHORT)fcChip->SFQ->producerIndex, // SFQ producer ndx
- ulFibreFrame, TRUE); // contiguous destination buffer, update chip
+ fcChip->SFQ->producerIndex, // SFQ producer ndx
+ ulFibreFrame, 1); // contiguous destination buffer, update chip
// analyze the incoming frame outside the INT handler...
// (i.e., Worker)
@@ -1739,57 +1737,54 @@ int CpqTsDestroyTachLiteQues( void *pHBA
return iStatus; // non-zero (failed) if any memory not freed
}
-// The SFQ is an array with SFQ_LEN length, each element (QEntry)
-// with eight 32-bit words. TachLite places incoming FC frames (i.e.
-// a valid FC frame with our AL_PA ) in contiguous SFQ entries
-// and sends a completion message telling the host where the frame is
-// in the que.
-// This function copies the current (or oldest not-yet-processed) QEntry to
-// a caller's contiguous buffer and updates the Tachyon chip's consumer index
-//
-// NOTE:
-// An FC frame may consume one or many SFQ entries. We know the total
-// length from the completion message. The caller passes a buffer large
-// enough for the complete message (max 2k).
-
-static void CpqTsGetSFQEntry(
- PTACHYON fcChip,
- USHORT producerNdx,
- ULONG *ulDestPtr, // contiguous destination buffer
- BOOLEAN UpdateChip)
+/**
+ * CpqTsGetSFQEntry
+ * @dest: contiguous destination buffer
+ *
+ *The SFQ is an array with SFQ_LEN length, each element (QEntry)
+ * with eight 32-bit words. TachLite places incoming FC frames (i.e.
+ * a valid FC frame with our AL_PA ) in contiguous SFQ entries
+ * and sends a completion message telling the host where the frame is
+ * in the queue.
+ * This function copies the current (or oldest not-yet-processed) QEntry to
+ * a caller's contiguous buffer and updates the Tachyon chip's consumer index
+ *
+ * NOTE:
+ * An FC frame may consume one or many SFQ entries. We know the total
+ * length from the completion message. The caller passes a buffer large
+ * enough for the complete message (max 2k).
+ */
+static void
+CpqTsGetSFQEntry(PTACHYON fcChip, ULONG producerNdx, void *ulDestPtr,
+ int UpdateChip)
{
- ULONG total_bytes=0;
- ULONG consumerIndex = fcChip->SFQ->consumerIndex;
-
- // check passed copy of SFQ producer index -
- // is a new message waiting for us?
- // equal indexes means SFS is copied
+ int total_bytes = 0;
+ ULONG consumerIndex = fcChip->SFQ->consumerIndex;
- while( producerNdx != consumerIndex )
- { // need to process message
- total_bytes += 64; // maintain count to prevent writing past buffer
- // don't allow copies over Fibre Channel defined length!
- if( total_bytes <= 2048 )
- {
- memcpy(ulDestPtr,
- &fcChip->SFQ->QEntry[consumerIndex],
- 64 ); // each SFQ entry is 64 bytes
- ulDestPtr += 16; // advance pointer to next 64 byte block
- }
- // Tachyon is producing,
- // and we are consuming
-
- if( ++consumerIndex >= SFQ_LEN)// check for rollover
- consumerIndex = 0L; // reset it
- }
+ /* check passed copy of SFQ producer index -
+ * is a new message waiting for us?
+ * equal indexes means SFS is copied */
+
+ while (producerNdx != consumerIndex) {
+ /* need to process message */
+ if(total_bytes < 2048) {
+ memcpy(ulDestPtr + total_bytes,
+ &fcChip->SFQ->QEntry[consumerIndex], 64);
+ }
+ /* each SFQ entry is 64 bytes */
+ total_bytes += 64;
+
+ /* check for rollover */
+ if(++consumerIndex >= SFQ_LEN)
+ consumerIndex = 0;
+ }
- // if specified, update the Tachlite chip ConsumerIndex...
- if( UpdateChip )
- {
- fcChip->SFQ->consumerIndex = consumerIndex;
- writel( fcChip->SFQ->consumerIndex,
- fcChip->Registers.SFQconsumerIndex.address);
- }
+ /* if specified, update the Tachlite chip ConsumerIndex */
+ if(UpdateChip) {
+ fcChip->SFQ->consumerIndex = consumerIndex;
+ writel(fcChip->SFQ->consumerIndex,
+ fcChip->Registers.SFQconsumerIndex.address);
+ }
}
// TachLite routinely freezes it's core ques - Outbound FIFO, Inbound FIFO,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|