[PATCH] Staging: bcm: Qos: Fix some coding style issues

2013-07-23 Thread Lilis Iskandar
>From a2f8b299baee0e075d548d2bbf77619373035446 Mon Sep 17 00:00:00 2001
From: Lilis Iskandar 
Date: Tue, 23 Jul 2013 17:08:37 +0800
Subject: [PATCH] Staging: bcm: Qos: Fix some coding style issues

Fix some coding style issues.

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/Qos.c | 600 ++
 1 file changed, 285 insertions(+), 315 deletions(-)

diff --git a/drivers/staging/bcm/Qos.c b/drivers/staging/bcm/Qos.c
index 8d142a5..a1fc892 100644
--- a/drivers/staging/bcm/Qos.c
+++ b/drivers/staging/bcm/Qos.c
@@ -4,11 +4,15 @@ This file contains the routines related to Quality of Service.
 */
 #include "headers.h"
 
-static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter,PVOID 
pvEthPayload, struct bcm_eth_packet_info *pstEthCsPktInfo);
-static BOOLEAN EThCSClassifyPkt(struct bcm_mini_adapter *Adapter,struct 
sk_buff* skb, struct bcm_eth_packet_info *pstEthCsPktInfo,struct 
bcm_classifier_rule *pstClassifierRule, B_UINT8 EthCSCupport);
+static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter, PVOID 
pvEthPayload,
+   struct bcm_eth_packet_info *pstEthCsPktInfo);
+static BOOLEAN EThCSClassifyPkt(struct bcm_mini_adapter *Adapter, struct 
sk_buff *skb,
+   struct bcm_eth_packet_info *pstEthCsPktInfo,
+   struct bcm_classifier_rule *pstClassifierRule,
+   B_UINT8 EthCSCupport);
 
 static USHORT  IpVersion4(struct bcm_mini_adapter *Adapter, struct iphdr *iphd,
-  struct bcm_classifier_rule *pstClassifierRule );
+  struct bcm_classifier_rule *pstClassifierRule);
 
 static VOID PruneQueue(struct bcm_mini_adapter *Adapter, INT iIndex);
 
@@ -20,30 +24,31 @@ static VOID PruneQueue(struct bcm_mini_adapter *Adapter, 
INT iIndex);
 *  matches with that of Queue.
 *
 * Parameters  - pstClassifierRule: Pointer to the packet info structure.
-*- ulSrcIP : Source IP address from the packet.
+*- ulSrcIP : Source IP address from the packet.
 *
 * Returns - TRUE(If address matches) else FAIL .
 */
-BOOLEAN MatchSrcIpAddress(struct bcm_classifier_rule *pstClassifierRule,ULONG 
ulSrcIP)
+BOOLEAN MatchSrcIpAddress(struct bcm_classifier_rule *pstClassifierRule, ULONG 
ulSrcIP)
 {
-UCHAR  ucLoopIndex=0;
-
-struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
-
-ulSrcIP=ntohl(ulSrcIP);
-if(0 == pstClassifierRule->ucIPSourceAddressLength)
-   return TRUE;
-for(ucLoopIndex=0; ucLoopIndex < 
(pstClassifierRule->ucIPSourceAddressLength);ucLoopIndex++)
-{
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, 
"Src Ip Address Mask:0x%x PacketIp:0x%x and Classification:0x%x", 
(UINT)pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex], (UINT)ulSrcIP, 
(UINT)pstClassifierRule->stSrcIpAddress.ulIpv6Addr[ucLoopIndex]);
-   if((pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] & 
ulSrcIP)==
-   
(pstClassifierRule->stSrcIpAddress.ulIpv4Addr[ucLoopIndex] & 
pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] ))
-   {
+   UCHAR ucLoopIndex = 0;
+   struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
+
+   ulSrcIP = ntohl(ulSrcIP);
+   if (0 == pstClassifierRule->ucIPSourceAddressLength)
return TRUE;
-   }
-}
-BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Src Ip 
Address Not Matched");
-   return FALSE;
+   for (ucLoopIndex = 0; ucLoopIndex < 
(pstClassifierRule->ucIPSourceAddressLength); ucLoopIndex++) {
+   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL,
+   "Src Ip Address Mask:0x%x PacketIp:0x%x and 
Classification:0x%x",
+   
(UINT)pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex],
+   (UINT)ulSrcIP, 
(UINT)pstClassifierRule->stSrcIpAddress.ulIpv6Addr[ucLoopIndex]);
+   if ((pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] 
& ulSrcIP) ==
+   
(pstClassifierRule->stSrcIpAddress.ulIpv4Addr[ucLoopIndex] & 
pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex]))
+   {
+   return TRUE;
+   }
+   }
+   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Src Ip 
Address Not Matched");
+   return FALSE;
 }
 
 
@@ -60,24 +65,26 @@ BOOLEAN MatchSrcIpAddress(struct bcm_classifier_rule 
*pstClassifierRule,ULONG ul
 */
 BOOLE

Re: [PATCH] Staging: bcm: Qos: Fix some coding style issues

2013-07-23 Thread Lilis Iskandar
Hi Dan,

I have already accepted my fate when I submitted the patch. Though it's
really great that I receive a response so fast :)

Regarding the braces, I thought it would be more readable that way
because of the long code wrapping inside the "if" parameter. I'll fix it
and send the patches again in pieces. Should I send a new mail or reply
to this thread?

Lilis

On Tue, 2013-07-23 at 12:54 +0300, Dan Carpenter wrote:
> Hi hi,
> 
> Welcome first time submitter newbie.  :)  The tradition is to reject
> first time code submissions in the meanest and grumpiest way
> possible.
> 
> On Tue, Jul 23, 2013 at 05:20:29PM +0800, Lilis Iskandar wrote:
> > >From a2f8b299baee0e075d548d2bbf77619373035446 Mon Sep 17 00:00:00 2001
> > From: Lilis Iskandar 
> > Date: Tue, 23 Jul 2013 17:08:37 +0800
> > Subject: [PATCH] Staging: bcm: Qos: Fix some coding style issues
> 
> This header stuff is not needed.  See if you can figure out how to
> get rid of it.
> 
> You are fixing too many kinds of problems at once so the patch is
> impossible to review.  Please break it up into one kind of issue
> per patch.
> 
> > -   if(FALSE == (bClassificationSucceed =
> > +   if (FALSE == (bClassificationSucceed =
> > MatchSrcPort(pstClassifierRule,
> > -   ntohs((iphd->protocol == UDP)?
> > -   xprt_hdr->uhdr.source:xprt_hdr->thdr.source
> > +   ntohs((iphd->protocol == UDP)?
> > +   xprt_hdr->uhdr.source : xprt_hdr->thdr.source
> > +   {
> > break;
> > +   }
> 
> I don't know why you are adding curly braces here but they don't
> belong.  Braces are explained in CodingStyle.
> 
> regards,
> dan carpenter
> 


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: bcm: Qos: Fix some coding style issues

2013-07-23 Thread Lilis Iskandar
Fixed spacing/tabs issues that were found using checkpatch.

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/Qos.c | 538 +++---
 1 file changed, 269 insertions(+), 269 deletions(-)

diff --git a/drivers/staging/bcm/Qos.c b/drivers/staging/bcm/Qos.c
index 8d142a5..2d4a77c 100644
--- a/drivers/staging/bcm/Qos.c
+++ b/drivers/staging/bcm/Qos.c
@@ -4,11 +4,11 @@ This file contains the routines related to Quality of Service.
 */
 #include "headers.h"
 
-static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter,PVOID 
pvEthPayload, struct bcm_eth_packet_info *pstEthCsPktInfo);
-static BOOLEAN EThCSClassifyPkt(struct bcm_mini_adapter *Adapter,struct 
sk_buff* skb, struct bcm_eth_packet_info *pstEthCsPktInfo,struct 
bcm_classifier_rule *pstClassifierRule, B_UINT8 EthCSCupport);
+static void EThCSGetPktInfo(struct bcm_mini_adapter *Adapter, PVOID 
pvEthPayload, struct bcm_eth_packet_info *pstEthCsPktInfo);
+static BOOLEAN EThCSClassifyPkt(struct bcm_mini_adapter *Adapter, struct 
sk_buff* skb, struct bcm_eth_packet_info *pstEthCsPktInfo, struct 
bcm_classifier_rule *pstClassifierRule, B_UINT8 EthCSCupport);
 
 static USHORT  IpVersion4(struct bcm_mini_adapter *Adapter, struct iphdr *iphd,
-  struct bcm_classifier_rule *pstClassifierRule );
+  struct bcm_classifier_rule *pstClassifierRule);
 
 static VOID PruneQueue(struct bcm_mini_adapter *Adapter, INT iIndex);
 
@@ -20,30 +20,30 @@ static VOID PruneQueue(struct bcm_mini_adapter *Adapter, 
INT iIndex);
 *  matches with that of Queue.
 *
 * Parameters  - pstClassifierRule: Pointer to the packet info structure.
-*- ulSrcIP : Source IP address from the packet.
+*  - ulSrcIP   : Source IP address from the packet.
 *
 * Returns - TRUE(If address matches) else FAIL .
 */
-BOOLEAN MatchSrcIpAddress(struct bcm_classifier_rule *pstClassifierRule,ULONG 
ulSrcIP)
+BOOLEAN MatchSrcIpAddress(struct bcm_classifier_rule *pstClassifierRule, ULONG 
ulSrcIP)
 {
-UCHAR  ucLoopIndex=0;
-
-struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
-
-ulSrcIP=ntohl(ulSrcIP);
-if(0 == pstClassifierRule->ucIPSourceAddressLength)
-   return TRUE;
-for(ucLoopIndex=0; ucLoopIndex < 
(pstClassifierRule->ucIPSourceAddressLength);ucLoopIndex++)
-{
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, 
"Src Ip Address Mask:0x%x PacketIp:0x%x and Classification:0x%x", 
(UINT)pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex], (UINT)ulSrcIP, 
(UINT)pstClassifierRule->stSrcIpAddress.ulIpv6Addr[ucLoopIndex]);
-   if((pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] & 
ulSrcIP)==
-   
(pstClassifierRule->stSrcIpAddress.ulIpv4Addr[ucLoopIndex] & 
pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] ))
-   {
-   return TRUE;
-   }
-}
-BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Src Ip 
Address Not Matched");
-   return FALSE;
+   UCHAR ucLoopIndex = 0;
+
+   struct bcm_mini_adapter *Adapter = GET_BCM_ADAPTER(gblpnetdev);
+
+   ulSrcIP = ntohl(ulSrcIP);
+   if (0 == pstClassifierRule->ucIPSourceAddressLength)
+   return TRUE;
+   for (ucLoopIndex = 0; ucLoopIndex < 
(pstClassifierRule->ucIPSourceAddressLength); ucLoopIndex++)
+   {
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, 
"Src Ip Address Mask:0x%x PacketIp:0x%x and Classification:0x%x", 
(UINT)pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex], (UINT)ulSrcIP, 
(UINT)pstClassifierRule->stSrcIpAddress.ulIpv6Addr[ucLoopIndex]);
+   if ((pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex] 
& ulSrcIP) ==
+   
(pstClassifierRule->stSrcIpAddress.ulIpv4Addr[ucLoopIndex] & 
pstClassifierRule->stSrcIpAddress.ulIpv4Mask[ucLoopIndex]))
+   {
+   return TRUE;
+   }
+   }
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV4_DBG, DBG_LVL_ALL, "Src Ip 
Address Not Matched");
+   return FALSE;
 }
 
 
@@ -54,30 +54,30 @@ BOOLEAN MatchSrcIpAddress(struct bcm_classifier_rule 
*pstClassifierRule,ULONG ul
 *  matches with that of Queue.
 *
 * Parameters  - pstClassifierRule: Pointer to the packet info structure.
-*- ulDestIP: Destination IP address from the 
packet.
+*  - ulDestIP: Destination IP address from the packet.
 *
 * Returns - TRUE(If address matches) else FAIL .
 */
-BOOLEAN Ma

Re: [PATCH] Staging: bcm: Qos: Fix some coding style issues

2013-07-23 Thread Lilis Iskandar
On Tue, 2013-07-23 at 09:42 -0700, Joe Perches wrote:
> On Tue, 2013-07-23 at 19:51 +0800, Lilis Iskandar wrote:
> > Fixed spacing/tabs issues that were found using checkpatch.
> 
> Hi Lilis.
> 
> It'd be better to change the email subject to
> "[PATCH v2] etc..." to show that's it's a new
> version of the patch.
> 
> It's also useful to add a note or two like
> "git diff -w shows no differences" and
> "no differences in objects" to make review
> and acceptance a bit easier.
> 
> Good luck with continued cleanups of bcm.
> There's a lot to clean in those files.

Thanks for the advice! I'll keep that in mind for the following patches.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] Staging: bcm: InterfaceIdleMode: Fixed spacing/tabing issues

2013-07-26 Thread Lilis Iskandar
Fixed spacing/tabing issues.

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/InterfaceIdleMode.c | 38
-
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceIdleMode.c
b/drivers/staging/bcm/InterfaceIdleMode.c
index 5347828..0c93048 100644
--- a/drivers/staging/bcm/InterfaceIdleMode.c
+++ b/drivers/staging/bcm/InterfaceIdleMode.c
@@ -52,18 +52,18 @@ int InterfaceIdleModeRespond(struct bcm_mini_adapter
*Adapter, unsigned int *pui
 
if (ntohl(*puiBuffer) == GO_TO_IDLE_MODE_PAYLOAD) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, IDLE_MODE, 
DBG_LVL_ALL, "
Got GO_TO_IDLE_MODE_PAYLOAD(210) Msg Subtype");
-   if (ntohl(*(puiBuffer+1)) == 0 ) {
+   if (ntohl(*(puiBuffer+1)) == 0) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, IDLE_MODE, 
DBG_LVL_ALL,
"Got IDLE MODE WAKE UP Response From F/W");
 
-   status = wrmalt (Adapter, SW_ABORT_IDLEMODE_LOC, 
&uiRegRead,
sizeof(uiRegRead));
+   status = wrmalt(Adapter, SW_ABORT_IDLEMODE_LOC, 
&uiRegRead,
sizeof(uiRegRead));
if (status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, 
"wrm failed while
clearing Idle Mode Reg");
return status;
}
 
if (Adapter->ulPowerSaveMode ==
DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) {
-   uiRegRead = 0x ;
-   status = wrmalt (Adapter, 
DEBUG_INTERRUPT_GENERATOR_REGISTOR,
&uiRegRead, sizeof(uiRegRead));
+   uiRegRead = 0x;
+   status = wrmalt(Adapter, 
DEBUG_INTERRUPT_GENERATOR_REGISTOR,
&uiRegRead, sizeof(uiRegRead));
if (status) {
BCM_DEBUG_PRINT(Adapter, 
DBG_TYPE_PRINTK, 0, 0, "wrm failed while
clearing Idle Mode  Reg");
return status;
@@ -98,11 +98,11 @@ int InterfaceIdleModeRespond(struct bcm_mini_adapter
*Adapter, unsigned int *pui
if (TRUE == Adapter->IdleMode)
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, 
IDLE_MODE, DBG_LVL_ALL,
"Device is already in Idle mode");
-   return status ;
+   return status;
}
 
uiRegRead = 0;
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, IDLE_MODE, 
DBG_LVL_ALL,
"Got Req from F/W to go in IDLE mode \n");
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, IDLE_MODE, 
DBG_LVL_ALL,
"Got Req from F/W to go in IDLE mode\n");
 
if (Adapter->chip_id == BCS220_2 ||
Adapter->chip_id == BCS220_2BC ||
@@ -119,7 +119,7 @@ int InterfaceIdleModeRespond(struct bcm_mini_adapter
*Adapter, unsigned int *pui
 
uiRegRead |= (1<<17);
 
-   status = wrmalt (Adapter, HPM_CONFIG_MSW, 
&uiRegRead,
sizeof(uiRegRead));
+   status = wrmalt(Adapter, HPM_CONFIG_MSW, 
&uiRegRead,
sizeof(uiRegRead));
if (status) {
BCM_DEBUG_PRINT(Adapter, 
DBG_TYPE_PRINTK, 0, 0, "wrm failed while
clearing Idle Mode Reg\n");
return status;
@@ -137,19 +137,19 @@ int InterfaceIdleModeRespond(struct
bcm_mini_adapter *Adapter, unsigned int *pui
 
 static int InterfaceAbortIdlemode(struct bcm_mini_adapter *Adapter,
unsigned int Pattern)
 {
-   int status = STATUS_SUCCESS;
+   int status = STATUS_SUCCESS;
unsigned int value;
-   unsigned int chip_id ;
+   unsigned int chip_id;
unsigned long timeout = 0, itr = 0;
 
-   int lenwritten = 0;
+   int lenwritten = 0;
unsigned char aucAbortPattern[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF};
struct bcm_interface_adapter *psInterfaceAdapter =
Adapter->pvInterfaceAdapter;
 
/* Abort Bus suspend if its already suspended */
if ((TRUE == psInterfaceAdapter->bSuspended) && (TRUE ==
Adapter->bDoSuspend)) {
status = 
usb_autopm_get_interface(psInterfaceAdapter->interface);
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, IDLE_MODE, 
DBG_LVL_ALL,
"Bus got wakeup..Aborting Idle mode... status:%d \n", status);
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, IDLE_MODE, 
DBG_LVL_ALL,
"Bus got wakeup..Aborting Idle mode... status:%d\n", status);
 
}
 
@@ -179,7 +179,7 @@ static int Interfac

[PATCH 2/2] Staging: bcm: InterfaceIdleMode: Fixed brace issues

2013-07-26 Thread Lilis Iskandar
Fixed brace issues

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/InterfaceIdleMode.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceIdleMode.c
b/drivers/staging/bcm/InterfaceIdleMode.c
index 0c93048..4f88dd8 100644
--- a/drivers/staging/bcm/InterfaceIdleMode.c
+++ b/drivers/staging/bcm/InterfaceIdleMode.c
@@ -95,8 +95,7 @@ int InterfaceIdleModeRespond(struct bcm_mini_adapter
*Adapter, unsigned int *pui
wake_up(&Adapter->lowpower_mode_wait_queue);
 
} else {
-   if (TRUE == Adapter->IdleMode)
-   {
+   if (TRUE == Adapter->IdleMode) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, 
IDLE_MODE, DBG_LVL_ALL,
"Device is already in Idle mode");
return status;
}
@@ -168,8 +167,7 @@ static int InterfaceAbortIdlemode(struct
bcm_mini_adapter *Adapter, unsigned int
if (Adapter->ulPowerSaveMode ==
DEVICE_POWERSAVE_MODE_AS_MANUAL_CLOCK_GATING) {
value = 0x8000;
status = wrmalt(Adapter, DEBUG_INTERRUPT_GENERATOR_REGISTOR, 
&value,
sizeof(value));
-   if (status)
-   {
+   if (status) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, IDLE_MODE, 
DBG_LVL_ALL,
"WRM to DEBUG_INTERRUPT_GENERATOR_REGISTOR Register failed");
return status;
}
-- 
1.8.3.1



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/5] Staging: bcm: LeakyBucket: Fixed spacing/tabing issues

2013-07-26 Thread Lilis Iskandar
Fixed spacing/tabing issues

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/LeakyBucket.c | 170 +++---
 1 file changed, 85 insertions(+), 85 deletions(-)

diff --git a/drivers/staging/bcm/LeakyBucket.c 
b/drivers/staging/bcm/LeakyBucket.c
index 877cf0b..ee1d9f6 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -17,30 +17,30 @@
 
 static VOID UpdateTokenCount(register struct bcm_mini_adapter *Adapter)
 {
-   ULONG   liCurrentTime;
-   INT i = 0;
+   ULONG liCurrentTime;
+   INT i = 0;
struct timeval tv;
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
"=>\n");
-   if(NULL == Adapter)
+   if (NULL == Adapter)
{
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS,
DBG_LVL_ALL, "Adapter found NULL!\n");
return;
}
 
do_gettimeofday(&tv);
-   for(i = 0; i < NO_OF_QUEUES; i++)
+   for (i = 0; i < NO_OF_QUEUES; i++)
{
-   if(TRUE == Adapter->PackInfo[i].bValid &&
+   if (TRUE == Adapter->PackInfo[i].bValid &&
(1 == Adapter->PackInfo[i].ucDirection))
{
liCurrentTime = ((tv.tv_sec-

Adapter->PackInfo[i].stLastUpdateTokenAt.tv_sec)*1000 +

(tv.tv_usec-Adapter->PackInfo[i].stLastUpdateTokenAt.tv_usec)/
1000);
-   if(0!=liCurrentTime)
+   if (0 != liCurrentTime)
{
Adapter->PackInfo[i].uiCurrentTokenCount += 
(ULONG)

((Adapter->PackInfo[i].uiMaxAllowedRate) *
@@ -48,7 +48,7 @@ static VOID UpdateTokenCount(register struct bcm_mini_adapter 
*Adapter)

memcpy(&Adapter->PackInfo[i].stLastUpdateTokenAt,
&tv, sizeof(struct timeval));
Adapter->PackInfo[i].liLastUpdateTokenAt = 
liCurrentTime;
-   if((Adapter->PackInfo[i].uiCurrentTokenCount) >=
+   if ((Adapter->PackInfo[i].uiCurrentTokenCount) 
>=
Adapter->PackInfo[i].uiMaxBucketSize)
{

Adapter->PackInfo[i].uiCurrentTokenCount =
@@ -57,7 +57,7 @@ static VOID UpdateTokenCount(register struct bcm_mini_adapter 
*Adapter)
}
}
}
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"<=\n");
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"<=\n");
return;
 
 }
@@ -79,33 +79,33 @@ static VOID UpdateTokenCount(register struct 
bcm_mini_adapter *Adapter)
 ***/
 static ULONG GetSFTokenCount(struct bcm_mini_adapter *Adapter, struct 
bcm_packet_info *psSF)
 {
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"IsPacketAllowedForFlow ===>");
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"IsPacketAllowedForFlow ===>");
/* Validate the parameters */
-   if(NULL == Adapter || (psSF < Adapter->PackInfo &&
+   if (NULL == Adapter || (psSF < Adapter->PackInfo &&
(uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority]))
{
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n", Adapter, 
(psSF-Adapter->PackInfo));
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
DBG_LVL_ALL, "IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n", Adapter, 
(psSF-Adapter->PackInfo));
return 0;
}
 
-   if(FALSE != psSF->bValid && psSF->ucDirection)
+   if (FALSE != psSF->bValid && psSF->ucDirection)
{
-   if(0 != psSF->uiCurrentTokenCount)
+   if (0 != psSF->uiCurrentTokenCount)
{
return psSF->uiCurrentTokenCount;
}
else
{
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, 
DBG_LVL_ALL, "Not enough tokens in queue %zd Available %u\n",
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
DBG_LVL_ALL, "Not enough tokens in queue %zd Available %u\n",
   

[PATCH 2/5] Staging: bcm: LeakyBucket: Fixed brace issues

2013-07-26 Thread Lilis Iskandar
Fixed brace issues

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/LeakyBucket.c | 118 +-
 1 file changed, 39 insertions(+), 79 deletions(-)

diff --git a/drivers/staging/bcm/LeakyBucket.c 
b/drivers/staging/bcm/LeakyBucket.c
index ee1d9f6..52e6e05 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -23,34 +23,29 @@ static VOID UpdateTokenCount(register struct 
bcm_mini_adapter *Adapter)
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
"=>\n");
-   if (NULL == Adapter)
-   {
+   if (NULL == Adapter) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS,
DBG_LVL_ALL, "Adapter found NULL!\n");
return;
}
 
do_gettimeofday(&tv);
-   for (i = 0; i < NO_OF_QUEUES; i++)
-   {
+   for (i = 0; i < NO_OF_QUEUES; i++) {
if (TRUE == Adapter->PackInfo[i].bValid &&
-   (1 == Adapter->PackInfo[i].ucDirection))
-   {
+   (1 == Adapter->PackInfo[i].ucDirection)) {
liCurrentTime = ((tv.tv_sec-

Adapter->PackInfo[i].stLastUpdateTokenAt.tv_sec)*1000 +

(tv.tv_usec-Adapter->PackInfo[i].stLastUpdateTokenAt.tv_usec)/
1000);
-   if (0 != liCurrentTime)
-   {
+   if (0 != liCurrentTime) {
Adapter->PackInfo[i].uiCurrentTokenCount += 
(ULONG)

((Adapter->PackInfo[i].uiMaxAllowedRate) *
((ULONG)((liCurrentTime)))/1000);

memcpy(&Adapter->PackInfo[i].stLastUpdateTokenAt,
&tv, sizeof(struct timeval));
Adapter->PackInfo[i].liLastUpdateTokenAt = 
liCurrentTime;
-   if ((Adapter->PackInfo[i].uiCurrentTokenCount) 
>=
-   Adapter->PackInfo[i].uiMaxBucketSize)
-   {
+   if (Adapter->PackInfo[i].uiCurrentTokenCount >=
+   Adapter->PackInfo[i].uiMaxBucketSize) {

Adapter->PackInfo[i].uiCurrentTokenCount =

Adapter->PackInfo[i].uiMaxBucketSize;
}
@@ -82,27 +77,20 @@ static ULONG GetSFTokenCount(struct bcm_mini_adapter 
*Adapter, struct bcm_packet
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"IsPacketAllowedForFlow ===>");
/* Validate the parameters */
if (NULL == Adapter || (psSF < Adapter->PackInfo &&
-   (uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority]))
-   {
+   (uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority])) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
DBG_LVL_ALL, "IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n", Adapter, 
(psSF-Adapter->PackInfo));
return 0;
}
 
-   if (FALSE != psSF->bValid && psSF->ucDirection)
-   {
-   if (0 != psSF->uiCurrentTokenCount)
-   {
+   if (FALSE != psSF->bValid && psSF->ucDirection) {
+   if (0 != psSF->uiCurrentTokenCount) {
return psSF->uiCurrentTokenCount;
-   }
-   else
-   {
+   } else {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
DBG_LVL_ALL, "Not enough tokens in queue %zd Available %u\n",
psSF-Adapter->PackInfo, 
psSF->uiCurrentTokenCount);
psSF->uiPendedLast = 1;
}
-   }
-   else
-   {
+   } else {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
DBG_LVL_ALL, "IPAFF: Queue %zd not valid\n", psSF-Adapter->PackInfo);
}
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"IsPacketAllowedForFlow <===");
@@ -122,23 +110,19 @@ static INT SendPacketFromQueue(struct bcm_mini_adapter 
*Adapter,/**");
-   if (!Adapter || !Packet || !psSF)
-   {
+   if (!Adapter || !Packet || !psSF) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, SEND_QUEUE, DBG_LVL_ALL, 
"Got NULL Adapter or Packet");
return -EINVAL;
}
 
if (psSF->liDrainCalculated == 0)
-   {
psSF->liDrainCalculated = jiffi

[PATCH 3/5] Staging: bcm: LeakyBucket: Fixed C99 comments

2013-07-26 Thread Lilis Iskandar
Fixed C99 comments

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/LeakyBucket.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/bcm/LeakyBucket.c
b/drivers/staging/bcm/LeakyBucket.c
index 52e6e05..75d77c2e 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -117,7 +117,7 @@ static INT SendPacketFromQueue(struct
bcm_mini_adapter *Adapter,/**liDrainCalculated == 0)
psSF->liDrainCalculated = jiffies;
-   ///send the packet to the fifo..
+   /* send the packet to the fifo.. */
PktLen = Packet->len;
Status = SetupNextSend(Adapter, Packet, psSF->usVCID_Value);
if (Status == 0) {
@@ -151,7 +151,7 @@ static VOID CheckAndSendPacketFromIndex(struct
bcm_mini_adapter *Adapter, struct
 
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "%zd
>", (psSF-Adapter->PackInfo));
-   if ((psSF != &Adapter->PackInfo[HiPriority]) && Adapter->LinkUpStatus
&& atomic_read(&psSF->uiPerSFTxResourceCount)) { //Get data packet
+   if ((psSF != &Adapter->PackInfo[HiPriority]) && Adapter->LinkUpStatus
&& atomic_read(&psSF->uiPerSFTxResourceCount)) { /* Get data packet */
if (!psSF->ucDirection)
return;
 
@@ -159,7 +159,7 @@ static VOID CheckAndSendPacketFromIndex(struct
bcm_mini_adapter *Adapter, struct
if (Adapter->IdleMode || Adapter->bPreparingForLowPowerMode)
return; /* in idle mode */
 
-   // Check for Free Descriptors
+   /* Check for Free Descriptors */
if (atomic_read(&Adapter->CurrNumFreeTxDesc) <=
MINIMUM_PENDING_DESCRIPTORS) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, 
DBG_LVL_ALL, " No
Free Tx Descriptor(%d) is available for Data pkt..",
atomic_read(&Adapter->CurrNumFreeTxDesc));
return;
@@ -193,9 +193,11 @@ static VOID CheckAndSendPacketFromIndex(struct
bcm_mini_adapter *Adapter, struct
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, 
TX_PACKETS, DBG_LVL_ALL, "For
Queue: %zd\n", psSF-Adapter->PackInfo);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, 
TX_PACKETS, DBG_LVL_ALL,
"\nAvailable Tokens = %d required = %d\n",
psSF->uiCurrentTokenCount, iPacketLen);
-   //this part indicates that because of 
non-availability of the
tokens
-   //pkt has not been send out hence setting the 
pending flag
indicating the host to send it out
-   //first next iteration  .
+   /*
+   this part indicates that because of 
non-availability of the tokens
+   pkt has not been send out hence setting the 
pending flag indicating
the host to send it out
+   first next iteration.
+   */
psSF->uiPendedLast = TRUE;
spin_unlock_bh(&psSF->SFQueueLock);
}
@@ -286,7 +288,7 @@ VOID transmit_packets(struct bcm_mini_adapter
*Adapter)
 
while (uiPrevTotalCount > 0 && !Adapter->device_removed) {
exit_flag = TRUE;
-   //second iteration to parse non-pending queues
+   /* second iteration to parse non-pending queues */
for (iIndex = HiPriority; iIndex >= 0; iIndex--) {
if (!uiPrevTotalCount || (TRUE == 
Adapter->device_removed))
break;
-- 
1.8.3.1



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/5] Staging: bcm: LeakyBucket: Fixed code indent issues

2013-07-26 Thread Lilis Iskandar
Fixed code indent issues.

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/LeakyBucket.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/bcm/LeakyBucket.c 
b/drivers/staging/bcm/LeakyBucket.c
index 75d77c2e..fb18ae0 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -187,7 +187,7 @@ static VOID CheckAndSendPacketFromIndex(struct 
bcm_mini_adapter *Adapter, struct
atomic_dec(&Adapter->TotalPacketCount);
spin_unlock_bh(&psSF->SFQueueLock);
 
-   Status = SendPacketFromQueue(Adapter, psSF, 
QueuePacket);
+   Status = SendPacketFromQueue(Adapter, psSF, 
QueuePacket);
psSF->uiPendedLast = FALSE;
} else {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, 
TX_PACKETS, DBG_LVL_ALL, "For Queue: %zd\n", psSF-Adapter->PackInfo);
@@ -230,7 +230,7 @@ static VOID CheckAndSendPacketFromIndex(struct 
bcm_mini_adapter *Adapter, struct
} else {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, 
TX_PACKETS, DBG_LVL_ALL, " Control Pkt is not available, Indexing is 
wrong");
}
-   }
+   }
}
 }
 
@@ -308,7 +308,7 @@ VOID transmit_packets(struct bcm_mini_adapter *Adapter)
break;
}
if (exit_flag == TRUE)
-   break;
+   break;
} /* end of inner while loop */
 
update_per_cid_rx(Adapter);
-- 
1.8.3.1



___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/5] Staging: bcm: LeakyBucket: Fixed a pointer asterisk placement issue

2013-07-26 Thread Lilis Iskandar
Fixed a pointer asterisk placement issue.

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/LeakyBucket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/bcm/LeakyBucket.c 
b/drivers/staging/bcm/LeakyBucket.c
index fb18ae0..bc48616 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -104,7 +104,7 @@ This function despatches packet from the specified queue.
 */
 static INT SendPacketFromQueue(struct bcm_mini_adapter *Adapter,/**http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 4/5] Staging: bcm: LeakyBucket: Fixed code indent issues

2013-07-27 Thread Lilis Iskandar
Fixed code indent issues

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/LeakyBucket.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/bcm/LeakyBucket.c 
b/drivers/staging/bcm/LeakyBucket.c
index 75d77c2e..fb18ae0 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -187,7 +187,7 @@ static VOID CheckAndSendPacketFromIndex(struct 
bcm_mini_adapter *Adapter, struct
atomic_dec(&Adapter->TotalPacketCount);
spin_unlock_bh(&psSF->SFQueueLock);
 
-   Status = SendPacketFromQueue(Adapter, psSF, 
QueuePacket);
+   Status = SendPacketFromQueue(Adapter, psSF, 
QueuePacket);
psSF->uiPendedLast = FALSE;
} else {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, 
TX_PACKETS, DBG_LVL_ALL, "For Queue: %zd\n", psSF-Adapter->PackInfo);
@@ -230,7 +230,7 @@ static VOID CheckAndSendPacketFromIndex(struct 
bcm_mini_adapter *Adapter, struct
} else {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, 
TX_PACKETS, DBG_LVL_ALL, " Control Pkt is not available, Indexing is 
wrong");
}
-   }
+   }
}
 }
 
@@ -308,7 +308,7 @@ VOID transmit_packets(struct bcm_mini_adapter *Adapter)
break;
}
if (exit_flag == TRUE)
-   break;
+   break;
} /* end of inner while loop */
 
update_per_cid_rx(Adapter);
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 1/5] Staging: bcm: LeakyBucket: Fixed spacing/tabing issues

2013-07-27 Thread Lilis Iskandar
Sorry, I'm using git send-email now (previously Evolution). Fingers
crossed there won't be any more formatting issues. I also tested the
patches by emailing them to myself and use git am.

Joe, I don't understand what you mean by mentioning "git diff -w".
Perhaps you can clarify it for me? Sorry :(

Summary:
The series of patches fixes coding style issues. This one fixes
spacing/tabbing issues.

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/LeakyBucket.c | 170 +++---
 1 file changed, 85 insertions(+), 85 deletions(-)

diff --git a/drivers/staging/bcm/LeakyBucket.c 
b/drivers/staging/bcm/LeakyBucket.c
index 877cf0b..ee1d9f6 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -17,30 +17,30 @@
 
 static VOID UpdateTokenCount(register struct bcm_mini_adapter *Adapter)
 {
-   ULONG   liCurrentTime;
-   INT i = 0;
+   ULONG liCurrentTime;
+   INT i = 0;
struct timeval tv;
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
"=>\n");
-   if(NULL == Adapter)
+   if (NULL == Adapter)
{
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS,
DBG_LVL_ALL, "Adapter found NULL!\n");
return;
}
 
do_gettimeofday(&tv);
-   for(i = 0; i < NO_OF_QUEUES; i++)
+   for (i = 0; i < NO_OF_QUEUES; i++)
{
-   if(TRUE == Adapter->PackInfo[i].bValid &&
+   if (TRUE == Adapter->PackInfo[i].bValid &&
(1 == Adapter->PackInfo[i].ucDirection))
{
liCurrentTime = ((tv.tv_sec-

Adapter->PackInfo[i].stLastUpdateTokenAt.tv_sec)*1000 +

(tv.tv_usec-Adapter->PackInfo[i].stLastUpdateTokenAt.tv_usec)/
1000);
-   if(0!=liCurrentTime)
+   if (0 != liCurrentTime)
{
Adapter->PackInfo[i].uiCurrentTokenCount += 
(ULONG)

((Adapter->PackInfo[i].uiMaxAllowedRate) *
@@ -48,7 +48,7 @@ static VOID UpdateTokenCount(register struct bcm_mini_adapter 
*Adapter)

memcpy(&Adapter->PackInfo[i].stLastUpdateTokenAt,
&tv, sizeof(struct timeval));
Adapter->PackInfo[i].liLastUpdateTokenAt = 
liCurrentTime;
-   if((Adapter->PackInfo[i].uiCurrentTokenCount) >=
+   if ((Adapter->PackInfo[i].uiCurrentTokenCount) 
>=
Adapter->PackInfo[i].uiMaxBucketSize)
{

Adapter->PackInfo[i].uiCurrentTokenCount =
@@ -57,7 +57,7 @@ static VOID UpdateTokenCount(register struct bcm_mini_adapter 
*Adapter)
}
}
}
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"<=\n");
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"<=\n");
return;
 
 }
@@ -79,33 +79,33 @@ static VOID UpdateTokenCount(register struct 
bcm_mini_adapter *Adapter)
 ***/
 static ULONG GetSFTokenCount(struct bcm_mini_adapter *Adapter, struct 
bcm_packet_info *psSF)
 {
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"IsPacketAllowedForFlow ===>");
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"IsPacketAllowedForFlow ===>");
/* Validate the parameters */
-   if(NULL == Adapter || (psSF < Adapter->PackInfo &&
+   if (NULL == Adapter || (psSF < Adapter->PackInfo &&
(uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority]))
{
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n", Adapter, 
(psSF-Adapter->PackInfo));
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
DBG_LVL_ALL, "IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n", Adapter, 
(psSF-Adapter->PackInfo));
return 0;
}
 
-   if(FALSE != psSF->bValid && psSF->ucDirection)
+   if (FALSE != psSF->bValid && psSF->ucDirection)
{
-   if(0 != psSF->uiCurrentTokenCount)
+   if (0 != psSF->uiCurrentTokenCount)
{
   

[PATCH v2 2/5] Staging: bcm: LeakyBucket: Fixed brace issues

2013-07-27 Thread Lilis Iskandar
Fixed brace issues

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/LeakyBucket.c | 118 +-
 1 file changed, 39 insertions(+), 79 deletions(-)

diff --git a/drivers/staging/bcm/LeakyBucket.c 
b/drivers/staging/bcm/LeakyBucket.c
index ee1d9f6..52e6e05 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -23,34 +23,29 @@ static VOID UpdateTokenCount(register struct 
bcm_mini_adapter *Adapter)
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
"=>\n");
-   if (NULL == Adapter)
-   {
+   if (NULL == Adapter) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS,
DBG_LVL_ALL, "Adapter found NULL!\n");
return;
}
 
do_gettimeofday(&tv);
-   for (i = 0; i < NO_OF_QUEUES; i++)
-   {
+   for (i = 0; i < NO_OF_QUEUES; i++) {
if (TRUE == Adapter->PackInfo[i].bValid &&
-   (1 == Adapter->PackInfo[i].ucDirection))
-   {
+   (1 == Adapter->PackInfo[i].ucDirection)) {
liCurrentTime = ((tv.tv_sec-

Adapter->PackInfo[i].stLastUpdateTokenAt.tv_sec)*1000 +

(tv.tv_usec-Adapter->PackInfo[i].stLastUpdateTokenAt.tv_usec)/
1000);
-   if (0 != liCurrentTime)
-   {
+   if (0 != liCurrentTime) {
Adapter->PackInfo[i].uiCurrentTokenCount += 
(ULONG)

((Adapter->PackInfo[i].uiMaxAllowedRate) *
((ULONG)((liCurrentTime)))/1000);

memcpy(&Adapter->PackInfo[i].stLastUpdateTokenAt,
&tv, sizeof(struct timeval));
Adapter->PackInfo[i].liLastUpdateTokenAt = 
liCurrentTime;
-   if ((Adapter->PackInfo[i].uiCurrentTokenCount) 
>=
-   Adapter->PackInfo[i].uiMaxBucketSize)
-   {
+   if (Adapter->PackInfo[i].uiCurrentTokenCount >=
+   Adapter->PackInfo[i].uiMaxBucketSize) {

Adapter->PackInfo[i].uiCurrentTokenCount =

Adapter->PackInfo[i].uiMaxBucketSize;
}
@@ -82,27 +77,20 @@ static ULONG GetSFTokenCount(struct bcm_mini_adapter 
*Adapter, struct bcm_packet
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"IsPacketAllowedForFlow ===>");
/* Validate the parameters */
if (NULL == Adapter || (psSF < Adapter->PackInfo &&
-   (uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority]))
-   {
+   (uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority])) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
DBG_LVL_ALL, "IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n", Adapter, 
(psSF-Adapter->PackInfo));
return 0;
}
 
-   if (FALSE != psSF->bValid && psSF->ucDirection)
-   {
-   if (0 != psSF->uiCurrentTokenCount)
-   {
+   if (FALSE != psSF->bValid && psSF->ucDirection) {
+   if (0 != psSF->uiCurrentTokenCount) {
return psSF->uiCurrentTokenCount;
-   }
-   else
-   {
+   } else {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
DBG_LVL_ALL, "Not enough tokens in queue %zd Available %u\n",
psSF-Adapter->PackInfo, 
psSF->uiCurrentTokenCount);
psSF->uiPendedLast = 1;
}
-   }
-   else
-   {
+   } else {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, 
DBG_LVL_ALL, "IPAFF: Queue %zd not valid\n", psSF-Adapter->PackInfo);
}
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, 
"IsPacketAllowedForFlow <===");
@@ -122,23 +110,19 @@ static INT SendPacketFromQueue(struct bcm_mini_adapter 
*Adapter,/**");
-   if (!Adapter || !Packet || !psSF)
-   {
+   if (!Adapter || !Packet || !psSF) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, SEND_QUEUE, DBG_LVL_ALL, 
"Got NULL Adapter or Packet");
return -EINVAL;
}
 
if (psSF->liDrainCalculated == 0)
-   {
psSF->liDrainCalculated = jiffi

[PATCH v2 5/5] Staging: bcm: LeakyBucket: Fixed a pointer asterisk placement issue

2013-07-27 Thread Lilis Iskandar
Fixed a pointer asterisk placement issue

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/LeakyBucket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/bcm/LeakyBucket.c 
b/drivers/staging/bcm/LeakyBucket.c
index fb18ae0..bc48616 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -104,7 +104,7 @@ This function despatches packet from the specified queue.
 */
 static INT SendPacketFromQueue(struct bcm_mini_adapter *Adapter,/**http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 3/5] Staging: bcm: LeakyBucket: Fixed C99 comments

2013-07-27 Thread Lilis Iskandar
Fixed C99 comments

Signed-off-by: Lilis Iskandar 
---
 drivers/staging/bcm/LeakyBucket.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/bcm/LeakyBucket.c 
b/drivers/staging/bcm/LeakyBucket.c
index 52e6e05..75d77c2e 100644
--- a/drivers/staging/bcm/LeakyBucket.c
+++ b/drivers/staging/bcm/LeakyBucket.c
@@ -117,7 +117,7 @@ static INT SendPacketFromQueue(struct bcm_mini_adapter 
*Adapter,/**liDrainCalculated == 0)
psSF->liDrainCalculated = jiffies;
-   ///send the packet to the fifo..
+   /* send the packet to the fifo.. */
PktLen = Packet->len;
Status = SetupNextSend(Adapter, Packet, psSF->usVCID_Value);
if (Status == 0) {
@@ -151,7 +151,7 @@ static VOID CheckAndSendPacketFromIndex(struct 
bcm_mini_adapter *Adapter, struct
 
 
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "%zd 
>", (psSF-Adapter->PackInfo));
-   if ((psSF != &Adapter->PackInfo[HiPriority]) && Adapter->LinkUpStatus 
&& atomic_read(&psSF->uiPerSFTxResourceCount)) { //Get data packet
+   if ((psSF != &Adapter->PackInfo[HiPriority]) && Adapter->LinkUpStatus 
&& atomic_read(&psSF->uiPerSFTxResourceCount)) { /* Get data packet */
if (!psSF->ucDirection)
return;
 
@@ -159,7 +159,7 @@ static VOID CheckAndSendPacketFromIndex(struct 
bcm_mini_adapter *Adapter, struct
if (Adapter->IdleMode || Adapter->bPreparingForLowPowerMode)
return; /* in idle mode */
 
-   // Check for Free Descriptors
+   /* Check for Free Descriptors */
if (atomic_read(&Adapter->CurrNumFreeTxDesc) <= 
MINIMUM_PENDING_DESCRIPTORS) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, 
DBG_LVL_ALL, " No Free Tx Descriptor(%d) is available for Data pkt..", 
atomic_read(&Adapter->CurrNumFreeTxDesc));
return;
@@ -193,9 +193,11 @@ static VOID CheckAndSendPacketFromIndex(struct 
bcm_mini_adapter *Adapter, struct
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, 
TX_PACKETS, DBG_LVL_ALL, "For Queue: %zd\n", psSF-Adapter->PackInfo);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, 
TX_PACKETS, DBG_LVL_ALL, "\nAvailable Tokens = %d required = %d\n",
psSF->uiCurrentTokenCount, iPacketLen);
-   //this part indicates that because of 
non-availability of the tokens
-   //pkt has not been send out hence setting the 
pending flag indicating the host to send it out
-   //first next iteration  .
+   /*
+   this part indicates that because of 
non-availability of the tokens
+   pkt has not been send out hence setting the 
pending flag indicating the host to send it out
+   first next iteration.
+   */
psSF->uiPendedLast = TRUE;
spin_unlock_bh(&psSF->SFQueueLock);
}
@@ -286,7 +288,7 @@ VOID transmit_packets(struct bcm_mini_adapter *Adapter)
 
while (uiPrevTotalCount > 0 && !Adapter->device_removed) {
exit_flag = TRUE;
-   //second iteration to parse non-pending queues
+   /* second iteration to parse non-pending queues */
for (iIndex = HiPriority; iIndex >= 0; iIndex--) {
if (!uiPrevTotalCount || (TRUE == 
Adapter->device_removed))
break;
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel