[dpdk-dev] [PATCH v2] fix checkpatch errors

2016-01-28 Thread Panu Matilainen
On 01/28/2016 10:38 AM, Xie, Huawei wrote:
> On 1/28/2016 4:06 PM, Thomas Monjalon wrote:
>> 2016-01-28 03:09, Xie, Huawei:
>>> On 1/28/2016 2:17 AM, Thomas Monjalon wrote:
 2016-01-27 01:26, Huawei Xie:
> v2 changes:
>   add missed commit message in v1
>
> fix the error reported by checkpatch:
>   "ERROR: return is not a function, parentheses are not required"
>
> also removed other extra parentheses like:
>   "return val == 0"
>   "return (rte_mempool_lookup(...))"
 How these examples are differents from above checkpatch error?
>>> Don't get it.
>> Me too ;)
>> I don't understand which paren you removed in "return val == 0"
>> and why you say "also removed other...", meaning it is different
>> from the checkpatch error.
>
> Got you. I thought your example means DPDK examples.
> I mean i also removed paren in "return (val == 0)". But checkpatch
> doesn't report "return (logical expression)" as error. I think it is
> also not necessary, so removed some of them. That is why i listed them
> seperately.
>

So perhaps there's a reason checkpatch doesn't report it as an error?
At least I find the parentheses to increase readability in case of 
logical expressions, for example

return val == 0;

return (val == 0);

The parentheses kinda force you to notice there's something special 
going on and its not val that's returned. This "note there's something 
special here" of course only works if parentheses are not sprinkled 
around everywhere.

- Panu -


[dpdk-dev] [PATCH v2] fix checkpatch errors

2016-01-28 Thread Thomas Monjalon
2016-01-28 03:09, Xie, Huawei:
> On 1/28/2016 2:17 AM, Thomas Monjalon wrote:
> > 2016-01-27 01:26, Huawei Xie:
> >> v2 changes:
> >>  add missed commit message in v1
> >>
> >> fix the error reported by checkpatch:
> >>  "ERROR: return is not a function, parentheses are not required"
> >>
> >> also removed other extra parentheses like:
> >>  "return val == 0"
> >>  "return (rte_mempool_lookup(...))"
> > How these examples are differents from above checkpatch error?
> 
> Don't get it.

Me too ;)
I don't understand which paren you removed in "return val == 0"
and why you say "also removed other...", meaning it is different
from the checkpatch error.

> > Please add Fixes: 6307b909b8e0 ("lib: remove extra parenthesis after 
> > return")
> >
> > This is the second run after above commit but I still see a lot of them.
> > Please check git grep 'return *('
> >
> >
> 
> Not a lot of them, just 44 including the document, and all of them are
> "return (logical expressions)", which check patch doesn't report as
> errors, so i chose to ignor them in the previous patch. I can send new
> one which also fixes those code styles.
> Btw, is there any reason using this style?
> return (a*d < b*c)

I think there is no reason. Yes you can remove the parens here.
Thanks


[dpdk-dev] [PATCH v2] fix checkpatch errors

2016-01-28 Thread Xie, Huawei
On 1/28/2016 4:06 PM, Thomas Monjalon wrote:
> 2016-01-28 03:09, Xie, Huawei:
>> On 1/28/2016 2:17 AM, Thomas Monjalon wrote:
>>> 2016-01-27 01:26, Huawei Xie:
 v2 changes:
  add missed commit message in v1

 fix the error reported by checkpatch:
  "ERROR: return is not a function, parentheses are not required"

 also removed other extra parentheses like:
  "return val == 0"
  "return (rte_mempool_lookup(...))"
>>> How these examples are differents from above checkpatch error?
>> Don't get it.
> Me too ;)
> I don't understand which paren you removed in "return val == 0"
> and why you say "also removed other...", meaning it is different
> from the checkpatch error.

Got you. I thought your example means DPDK examples.
I mean i also removed paren in "return (val == 0)". But checkpatch
doesn't report "return (logical expression)" as error. I think it is
also not necessary, so removed some of them. That is why i listed them
seperately.

>>> Please add Fixes: 6307b909b8e0 ("lib: remove extra parenthesis after 
>>> return")
>>>
>>> This is the second run after above commit but I still see a lot of them.
>>> Please check git grep 'return *('
>>>
>>>
>> Not a lot of them, just 44 including the document, and all of them are
>> "return (logical expressions)", which check patch doesn't report as
>> errors, so i chose to ignor them in the previous patch. I can send new
>> one which also fixes those code styles.
>> Btw, is there any reason using this style?
>> return (a*d < b*c)
> I think there is no reason. Yes you can remove the parens here.
> Thanks
>



[dpdk-dev] [PATCH v2] fix checkpatch errors

2016-01-28 Thread Xie, Huawei
On 1/28/2016 2:17 AM, Thomas Monjalon wrote:
> 2016-01-27 01:26, Huawei Xie:
>> v2 changes:
>>  add missed commit message in v1
>>
>> fix the error reported by checkpatch:
>>  "ERROR: return is not a function, parentheses are not required"
>>
>> also removed other extra parentheses like:
>>  "return val == 0"
>>  "return (rte_mempool_lookup(...))"
> How these examples are differents from above checkpatch error?

Don't get it.

>
> Please add Fixes: 6307b909b8e0 ("lib: remove extra parenthesis after return")
>
> This is the second run after above commit but I still see a lot of them.
> Please check git grep 'return *('
>
>

Not a lot of them, just 44 including the document, and all of them are
"return (logical expressions)", which check patch doesn't report as
errors, so i chose to ignor them in the previous patch. I can send new
one which also fixes those code styles.
Btw, is there any reason using this style?
return (a*d < b*c)

This is my grep statement. Checked the error one by one.
grep -P "^\s\s*return\s*\(.*" ./ -r


[dpdk-dev] [PATCH v2] fix checkpatch errors

2016-01-27 Thread Thomas Monjalon
2016-01-27 01:26, Huawei Xie:
> v2 changes:
>  add missed commit message in v1
> 
> fix the error reported by checkpatch:
>  "ERROR: return is not a function, parentheses are not required"
> 
> also removed other extra parentheses like:
>  "return val == 0"
>  "return (rte_mempool_lookup(...))"

How these examples are differents from above checkpatch error?

Please add Fixes: 6307b909b8e0 ("lib: remove extra parenthesis after return")

This is the second run after above commit but I still see a lot of them.
Please check git grep 'return *('



[dpdk-dev] [PATCH v2] fix checkpatch errors

2016-01-27 Thread Huawei Xie
v2 changes:
 add missed commit message in v1

fix the error reported by checkpatch:
 "ERROR: return is not a function, parentheses are not required"

also removed other extra parentheses like:
 "return val == 0"
 "return (rte_mempool_lookup(...))"

Signed-off-by: Huawei Xie 
---
 app/test-pmd/cmdline.c | 12 ++--
 app/test-pmd/config.c  |  2 +-
 app/test-pmd/flowgen.c |  2 +-
 app/test-pmd/mempool_anon.c| 12 ++--
 app/test-pmd/testpmd.h |  2 +-
 app/test-pmd/txonly.c  |  2 +-
 app/test/test_mbuf.c   | 12 ++--
 app/test/test_memcpy_perf.c|  4 +-
 app/test/test_mempool.c|  4 +-
 app/test/test_memzone.c| 24 +++
 app/test/test_red.c| 42 ++--
 app/test/test_ring.c   |  4 +-
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c |  2 +-
 drivers/crypto/qat/qat_qp.c| 22 +++---
 drivers/net/bnx2x/bnx2x.c  | 34 -
 drivers/net/bnx2x/bnx2x.h  |  4 +-
 drivers/net/bnx2x/bnx2x_rxtx.c | 16 ++---
 drivers/net/bnx2x/debug.c  |  6 +-
 drivers/net/bonding/rte_eth_bond_pmd.c |  2 +-
 drivers/net/e1000/em_ethdev.c  | 40 +--
 drivers/net/e1000/em_rxtx.c| 46 ++---
 drivers/net/e1000/igb_ethdev.c | 18 ++---
 drivers/net/e1000/igb_rxtx.c   | 30 
 drivers/net/fm10k/fm10k_ethdev.c   | 40 +--
 drivers/net/i40e/i40e_ethdev.c |  2 +-
 drivers/net/i40e/i40e_ethdev.h |  2 +-
 drivers/net/i40e/i40e_ethdev_vf.c  |  2 +-
 drivers/net/i40e/i40e_rxtx.c   | 14 ++--
 drivers/net/ixgbe/ixgbe_82599_bypass.c |  4 +-
 drivers/net/ixgbe/ixgbe_bypass.c   |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c   | 34 -
 drivers/net/ixgbe/ixgbe_rxtx.c | 36 +-
 drivers/net/mlx5/mlx5_utils.h  |  2 +-
 drivers/net/mpipe/mpipe_tilegx.c   |  4 +-
 drivers/net/nfp/nfp_net.c  | 16 ++---
 drivers/net/virtio/virtio_ethdev.c |  6 +-
 examples/ip_pipeline/cpu_core_map.c|  2 +-
 .../pipeline/pipeline_flow_actions_be.c|  2 +-
 examples/ip_reassembly/main.c  | 22 +++---
 examples/ipv4_multicast/main.c | 14 ++--
 examples/l3fwd/main.c  |  4 +-
 examples/multi_process/symmetric_mp/main.c |  2 +-
 examples/netmap_compat/bridge/bridge.c |  8 +--
 examples/netmap_compat/lib/compat_netmap.c | 80 +++---
 examples/qos_sched/args.c  |  2 +-
 examples/quota_watermark/qw/main.h |  2 +-
 examples/vhost/main.c  |  4 +-
 examples/vhost_xen/main.c  |  2 +-
 examples/vhost_xen/vhost_monitor.c |  6 +-
 lib/librte_acl/acl_run_neon.h  |  2 +-
 lib/librte_cryptodev/rte_cryptodev.c   | 22 +++---
 lib/librte_eal/common/eal_common_memzone.c |  2 +-
 .../common/include/arch/ppc_64/rte_byteorder.h |  2 +-
 lib/librte_eal/common/malloc_heap.c|  2 +-
 lib/librte_eal/linuxapp/eal/eal_xen_memory.c   |  2 +-
 lib/librte_eal/linuxapp/kni/kni_vhost.c|  2 +-
 lib/librte_ether/rte_ether.h   | 10 +--
 lib/librte_hash/rte_cuckoo_hash.c  | 18 ++---
 lib/librte_ip_frag/ip_frag_internal.c  |  4 +-
 lib/librte_lpm/rte_lpm.c   |  2 +-
 lib/librte_mempool/rte_mempool.h   |  2 +-
 lib/librte_ring/rte_ring.h |  6 +-
 lib/librte_sched/rte_bitmap.h  |  6 +-
 lib/librte_sched/rte_red.h |  2 +-
 lib/librte_sched/rte_sched.c   |  4 +-
 65 files changed, 372 insertions(+), 372 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 73298c9..a82682d 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -2418,11 +2418,11 @@ parse_item_list(char* str, const char* item_name, 
unsigned int max_items,
}
if (c != ',') {
printf("character %c is not a decimal digit\n", c);
-   return (0);
+   return 0;
}
if (! value_ok) {
printf("No valid value before comma\n");
-   return (0);
+   return 0;