public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Checkpatch: coding style errors in Nvidia ethernet driver
@ 2014-10-10  8:01 Akshay Sarode
  2014-10-10 15:03 ` Joe Perches
  2014-10-10 18:25 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Akshay Sarode @ 2014-10-10  8:01 UTC (permalink / raw)
  To: John Stultz, netdev, linux-kernel; +Cc: Akshay Sarode

ERROR: "foo* bar" should be "foo *bar"
ERROR: do not initialise statics to 0 or NULL
CHECK: spinlock_t definition without comment
Signed-off-by: Akshay Sarode <akshaysarode21@gmail.com>
---
 drivers/net/ethernet/nvidia/forcedeth.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index f39cae6..dd03d1a 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -748,7 +748,7 @@ struct nv_skb_map {
 
 /* in dev: base, irq */
 struct fe_priv {
-	spinlock_t lock;
+	spinlock_t lock; /* spinlock for SMA lock handling */
 
 	struct net_device *dev;
 	struct napi_struct napi;
@@ -893,6 +893,7 @@ enum {
 	NV_MSI_INT_DISABLED,
 	NV_MSI_INT_ENABLED
 };
+
 static int msi = NV_MSI_INT_ENABLED;
 
 /*
@@ -902,6 +903,7 @@ enum {
 	NV_MSIX_INT_DISABLED,
 	NV_MSIX_INT_ENABLED
 };
+
 static int msix = NV_MSIX_INT_ENABLED;
 
 /*
@@ -911,12 +913,18 @@ enum {
 	NV_DMA_64BIT_DISABLED,
 	NV_DMA_64BIT_ENABLED
 };
+
 static int dma_64bit = NV_DMA_64BIT_ENABLED;
 
 /*
  * Debug output control for tx_timeout
  */
-static bool debug_tx_timeout = false;
+enum {
+	NV_DEBUG_TX_TIMEOUT_DISABLED,
+	NV_DEBUG_TX_TIMEOUT_ENABLED
+};
+
+static bool debug_tx_timeout = NV_DEBUG_TX_TIMEOUT_DISABLED;
 
 /*
  * Crossover Detection
@@ -926,6 +934,7 @@ enum {
 	NV_CROSSOVER_DETECTION_DISABLED,
 	NV_CROSSOVER_DETECTION_ENABLED
 };
+
 static int phy_cross = NV_CROSSOVER_DETECTION_DISABLED;
 
 /*
@@ -4562,7 +4571,8 @@ static int nv_nway_reset(struct net_device *dev)
 	return ret;
 }
 
-static void nv_get_ringparam(struct net_device *dev, struct ethtool_ringparam* ring)
+static void nv_get_ringparam(struct net_device *dev,
+			     struct ethtool_ringparam *ring)
 {
 	struct fe_priv *np = netdev_priv(dev);
 
@@ -4573,7 +4583,8 @@ static void nv_get_ringparam(struct net_device *dev, struct ethtool_ringparam* r
 	ring->tx_pending = np->tx_ring_size;
 }
 
-static int nv_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ring)
+static int nv_set_ringparam(struct net_device *dev,
+			    struct ethtool_ringparam *ring)
 {
 	struct fe_priv *np = netdev_priv(dev);
 	u8 __iomem *base = get_hwbase(dev);
@@ -4685,7 +4696,8 @@ exit:
 	return -ENOMEM;
 }
 
-static void nv_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam* pause)
+static void nv_get_pauseparam(struct net_device *dev,
+			      struct ethtool_pauseparam *pause)
 {
 	struct fe_priv *np = netdev_priv(dev);
 
@@ -4694,7 +4706,8 @@ static void nv_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam*
 	pause->tx_pause = (np->pause_flags & NV_PAUSEFRAME_TX_ENABLE) != 0;
 }
 
-static int nv_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam* pause)
+static int nv_set_pauseparam(struct net_device *dev,
+			     struct ethtool_pauseparam *pause)
 {
 	struct fe_priv *np = netdev_priv(dev);
 	int adv, bmcr;
-- 
1.9.1


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

* Re: [PATCH 1/1] Checkpatch: coding style errors in Nvidia ethernet driver
  2014-10-10  8:01 [PATCH 1/1] Checkpatch: coding style errors in Nvidia ethernet driver Akshay Sarode
@ 2014-10-10 15:03 ` Joe Perches
  2014-10-10 16:45   ` Akshay Sarode
  2014-10-10 18:25 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2014-10-10 15:03 UTC (permalink / raw)
  To: Akshay Sarode; +Cc: John Stultz, netdev, linux-kernel

On Fri, 2014-10-10 at 13:31 +0530, Akshay Sarode wrote:
> ERROR: "foo* bar" should be "foo *bar"
> ERROR: do not initialise statics to 0 or NULL
> CHECK: spinlock_t definition without comment
> Signed-off-by: Akshay Sarode <akshaysarode21@gmail.com>
[]
> diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
[]
> @@ -911,12 +913,18 @@ enum {
[]
>  /*
>   * Debug output control for tx_timeout
>   */
> -static bool debug_tx_timeout = false;
> +enum {
> +	NV_DEBUG_TX_TIMEOUT_DISABLED,
> +	NV_DEBUG_TX_TIMEOUT_ENABLED
> +};
> +
> +static bool debug_tx_timeout = NV_DEBUG_TX_TIMEOUT_DISABLED;

Adding this enum is not useful.


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

* Re: [PATCH 1/1] Checkpatch: coding style errors in Nvidia ethernet driver
  2014-10-10 15:03 ` Joe Perches
