Linux virtualization list
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, virtualization@lists.osdl.org,
	Haiyang Zhang <haiyangz@microsoft.com>
Subject: Re: [PATCH 1/1] Staging: hv: netvsc: Cleanup the name and type of link_stat variable
Date: Tue, 13 Sep 2011 13:04:42 -0700	[thread overview]
Message-ID: <1315944283.25776.14.camel@Joe-Laptop> (raw)
In-Reply-To: <1315943618-22308-1-git-send-email-kys@microsoft.com>

On Tue, 2011-09-13 at 12:53 -0700, K. Y. Srinivasan wrote:
> Consistently name the variable tracking the link status. Use a consistent
> type for this variable and get rid of some unnecessary parentheses as well.
> 
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> ---
>  drivers/staging/hv/rndis_filter.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c
> index 963582a..696d2c5 100644
> --- a/drivers/staging/hv/rndis_filter.c
> +++ b/drivers/staging/hv/rndis_filter.c
> @@ -41,7 +41,7 @@ struct rndis_device {
>  	struct netvsc_device *net_dev;
>  
>  	enum rndis_device_state state;
> -	u32 link_stat;
> +	bool link_state;
>  	atomic_t new_req_id;
>  
>  	spinlock_t request_lock;
> @@ -514,7 +514,7 @@ static int rndis_filter_query_device_link_status(struct rndis_device *dev)
>  
>  	return rndis_filter_query_device(dev,
>  				      RNDIS_OID_GEN_MEDIA_CONNECT_STATUS,
> -				      &dev->link_stat, &size);
> +				      &dev->link_state, &size);

Are you sure you can do this?
You're changing the info request from u32 to bool
without changing the size above it

	u32 size = sizeof(u32);


>  }
>  
>  static int rndis_filter_set_packet_filter(struct rndis_device *dev,
> @@ -736,11 +736,11 @@ int rndis_filter_device_add(struct hv_device *dev,
>  
>  	rndis_filter_query_device_link_status(rndis_device);
>  
> -	device_info->link_state = rndis_device->link_stat;
> +	device_info->link_state = rndis_device->link_state;
>  
>  	dev_info(&dev->device, "Device MAC %pM link state %s",
>  		 rndis_device->hw_mac_adr,
> -		 ((device_info->link_state) ? ("down\n") : ("up\n")));
> +		 device_info->link_state ? "down\n" : "up\n");

It's better to remove the multiple "\n"s from "up" and "down"
and move it to the format string as I suggested.

  reply	other threads:[~2011-09-13 20:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-13 19:53 [PATCH 1/1] Staging: hv: netvsc: Cleanup the name and type of link_stat variable K. Y. Srinivasan
2011-09-13 20:04 ` Joe Perches [this message]
2011-09-13 20:57   ` KY Srinivasan
  -- strict thread matches above, loose matches on Subject: below --
2011-09-13 22:21 K. Y. Srinivasan

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=1315944283.25776.14.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@suse.de \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.osdl.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox