* [PATCH v2] Staging: octeon: ethernet-tx: fixed coding style warnings, missing blank lines
@ 2014-10-08 19:18 Roberto Medina
2014-10-08 19:39 ` Paul Gortmaker
0 siblings, 1 reply; 5+ messages in thread
From: Roberto Medina @ 2014-10-08 19:18 UTC (permalink / raw)
To: gregkh
Cc: josh, ebru.akagunduz, aaro.koskinen, ebiederm, paul.gortmaker,
devel, linux-next, Roberto Medina
From: Roberto Medina <robertoxmed@gmail.com>
Fixed coding style warnings due to missing blank lines.
Dubious additions removed.
Signed-off-by: Roberto Medina <robertoxmed@gmail.com>
---
drivers/staging/octeon/ethernet-tx.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
index 4e54d85..b7a7854 100644
--- a/drivers/staging/octeon/ethernet-tx.c
+++ b/drivers/staging/octeon/ethernet-tx.c
@@ -77,6 +77,7 @@ static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0);
static inline int32_t cvm_oct_adjust_skb_to_free(int32_t skb_to_free, int fau)
{
int32_t undo;
+
undo = skb_to_free > 0 ? MAX_SKB_TO_FREE : skb_to_free +
MAX_SKB_TO_FREE;
if (undo > 0)
@@ -89,6 +90,7 @@ static inline int32_t cvm_oct_adjust_skb_to_free(int32_t skb_to_free, int fau)
static void cvm_oct_kick_tx_poll_watchdog(void)
{
union cvmx_ciu_timx ciu_timx;
+
ciu_timx.u64 = 0;
ciu_timx.s.one_shot = 1;
ciu_timx.s.len = cvm_oct_tx_poll_interval;
@@ -118,9 +120,11 @@ static void cvm_oct_free_tx_skbs(struct net_device *dev)
total_freed += skb_to_free;
if (skb_to_free > 0) {
struct sk_buff *to_free_list = NULL;
+
spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
while (skb_to_free > 0) {
struct sk_buff *t;
+
t = __skb_dequeue(&priv->tx_free_list[qos]);
t->next = to_free_list;
to_free_list = t;
@@ -131,6 +135,7 @@ static void cvm_oct_free_tx_skbs(struct net_device *dev)
/* Do the actual freeing outside of the lock. */
while (to_free_list) {
struct sk_buff *t = to_free_list;
+
to_free_list = to_free_list->next;
dev_kfree_skb_any(t);
}
@@ -258,6 +263,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
if (gmx_prt_cfg.s.duplex == 0) {
int add_bytes = 64 - skb->len;
+
if ((skb_tail_pointer(skb) + add_bytes) <=
skb_end_pointer(skb))
memset(__skb_put(skb, add_bytes), 0,
@@ -289,6 +295,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64;
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
struct skb_frag_struct *fs = skb_shinfo(skb)->frags + i;
+
hw_buffer.s.addr = XKPHYS_TO_PHYS(
(u64)(page_address(fs->page.p) +
fs->page_offset));
@@ -495,6 +502,7 @@ skip_xmit:
while (skb_to_free > 0) {
struct sk_buff *t = __skb_dequeue(&priv->tx_free_list[qos]);
+
t->next = to_free_list;
to_free_list = t;
skb_to_free--;
@@ -505,6 +513,7 @@ skip_xmit:
/* Do the actual freeing outside of the lock. */
while (to_free_list) {
struct sk_buff *t = to_free_list;
+
to_free_list = to_free_list->next;
dev_kfree_skb_any(t);
}
@@ -550,6 +559,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
/* Get a work queue entry */
cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
+
if (unlikely(work == NULL)) {
printk_ratelimited("%s: Failed to allocate a work queue entry\n",
dev->name);
@@ -713,6 +723,7 @@ static void cvm_oct_tx_do_cleanup(unsigned long arg)
for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
if (cvm_oct_device[port]) {
struct net_device *dev = cvm_oct_device[port];
+
cvm_oct_free_tx_skbs(dev);
}
}
--
2.1.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Staging: octeon: ethernet-tx: fixed coding style warnings, missing blank lines
2014-10-08 19:18 [PATCH v2] Staging: octeon: ethernet-tx: fixed coding style warnings, missing blank lines Roberto Medina
@ 2014-10-08 19:39 ` Paul Gortmaker
2014-10-08 19:46 ` Roberto Medina
0 siblings, 1 reply; 5+ messages in thread
From: Paul Gortmaker @ 2014-10-08 19:39 UTC (permalink / raw)
To: Roberto Medina, gregkh; +Cc: devel, aaro.koskinen, josh, linux-next, ebiederm
On 14-10-08 03:18 PM, Roberto Medina wrote:
> From: Roberto Medina <robertoxmed@gmail.com>
>
> Fixed coding style warnings due to missing blank lines.
> Dubious additions removed.
>
> Signed-off-by: Roberto Medina <robertoxmed@gmail.com>
>
> ---
> drivers/staging/octeon/ethernet-tx.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
> index 4e54d85..b7a7854 100644
> --- a/drivers/staging/octeon/ethernet-tx.c
> +++ b/drivers/staging/octeon/ethernet-tx.c
> @@ -77,6 +77,7 @@ static DECLARE_TASKLET(cvm_oct_tx_cleanup_tasklet, cvm_oct_tx_do_cleanup, 0);
> static inline int32_t cvm_oct_adjust_skb_to_free(int32_t skb_to_free, int fau)
> {
> int32_t undo;
> +
> undo = skb_to_free > 0 ? MAX_SKB_TO_FREE : skb_to_free +
> MAX_SKB_TO_FREE;
> if (undo > 0)
> @@ -89,6 +90,7 @@ static inline int32_t cvm_oct_adjust_skb_to_free(int32_t skb_to_free, int fau)
> static void cvm_oct_kick_tx_poll_watchdog(void)
> {
> union cvmx_ciu_timx ciu_timx;
> +
> ciu_timx.u64 = 0;
> ciu_timx.s.one_shot = 1;
> ciu_timx.s.len = cvm_oct_tx_poll_interval;
> @@ -118,9 +120,11 @@ static void cvm_oct_free_tx_skbs(struct net_device *dev)
> total_freed += skb_to_free;
> if (skb_to_free > 0) {
> struct sk_buff *to_free_list = NULL;
> +
> spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
> while (skb_to_free > 0) {
> struct sk_buff *t;
> +
> t = __skb_dequeue(&priv->tx_free_list[qos]);
> t->next = to_free_list;
> to_free_list = t;
> @@ -131,6 +135,7 @@ static void cvm_oct_free_tx_skbs(struct net_device *dev)
> /* Do the actual freeing outside of the lock. */
> while (to_free_list) {
> struct sk_buff *t = to_free_list;
> +
> to_free_list = to_free_list->next;
> dev_kfree_skb_any(t);
> }
> @@ -258,6 +263,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
> cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
> if (gmx_prt_cfg.s.duplex == 0) {
> int add_bytes = 64 - skb->len;
> +
> if ((skb_tail_pointer(skb) + add_bytes) <=
> skb_end_pointer(skb))
> memset(__skb_put(skb, add_bytes), 0,
> @@ -289,6 +295,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
> CVM_OCT_SKB_CB(skb)[0] = hw_buffer.u64;
> for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
> struct skb_frag_struct *fs = skb_shinfo(skb)->frags + i;
> +
> hw_buffer.s.addr = XKPHYS_TO_PHYS(
> (u64)(page_address(fs->page.p) +
> fs->page_offset));
> @@ -495,6 +502,7 @@ skip_xmit:
>
> while (skb_to_free > 0) {
> struct sk_buff *t = __skb_dequeue(&priv->tx_free_list[qos]);
> +
> t->next = to_free_list;
> to_free_list = t;
> skb_to_free--;
> @@ -505,6 +513,7 @@ skip_xmit:
> /* Do the actual freeing outside of the lock. */
> while (to_free_list) {
> struct sk_buff *t = to_free_list;
> +
> to_free_list = to_free_list->next;
> dev_kfree_skb_any(t);
> }
> @@ -550,6 +559,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
>
> /* Get a work queue entry */
> cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
> +
> if (unlikely(work == NULL)) {
This one is still bogus.
P.
--
> printk_ratelimited("%s: Failed to allocate a work queue entry\n",
> dev->name);
> @@ -713,6 +723,7 @@ static void cvm_oct_tx_do_cleanup(unsigned long arg)
> for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
> if (cvm_oct_device[port]) {
> struct net_device *dev = cvm_oct_device[port];
> +
> cvm_oct_free_tx_skbs(dev);
> }
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Staging: octeon: ethernet-tx: fixed coding style warnings, missing blank lines
2014-10-08 19:39 ` Paul Gortmaker
@ 2014-10-08 19:46 ` Roberto Medina
2014-10-08 20:52 ` Aaro Koskinen
0 siblings, 1 reply; 5+ messages in thread
From: Roberto Medina @ 2014-10-08 19:46 UTC (permalink / raw)
To: Paul Gortmaker
Cc: gregkh, josh, ebru.akagunduz, aaro.koskinen, ebiederm, devel, linux-next
On 10/08/2014 09:39 PM, Paul Gortmaker wrote:
> On 14-10-08 03:18 PM, Roberto Medina wrote:
>> From: Roberto Medina <robertoxmed@gmail.com>
>>
>> Fixed coding style warnings due to missing blank lines.
>> Dubious additions removed.
>>
>> Signed-off-by: Roberto Medina <robertoxmed@gmail.com>
>>
>> ---
>> @@ -550,6 +559,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)
>>
>> /* Get a work queue entry */
>> cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
>> +
>> if (unlikely(work == NULL)) {
>
> This one is still bogus.
>
> P.
> --
>
Thank you very much for your feedback. I just want to let you know that
I didn't ignore that annotation from the last patch. I actually added
the white line because checkpatch shows a warning there.
WARNING: Missing a blank line after declarations
#553: FILE: drivers/staging/octeon/ethernet-tx.c:553:
+ cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
+ if (unlikely(work == NULL)) {
I don't see why I shouldn't insert a line there.
Cheers,
Roberto Medina
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Staging: octeon: ethernet-tx: fixed coding style warnings, missing blank lines
2014-10-08 19:46 ` Roberto Medina
@ 2014-10-08 20:52 ` Aaro Koskinen
2014-10-08 20:57 ` Paul Gortmaker
0 siblings, 1 reply; 5+ messages in thread
From: Aaro Koskinen @ 2014-10-08 20:52 UTC (permalink / raw)
To: Roberto Medina; +Cc: devel, josh, gregkh, Paul Gortmaker, linux-next, ebiederm
Hi,
On Wed, Oct 08, 2014 at 09:46:55PM +0200, Roberto Medina wrote:
> Thank you very much for your feedback. I just want to let you know that I
> didn't ignore that annotation from the last patch. I actually added the
> white line because checkpatch shows a warning there.
>
> WARNING: Missing a blank line after declarations
> #553: FILE: drivers/staging/octeon/ethernet-tx.c:553:
> + cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
> + if (unlikely(work == NULL)) {
>
> I don't see why I shouldn't insert a line there.
Maybe something like this would be more readable:
void *copy_location;
+ cvmx_wqe_t *work;
/* Get a work queue entry */
- cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
+ work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
if (unlikely(work == NULL)) {
Then declarations would be correctly separated from the code...
A.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Staging: octeon: ethernet-tx: fixed coding style warnings, missing blank lines
2014-10-08 20:52 ` Aaro Koskinen
@ 2014-10-08 20:57 ` Paul Gortmaker
0 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2014-10-08 20:57 UTC (permalink / raw)
To: Aaro Koskinen, Roberto Medina; +Cc: devel, josh, gregkh, linux-next, ebiederm
On 14-10-08 04:52 PM, Aaro Koskinen wrote:
> Hi,
>
> On Wed, Oct 08, 2014 at 09:46:55PM +0200, Roberto Medina wrote:
>> Thank you very much for your feedback. I just want to let you know that I
>> didn't ignore that annotation from the last patch. I actually added the
>> white line because checkpatch shows a warning there.
>>
>> WARNING: Missing a blank line after declarations
>> #553: FILE: drivers/staging/octeon/ethernet-tx.c:553:
>> + cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
>> + if (unlikely(work == NULL)) {
>>
>> I don't see why I shouldn't insert a line there.
>
> Maybe something like this would be more readable:
>
> void *copy_location;
> + cvmx_wqe_t *work;
>
> /* Get a work queue entry */
> - cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
> + work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
> if (unlikely(work == NULL)) {
>
> Then declarations would be correctly separated from the code...
It probably wouldn't hurt -- what I failed to notice when giving
it a quick scan was that it was a clunky typedef in use to create
the variable declaration vs. a sane "struct blah_work *work = ...."
so yes, checkpatch was right in this case.
Paul.
--
>
> A.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-08 20:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-08 19:18 [PATCH v2] Staging: octeon: ethernet-tx: fixed coding style warnings, missing blank lines Roberto Medina
2014-10-08 19:39 ` Paul Gortmaker
2014-10-08 19:46 ` Roberto Medina
2014-10-08 20:52 ` Aaro Koskinen
2014-10-08 20:57 ` Paul Gortmaker
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).