@ 2014-10-10 16:45   ` Akshay Sarode
  2014-10-10 17:04     ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Akshay Sarode @ 2014-10-10 16:45 UTC (permalink / raw)
  To: Joe Perches; +Cc: netdev, linux-kernel

On Fri, Oct 10, 2014 at 08:03:07AM -0700, Joe Perches wrote:
> On Fri, 2014-10-10 at 13:31 +0530, Akshay Sarode wrote:
> > ERROR: "foo* bar" should be "foo *bar"
> > ERROR: do not initialise statics to 0 or NULL
> > CHECK: spinlock_t definition without comment
> > Signed-off-by: Akshay Sarode <akshaysarode21@gmail.com>
> []
> > diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
> []
> > @@ -911,12 +913,18 @@ enum {
> []
> >  /*
> >   * Debug output control for tx_timeout
> >   */
> > -static bool debug_tx_timeout = false;
> > +enum {
> > +	NV_DEBUG_TX_TIMEOUT_DISABLED,
> > +	NV_DEBUG_TX_TIMEOUT_ENABLED
> > +};
> > +
> > +static bool debug_tx_timeout = NV_DEBUG_TX_TIMEOUT_DISABLED;
> 
> Adding this enum is not useful.
> 
Sorry, If I may have not checked the code properly. I am a newbie here and I was hoping to start with checking coding styles.
I'll check again. Also there are a whole lot of warnings for line over 80 characters.

Regards,
Akshay 

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

* Re: [PATCH 1/1] Checkpatch: coding style errors in Nvidia ethernet driver
  2014-10-10 16:45   ` Akshay Sarode
@ 2014-10-10 17:04     ` Joe Perches
  0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2014-10-10 17:04 UTC (permalink / raw)
  To: Akshay Sarode; +Cc: netdev, linux-kernel

On Fri, 2014-10-10 at 22:15 +0530, Akshay Sarode wrote:
> On Fri, Oct 10, 2014 at 08:03:07AM -0700, Joe Perches wrote:
> > On Fri, 2014-10-10 at 13:31 +0530, Akshay Sarode wrote:
> > > ERROR: "foo* bar" should be "foo *bar"
> > > ERROR: do not initialise statics to 0 or NULL
> > > CHECK: spinlock_t definition without comment
> > > Signed-off-by: Akshay Sarode <akshaysarode21@gmail.com>
> > []
> > > diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
> > []
> > > @@ -911,12 +913,18 @@ enum {
> > []
> > >  /*
> > >   * Debug output control for tx_timeout
> > >   */
> > > -static bool debug_tx_timeout = false;
> > > +enum {
> > > +	NV_DEBUG_TX_TIMEOUT_DISABLED,
> > > +	NV_DEBUG_TX_TIMEOUT_ENABLED
> > > +};
> > > +
> > > +static bool debug_tx_timeout = NV_DEBUG_TX_TIMEOUT_DISABLED;
> > 
> > Adding this enum is not useful.
> > 
> Sorry, If I may have not checked the code properly. I am a newbie here and I was hoping to start with checking coding styles.

No worries, welcome.

Starting with fixing a coding style defect or three is
just fine to learn how to compile and test the kernel.

But generally it's more useful to find things that make
the code better, more readable, smaller, faster, etc.

Also if you have some functional defect or enhancement
to implement, that's even better still.

> I'll check again.

Using an enum for a bool isn't very sensible.
true/false exist already.

>  Also there are a whole lot of warnings for line over 80 characters.

I wouldn't bother with long line conversions unless
you're doing something else at the same time.

If you want to do them for the practice, please do
them on files in drivers/staging/.


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

* Re: [PATCH 1/1] Checkpatch: coding style errors in Nvidia ethernet driver
  2014-10-10  8:01 [PATCH 1/1] Checkpatch: coding style errors in Nvidia ethernet driver Akshay Sarode
  2014-10-10 15:03 ` Joe Perches
@ 2014-10-10 18:25 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2014-10-10 18:25 UTC (permalink / raw)
  To: akshaysarode21; +Cc: john.stultz, netdev, linux-kernel

From: Akshay Sarode <akshaysarode21@gmail.com>
Date: Fri, 10 Oct 2014 13:31:42 +0530

> ERROR: "foo* bar" should be "foo *bar"
> ERROR: do not initialise statics to 0 or NULL
> CHECK: spinlock_t definition without comment
> Signed-off-by: Akshay Sarode <akshaysarode21@gmail.com>

The Subject "Subsystem: " prefix is meant to refer to what area of
the kernel you are changing.

You aren't making changes to "Checkpatch: " so that isn't an
appropriate prefix.  Someone scanning the commit header lines
won't be able to tell what part of the kernel your change is
touching.

In this case you should use "nvidia: " as your subsystem
prefix.

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

end of thread, other threads:[~2014-10-10 18:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-10  8:01 [PATCH 1/1] Checkpatch: coding style errors in Nvidia ethernet driver Akshay Sarode
2014-10-10 15:03 ` Joe Perches
2014-10-10 16:45   ` Akshay Sarode
2014-10-10 17:04     ` Joe Perches
2014-10-10 18:25 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox