linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] staging: slicoss: minor changes to clean some code
@ 2016-11-24 19:20 Sergio Paracuellos
  2016-11-24 19:20 ` [PATCH v2 1/2] staging: slicoss: remove not used UPDATE_STATS macro Sergio Paracuellos
  2016-11-24 19:21 ` [PATCH v2 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code Sergio Paracuellos
  0 siblings, 2 replies; 5+ messages in thread
From: Sergio Paracuellos @ 2016-11-24 19:20 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, liodot, charrer

This patchset clean some code in slicoss driver:
* Removes not used macro.
* Remove a macro and just inline code.

Changes in v2:
* Remove inline function into inline code.


Sergio Paracuellos (2):
  staging: slicoss: remove not used UPDATE_STATS macro
  staging: slicoss: remove UPDATE_STATS_GB macro and inline code

 drivers/staging/slicoss/slic.h    | 13 ----------
 drivers/staging/slicoss/slicoss.c | 52 +++++++++++++++++++--------------------
 2 files changed, 25 insertions(+), 40 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] staging: slicoss: remove not used UPDATE_STATS macro
  2016-11-24 19:20 [PATCH v2 0/2] staging: slicoss: minor changes to clean some code Sergio Paracuellos
@ 2016-11-24 19:20 ` Sergio Paracuellos
  2016-11-24 19:21 ` [PATCH v2 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code Sergio Paracuellos
  1 sibling, 0 replies; 5+ messages in thread
From: Sergio Paracuellos @ 2016-11-24 19:20 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, liodot, charrer

This patch remove UPDATE_STATS macro from
header slic.h which is not being used.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/slicoss/slic.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 1f6562c..2c05868 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -548,14 +548,6 @@ static inline void slic_flush_write(struct adapter *adapter)
 	ioread32(adapter->regs + SLIC_REG_HOSTID);
 }
 
-#define UPDATE_STATS(largestat, newstat, oldstat)                        \
-{                                                                        \
-	if ((newstat) < (oldstat))                                       \
-		(largestat) += ((newstat) + (0xFFFFFFFF - oldstat + 1)); \
-	else                                                             \
-		(largestat) += ((newstat) - (oldstat));                  \
-}
-
 #define UPDATE_STATS_GB(largestat, newstat, oldstat)                     \
 {                                                                        \
 	(largestat) += ((newstat) - (oldstat));                          \
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code
  2016-11-24 19:20 [PATCH v2 0/2] staging: slicoss: minor changes to clean some code Sergio Paracuellos
  2016-11-24 19:20 ` [PATCH v2 1/2] staging: slicoss: remove not used UPDATE_STATS macro Sergio Paracuellos
@ 2016-11-24 19:21 ` Sergio Paracuellos
  2016-11-24 19:41   ` Markus Böhme
  1 sibling, 1 reply; 5+ messages in thread
From: Sergio Paracuellos @ 2016-11-24 19:21 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, liodot, charrer

This patch removes UPDATE_STATS_GB macro in slic.h header file
and just inline code. This improve readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/staging/slicoss/slic.h    |  5 ----
 drivers/staging/slicoss/slicoss.c | 52 +++++++++++++++++++--------------------
 2 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index 2c05868..2893bdf 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -548,11 +548,6 @@ static inline void slic_flush_write(struct adapter *adapter)
 	ioread32(adapter->regs + SLIC_REG_HOSTID);
 }
 
-#define UPDATE_STATS_GB(largestat, newstat, oldstat)                     \
-{                                                                        \
-	(largestat) += ((newstat) - (oldstat));                          \
-}
-
 #if BITS_PER_LONG == 64
 #define   SLIC_GET_ADDR_LOW(_addr)  (u32)((u64)(_addr) & \
 	0x00000000FFFFFFFF)
diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index b6ec0a1..ffc7c45 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1014,45 +1014,43 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
 			break;
 		}
 
-		UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs,
-				old->xmit_tcp_segs);
+		stst->tcp.xmit_tcp_segs =
+			stats->xmit_tcp_segs - old->xmit_tcp_segs;
 
-		UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes,
-				old->xmit_tcp_bytes);
+		stst->tcp.xmit_tcp_bytes =
+			stats->xmit_tcp_bytes - old->xmit_tcp_bytes;
 
-		UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs,
-				old->rcv_tcp_segs);
+		stst->tcp.rcv_tcp_segs =
+			stats->rcv_tcp_segs - old->rcv_tcp_segs;
 
-		UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes,
-				old->rcv_tcp_bytes);
+		stst->tcp.rcv_tcp_bytes =
+			stats->rcv_tcp_bytes - old->rcv_tcp_bytes;
 
-		UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes,
-				old->xmit_bytes);
+		stst->iface.xmt_bytes =
+			stats->xmit_bytes - old->xmit_bytes;
 
-		UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts,
-				old->xmit_unicasts);
+		stst->iface.xmt_ucast =
+			stats->xmit_unicasts - old->xmit_unicasts;
 
-		UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes,
-				old->rcv_bytes);
+		stst->iface.rcv_bytes =
+			stats->rcv_bytes - old->rcv_bytes;
 
-		UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts,
-				old->rcv_unicasts);
+		stst->iface.rcv_ucast =
+			stats->rcv_unicasts - old->rcv_unicasts;
 
-		UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions,
-				old->xmit_collisions);
+		stst->iface.xmt_errors =
+			stats->xmit_collisions - old->xmit_collisions;
 
-		UPDATE_STATS_GB(stst->iface.xmt_errors,
-				stats->xmit_excess_collisions,
-				old->xmit_excess_collisions);
+		stst->iface.xmt_errors = stats->xmit_excess_collisions -
+					old->xmit_excess_collisions;
 
-		UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error,
-				old->xmit_other_error);
+		stst->iface.xmt_errors =
+			stats->xmit_other_error - old->xmit_other_error;
 
-		UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error,
-				old->rcv_other_error);
+		stst->iface.rcv_errors =
+			stats->rcv_other_error - old->rcv_other_error;
 
-		UPDATE_STATS_GB(stst->iface.rcv_discards, stats->rcv_drops,
-				old->rcv_drops);
+		stst->iface.rcv_discards = stats->rcv_drops - old->rcv_drops;
 
 		if (stats->rcv_drops > old->rcv_drops)
 			adapter->rcv_drops += (stats->rcv_drops -
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code
  2016-11-24 19:21 ` [PATCH v2 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code Sergio Paracuellos
@ 2016-11-24 19:41   ` Markus Böhme
  2016-11-24 20:35     ` Sergio Paracuellos
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Böhme @ 2016-11-24 19:41 UTC (permalink / raw)
  To: Sergio Paracuellos, gregkh; +Cc: devel, linux-kernel, liodot

On 11/24/2016 08:21 PM, Sergio Paracuellos wrote:
> This patch removes UPDATE_STATS_GB macro in slic.h header file
> and just inline code. This improve readability.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
>  drivers/staging/slicoss/slic.h    |  5 ----
>  drivers/staging/slicoss/slicoss.c | 52 +++++++++++++++++++--------------------
>  2 files changed, 25 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
> index 2c05868..2893bdf 100644
> --- a/drivers/staging/slicoss/slic.h
> +++ b/drivers/staging/slicoss/slic.h
> @@ -548,11 +548,6 @@ static inline void slic_flush_write(struct adapter *adapter)
>  	ioread32(adapter->regs + SLIC_REG_HOSTID);
>  }
>  
> -#define UPDATE_STATS_GB(largestat, newstat, oldstat)                     \
> -{                                                                        \
> -	(largestat) += ((newstat) - (oldstat));                          \
> -}
> -
>  #if BITS_PER_LONG == 64
>  #define   SLIC_GET_ADDR_LOW(_addr)  (u32)((u64)(_addr) & \
>  	0x00000000FFFFFFFF)
> diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
> index b6ec0a1..ffc7c45 100644
> --- a/drivers/staging/slicoss/slicoss.c
> +++ b/drivers/staging/slicoss/slicoss.c
> @@ -1014,45 +1014,43 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
>  			break;
>  		}
>  
> -		UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs,
> -				old->xmit_tcp_segs);
> +		stst->tcp.xmit_tcp_segs =
> +			stats->xmit_tcp_segs - old->xmit_tcp_segs;

Missed this the first time, but the difference should be added to the
value in stst:

		stst->tcp.xmit_tcp_segs +=
			stats->xmit_tcp_segs - old->xmit_tcp_segs;

The same applies to the changes below.

