All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Christian Riesch <christian.riesch@omicron.at>
Cc: netdev@vger.kernel.org, Oliver Neukum <oneukum@suse.de>,
	Eric Dumazet <edumazet@google.com>,
	Allan Chou <allan@asix.com.tw>, Mark Lord <kernel@teksavvy.com>,
	Grant Grundler <grundler@chromium.org>,
	Ming Lei <tom.leiming@gmail.com>,
	Michael Riesch <michael@riesch.at>
Subject: Re: [PATCH 1/4] asix: Fix checkpatch warnings
Date: Fri, 06 Jul 2012 08:25:34 -0700	[thread overview]
Message-ID: <1341588334.2011.21.camel@joe2Laptop> (raw)
In-Reply-To: <1341574388-7464-2-git-send-email-christian.riesch@omicron.at>

On Fri, 2012-07-06 at 13:33 +0200, Christian Riesch wrote:
>

Hi Christian.  Just some trivial comments for a
trivial cleanup patch.

> diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
> index 3ae80ec..9210f40 100644
> --- a/drivers/net/usb/asix.c
> +++ b/drivers/net/usb/asix.c
> @@ -20,8 +20,8 @@
>   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
>   */
>  
> -// #define	DEBUG			// error path messages, extra info
> -// #define	VERBOSE			// more; success messages
> +/* #define	DEBUG	*/		/* error path messages, extra info */
> +/* #define	VERBOSE	*/		/* more; success messages */

Might as well delete as change the comment style.
It isn't applicable after the patch.

> @@ -253,8 +253,8 @@ static void asix_async_cmd_callback(struct urb *urb)
>  	int status = urb->status;
>  
>  	if (status < 0)
> -		printk(KERN_DEBUG "asix_async_cmd_callback() failed with %d",
> -			status);
> +		pr_debug("asix_async_cmd_callback() failed with %d",
> +			 status);

Probably better with "%s: "..., __func__, ...
Missing a newline too.
There are several other uses of embedded function names
that could be modified.

> @@ -432,7 +433,8 @@ static inline int asix_get_phy_addr(struct usbnet *dev)
>  	netdev_dbg(dev->net, "asix_get_phy_addr()\n");
>  
>  	if (ret < 0) {
> -		netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret);
> +		netdev_err(dev->net, "Error reading PHYID register: %02x\n",
> +			   ret);

80 column zealotry?  If you want, but it's probably past
the time that's really desirable or necessary.

> @@ -575,7 +580,7 @@ static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc)
>  	mutex_lock(&dev->phy_mutex);
>  	asix_set_sw_mii(dev);
>  	asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
> -				(__u16)loc, 2, &res);
> +		      (__u16)loc, 2, &res);

Fits on 1 line.

> +static void asix_get_drvinfo(struct net_device *net,
> +			     struct ethtool_drvinfo *info)
>  {
>  	struct usbnet *dev = netdev_priv(net);
>  	struct asix_data *data = (struct asix_data *)&dev->data;
>  
>  	/* Inherit standard device info */
>  	usbnet_get_drvinfo(net, info);
> -	strncpy (info->driver, DRIVER_NAME, sizeof info->driver);
> -	strncpy (info->version, DRIVER_VERSION, sizeof info->version);
> +	strncpy(info->driver, DRIVER_NAME, sizeof info->driver);
> +	strncpy(info->version, DRIVER_VERSION, sizeof info->version);

Most every kernel use of sizeof uses parens like:

	strncpy(info->driver, DRIVER_NAME, sizeof(info->driver));
	strncpy(info->version, DRIVER_VERSION, sizeof(info->version));
 
@@ -1510,133 +1520,133 @@ static const struct driver_info ax88178_info = {
>  	.tx_fixup = asix_tx_fixup,
>  };
>  
> -static const struct usb_device_id	products [] = {
> +static const struct usb_device_id	products[] = {

Maybe use a space not a tab after usb_device_id.

>  {
> -	// Linksys USB200M
> -	USB_DEVICE (0x077b, 0x2226),
> +	/* Linksys USB200M */
> +	USB_DEVICE(0x077b, 0x2226),
>  	.driver_info =	(unsigned long) &ax8817x_info,
>  }, {

I think all of these would look more reasonable on single
lines like

	{ USB_DEVICE(0xxxxx, 0xxxxx), .driver_info = (unsigned long)&func },

or maybe add another macro like:

#define ASIX_USB_DEVICE(vendor, product, driver)	\
	USB_DEVICE(vendor, product), .driver_info = (unsigned long)driver)

and make these

	{ ASIX_USB_DEVICE(0xxxxx, 0xxxxx, &func) },	/* description */

Come to think of it, the & for the function address
isn't necessary either.

cheers, Joe

  parent reply	other threads:[~2012-07-06 15:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-06 11:33 [PATCH 0/4] Add a driver for the ASIX AX88172A Christian Riesch
2012-07-06 11:33 ` [PATCH 1/4] asix: Fix checkpatch warnings Christian Riesch
2012-07-06 11:58   ` Eric Dumazet
2012-07-06 12:02     ` David Miller
2012-07-06 21:43     ` Grant Grundler
2012-07-07  8:36       ` Eric Dumazet
2012-07-09  9:48         ` Christian Riesch
2012-07-06 15:25   ` Joe Perches [this message]
2012-07-06 11:33 ` [PATCH 2/4] asix: Rename asix.c to asix_devices.c Christian Riesch
2012-07-06 11:33 ` [PATCH 3/4] asix: Factor out common code Christian Riesch
2012-07-06 11:33 ` [PATCH 4/4] asix: Add a new driver for the AX88172A Christian Riesch
2012-07-06 17:37   ` Ben Hutchings
2012-07-08 15:39     ` Michael Riesch
2012-07-08 15:50       ` Ben Hutchings
2012-07-09 10:30       ` Christian Riesch
2012-07-11  8:27         ` Christian Riesch
2012-07-11 15:10           ` Christian Riesch
2012-07-11 19:23             ` Michael Riesch
2012-07-06 21:20   ` Grant Grundler
2012-07-09 10:22     ` Christian Riesch
2012-07-12  7:22       ` Christian Riesch
2012-07-12 23:10         ` Grant Grundler
2012-07-06 11:51 ` [PATCH 0/4] Add a driver for the ASIX AX88172A Christian Riesch
2012-07-09  2:38 ` ASIX Allan Email [office]
2012-07-09 10:18   ` Christian Riesch
2012-07-09 17:45 ` Grant Grundler
2012-07-09 22:27   ` Mark Lord
2012-07-10  2:20     ` ASIX Allan Email [office]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341588334.2011.21.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=allan@asix.com.tw \
    --cc=christian.riesch@omicron.at \
    --cc=edumazet@google.com \
    --cc=grundler@chromium.org \
    --cc=kernel@teksavvy.com \
    --cc=michael@riesch.at \
    --cc=netdev@vger.kernel.org \
    --cc=oneukum@suse.de \
    --cc=tom.leiming@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.