>  
> -		UPDATE_STATS_GB(stst->tcp.xmit_tcp_bytes, stats->xmit_tcp_bytes,
> -				old->xmit_tcp_bytes);
> +		stst->tcp.xmit_tcp_bytes =
> +			stats->xmit_tcp_bytes - old->xmit_tcp_bytes;
>  
> -		UPDATE_STATS_GB(stst->tcp.rcv_tcp_segs, stats->rcv_tcp_segs,
> -				old->rcv_tcp_segs);
> +		stst->tcp.rcv_tcp_segs =
> +			stats->rcv_tcp_segs - old->rcv_tcp_segs;
>  
> -		UPDATE_STATS_GB(stst->tcp.rcv_tcp_bytes, stats->rcv_tcp_bytes,
> -				old->rcv_tcp_bytes);
> +		stst->tcp.rcv_tcp_bytes =
> +			stats->rcv_tcp_bytes - old->rcv_tcp_bytes;
>  
> -		UPDATE_STATS_GB(stst->iface.xmt_bytes, stats->xmit_bytes,
> -				old->xmit_bytes);
> +		stst->iface.xmt_bytes =
> +			stats->xmit_bytes - old->xmit_bytes;
>  
> -		UPDATE_STATS_GB(stst->iface.xmt_ucast, stats->xmit_unicasts,
> -				old->xmit_unicasts);
> +		stst->iface.xmt_ucast =
> +			stats->xmit_unicasts - old->xmit_unicasts;
>  
> -		UPDATE_STATS_GB(stst->iface.rcv_bytes, stats->rcv_bytes,
> -				old->rcv_bytes);
> +		stst->iface.rcv_bytes =
> +			stats->rcv_bytes - old->rcv_bytes;
>  
> -		UPDATE_STATS_GB(stst->iface.rcv_ucast, stats->rcv_unicasts,
> -				old->rcv_unicasts);
> +		stst->iface.rcv_ucast =
> +			stats->rcv_unicasts - old->rcv_unicasts;
>  
> -		UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_collisions,
> -				old->xmit_collisions);
> +		stst->iface.xmt_errors =
> +			stats->xmit_collisions - old->xmit_collisions;
>  
> -		UPDATE_STATS_GB(stst->iface.xmt_errors,
> -				stats->xmit_excess_collisions,
> -				old->xmit_excess_collisions);
> +		stst->iface.xmt_errors = stats->xmit_excess_collisions -
> +					old->xmit_excess_collisions;
>  
> -		UPDATE_STATS_GB(stst->iface.xmt_errors, stats->xmit_other_error,
> -				old->xmit_other_error);
> +		stst->iface.xmt_errors =
> +			stats->xmit_other_error - old->xmit_other_error;
>  
> -		UPDATE_STATS_GB(stst->iface.rcv_errors, stats->rcv_other_error,
> -				old->rcv_other_error);
> +		stst->iface.rcv_errors =
> +			stats->rcv_other_error - old->rcv_other_error;
>  
> -		UPDATE_STATS_GB(stst->iface.rcv_discards, stats->rcv_drops,
> -				old->rcv_drops);
> +		stst->iface.rcv_discards = stats->rcv_drops - old->rcv_drops;
>  
>  		if (stats->rcv_drops > old->rcv_drops)
>  			adapter->rcv_drops += (stats->rcv_drops -
> 

Regards,
Markus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code
  2016-11-24 19:41   ` Markus Böhme
@ 2016-11-24 20:35     ` Sergio Paracuellos
  0 siblings, 0 replies; 5+ messages in thread
From: Sergio Paracuellos @ 2016-11-24 20:35 UTC (permalink / raw)
  To: Markus Böhme; +Cc: Greg KH, devel, linux-kernel, Lior Dotan

On Thu, Nov 24, 2016 at 8:41 PM, Markus Böhme <markus.boehme@mailbox.org> wrote:
> On 11/24/2016 08:21 PM, Sergio Paracuellos wrote:
>> This patch removes UPDATE_STATS_GB macro in slic.h header file
>> and just inline code. This improve readability.
>>
>> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
>> ---
>>  drivers/staging/slicoss/slic.h    |  5 ----
>>  drivers/staging/slicoss/slicoss.c | 52 +++++++++++++++++++--------------------
>>  2 files changed, 25 insertions(+), 32 deletions(-)
>>
>> diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
>> index 2c05868..2893bdf 100644
>> --- a/drivers/staging/slicoss/slic.h
>> +++ b/drivers/staging/slicoss/slic.h
>> @@ -548,11 +548,6 @@ static inline void slic_flush_write(struct adapter *adapter)
>>       ioread32(adapter->regs + SLIC_REG_HOSTID);
>>  }
>>
>> -#define UPDATE_STATS_GB(largestat, newstat, oldstat)                     \
>> -{                                                                        \
>> -     (largestat) += ((newstat) - (oldstat));                          \
>> -}
>> -
>>  #if BITS_PER_LONG == 64
>>  #define   SLIC_GET_ADDR_LOW(_addr)  (u32)((u64)(_addr) & \
>>       0x00000000FFFFFFFF)
>> diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
>> index b6ec0a1..ffc7c45 100644
>> --- a/drivers/staging/slicoss/slicoss.c
>> +++ b/drivers/staging/slicoss/slicoss.c
>> @@ -1014,45 +1014,43 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
>>                       break;
>>               }
>>
>> -             UPDATE_STATS_GB(stst->tcp.xmit_tcp_segs, stats->xmit_tcp_segs,
>> -                             old->xmit_tcp_segs);
>> +             stst->tcp.xmit_tcp_segs =
>> +                     stats->xmit_tcp_segs - old->xmit_tcp_segs;
>
> Missed this the first time, but the difference should be added to the
> value in stst:
>
>                 stst->tcp.xmit_tcp_segs +=
>                         stats->xmit_tcp_segs - old->xmit_tcp_segs;
>
> The same applies to the changes below.

True. I have just sent v3 with these fixed.

Thanks for let me know.

Cheers,
    Sergio Paracuellos

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-24 20:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-24 19:20 [PATCH v2 0/2] staging: slicoss: minor changes to clean some code Sergio Paracuellos
2016-11-24 19:20 ` [PATCH v2 1/2] staging: slicoss: remove not used UPDATE_STATS macro Sergio Paracuellos
2016-11-24 19:21 ` [PATCH v2 2/2] staging: slicoss: remove UPDATE_STATS_GB macro and inline code Sergio Paracuellos
2016-11-24 19:41   ` Markus Böhme
2016-11-24 20:35     ` Sergio Paracuellos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).