linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases
@ 2012-02-05 22:13 Haiyang Zhang
  2012-02-05 22:13 ` [PATCH 2/3] net/hyperv: Correct the assignment in netvsc_recv_callback() Haiyang Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Haiyang Zhang @ 2012-02-05 22:13 UTC (permalink / raw)
  To: haiyangz, kys, davem, netdev, linux-kernel

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/net/hyperv/rndis_filter.c |   60 ++++++++++++++++++------------------
 1 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 133b7fb..a60e5e2 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -758,66 +758,66 @@ int rndis_filter_open(struct hv_device *dev)
 
 int rndis_filter_close(struct hv_device *dev)
 {
-	struct netvsc_device *netDevice = hv_get_drvdata(dev);
+	struct netvsc_device *nvdev = hv_get_drvdata(dev);
 
-	if (!netDevice)
+	if (!nvdev)
 		return -EINVAL;
 
-	return rndis_filter_close_device(netDevice->extension);
+	return rndis_filter_close_device(nvdev->extension);
 }
 
 int rndis_filter_send(struct hv_device *dev,
 			     struct hv_netvsc_packet *pkt)
 {
 	int ret;
-	struct rndis_filter_packet *filterPacket;
-	struct rndis_message *rndisMessage;
-	struct rndis_packet *rndisPacket;
-	u32 rndisMessageSize;
+	struct rndis_filter_packet *filter_pkt;
+	struct rndis_message *rndis_msg;
+	struct rndis_packet *rndis_pkt;
+	u32 rndis_msg_size;
 
 	/* Add the rndis header */
-	filterPacket = (struct rndis_filter_packet *)pkt->extension;
+	filter_pkt = (struct rndis_filter_packet *)pkt->extension;
 
-	memset(filterPacket, 0, sizeof(struct rndis_filter_packet));
+	memset(filter_pkt, 0, sizeof(struct rndis_filter_packet));
 
-	rndisMessage = &filterPacket->msg;
-	rndisMessageSize = RNDIS_MESSAGE_SIZE(struct rndis_packet);
+	rndis_msg = &filter_pkt->msg;
+	rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet);
 
-	rndisMessage->ndis_msg_type = REMOTE_NDIS_PACKET_MSG;
-	rndisMessage->msg_len = pkt->total_data_buflen +
-				      rndisMessageSize;
+	rndis_msg->ndis_msg_type = REMOTE_NDIS_PACKET_MSG;
+	rndis_msg->msg_len = pkt->total_data_buflen +
+				      rndis_msg_size;
 
-	rndisPacket = &rndisMessage->msg.pkt;
-	rndisPacket->data_offset = sizeof(struct rndis_packet);
-	rndisPacket->data_len = pkt->total_data_buflen;
+	rndis_pkt = &rndis_msg->msg.pkt;
+	rndis_pkt->data_offset = sizeof(struct rndis_packet);
+	rndis_pkt->data_len = pkt->total_data_buflen;
 
 	pkt->is_data_pkt = true;
-	pkt->page_buf[0].pfn = virt_to_phys(rndisMessage) >> PAGE_SHIFT;
+	pkt->page_buf[0].pfn = virt_to_phys(rndis_msg) >> PAGE_SHIFT;
 	pkt->page_buf[0].offset =
-			(unsigned long)rndisMessage & (PAGE_SIZE-1);
-	pkt->page_buf[0].len = rndisMessageSize;
+			(unsigned long)rndis_msg & (PAGE_SIZE-1);
+	pkt->page_buf[0].len = rndis_msg_size;
 
 	/* Add one page_buf if the rndis msg goes beyond page boundary */
-	if (pkt->page_buf[0].offset + rndisMessageSize > PAGE_SIZE) {
+	if (pkt->page_buf[0].offset + rndis_msg_size > PAGE_SIZE) {
 		int i;
 		for (i = pkt->page_buf_cnt; i > 1; i--)
 			pkt->page_buf[i] = pkt->page_buf[i-1];
 		pkt->page_buf_cnt++;
 		pkt->page_buf[0].len = PAGE_SIZE - pkt->page_buf[0].offset;
 		pkt->page_buf[1].pfn = virt_to_phys((void *)((ulong)
-			rndisMessage + pkt->page_buf[0].len)) >> PAGE_SHIFT;
+			rndis_msg + pkt->page_buf[0].len)) >> PAGE_SHIFT;
 		pkt->page_buf[1].offset = 0;
-		pkt->page_buf[1].len = rndisMessageSize - pkt->page_buf[0].len;
+		pkt->page_buf[1].len = rndis_msg_size - pkt->page_buf[0].len;
 	}
 
 	/* Save the packet send completion and context */
-	filterPacket->completion = pkt->completion.send.send_completion;
-	filterPacket->completion_ctx =
+	filter_pkt->completion = pkt->completion.send.send_completion;
+	filter_pkt->completion_ctx =
 				pkt->completion.send.send_completion_ctx;
 
 	/* Use ours */
 	pkt->completion.send.send_completion = rndis_filter_send_completion;
-	pkt->completion.send.send_completion_ctx = filterPacket;
+	pkt->completion.send.send_completion_ctx = filter_pkt;
 
 	ret = netvsc_send(dev, pkt);
 	if (ret != 0) {
@@ -826,9 +826,9 @@ int rndis_filter_send(struct hv_device *dev,
 		 * above
 		 */
 		pkt->completion.send.send_completion =
-				filterPacket->completion;
+				filter_pkt->completion;
 		pkt->completion.send.send_completion_ctx =
-				filterPacket->completion_ctx;
+				filter_pkt->completion_ctx;
 	}
 
 	return ret;
@@ -836,10 +836,10 @@ int rndis_filter_send(struct hv_device *dev,
 
 static void rndis_filter_send_completion(void *ctx)
 {
-	struct rndis_filter_packet *filterPacket = ctx;
+	struct rndis_filter_packet *filter_pkt = ctx;
 
 	/* Pass it back to the original handler */
-	filterPacket->completion(filterPacket->completion_ctx);
+	filter_pkt->completion(filter_pkt->completion_ctx);
 }
 
 
-- 
1.7.7


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

* [PATCH 2/3] net/hyperv: Correct the assignment in netvsc_recv_callback()
  2012-02-05 22:13 [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases Haiyang Zhang
@ 2012-02-05 22:13 ` Haiyang Zhang
  2012-02-05 22:45   ` David Miller
  2012-02-05 22:13 ` [PATCH 3/3] net/hyperv: Remove the unnecessary memset in rndis_filter_send() Haiyang Zhang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Haiyang Zhang @ 2012-02-05 22:13 UTC (permalink / raw)
  To: haiyangz, kys, davem, netdev, linux-kernel

The first assignment to variable "net" is wrong, but overridden by the
latter assignments. So the bug isn't manifested.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/net/hyperv/netvsc_drv.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 466c58a..0ae7a1a 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -267,13 +267,10 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj,
 int netvsc_recv_callback(struct hv_device *device_obj,
 				struct hv_netvsc_packet *packet)
 {
-	struct net_device *net = dev_get_drvdata(&device_obj->device);
+	struct net_device *net;
 	struct sk_buff *skb;
-	struct netvsc_device *net_device;
-
-	net_device = hv_get_drvdata(device_obj);
-	net = net_device->ndev;
 
+	net = ((struct netvsc_device *)hv_get_drvdata(device_obj))->ndev;
 	if (!net) {
 		netdev_err(net, "got receive callback but net device"
 			" not initialized yet\n");
-- 
1.7.7


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

* [PATCH 3/3] net/hyperv: Remove the unnecessary memset in rndis_filter_send()
  2012-02-05 22:13 [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases Haiyang Zhang
  2012-02-05 22:13 ` [PATCH 2/3] net/hyperv: Correct the assignment in netvsc_recv_callback() Haiyang Zhang
@ 2012-02-05 22:13 ` Haiyang Zhang
  2012-02-05 22:46   ` David Miller
  2012-02-05 22:13 ` [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases Jesper Juhl
  2012-02-05 22:45 ` David Miller
  3 siblings, 1 reply; 7+ messages in thread
From: Haiyang Zhang @ 2012-02-05 22:13 UTC (permalink / raw)
  To: haiyangz, kys, davem, netdev, linux-kernel

The memory has been allocated by kzalloc, so it's unnecessary to memset
again.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
 drivers/net/hyperv/rndis_filter.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index a60e5e2..136efd8 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -778,8 +778,6 @@ int rndis_filter_send(struct hv_device *dev,
 	/* Add the rndis header */
 	filter_pkt = (struct rndis_filter_packet *)pkt->extension;
 
-	memset(filter_pkt, 0, sizeof(struct rndis_filter_packet));
-
 	rndis_msg = &filter_pkt->msg;
 	rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet);
 
-- 
1.7.7


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

* Re: [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases
  2012-02-05 22:13 [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases Haiyang Zhang
  2012-02-05 22:13 ` [PATCH 2/3] net/hyperv: Correct the assignment in netvsc_recv_callback() Haiyang Zhang
  2012-02-05 22:13 ` [PATCH 3/3] net/hyperv: Remove the unnecessary memset in rndis_filter_send() Haiyang Zhang
@ 2012-02-05 22:13 ` Jesper Juhl
  2012-02-05 22:45 ` David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: Jesper Juhl @ 2012-02-05 22:13 UTC (permalink / raw)
  To: Haiyang Zhang; +Cc: kys, davem, netdev, linux-kernel

Looks like a nice change to me.

On Sun, 5 Feb 2012, Haiyang Zhang wrote:

> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>

Reviewed-by: Jesper Juhl <jj@chaosbits.net>


> ---
>  drivers/net/hyperv/rndis_filter.c |   60 ++++++++++++++++++------------------
>  1 files changed, 30 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
> index 133b7fb..a60e5e2 100644
> --- a/drivers/net/hyperv/rndis_filter.c
> +++ b/drivers/net/hyperv/rndis_filter.c
> @@ -758,66 +758,66 @@ int rndis_filter_open(struct hv_device *dev)
>  
>  int rndis_filter_close(struct hv_device *dev)
>  {
> -	struct netvsc_device *netDevice = hv_get_drvdata(dev);
> +	struct netvsc_device *nvdev = hv_get_drvdata(dev);
>  
> -	if (!netDevice)
> +	if (!nvdev)
>  		return -EINVAL;
>  
> -	return rndis_filter_close_device(netDevice->extension);
> +	return rndis_filter_close_device(nvdev->extension);
>  }
>  
>  int rndis_filter_send(struct hv_device *dev,
>  			     struct hv_netvsc_packet *pkt)
>  {
>  	int ret;
> -	struct rndis_filter_packet *filterPacket;
> -	struct rndis_message *rndisMessage;
> -	struct rndis_packet *rndisPacket;
> -	u32 rndisMessageSize;
> +	struct rndis_filter_packet *filter_pkt;
> +	struct rndis_message *rndis_msg;
> +	struct rndis_packet *rndis_pkt;
> +	u32 rndis_msg_size;
>  
>  	/* Add the rndis header */
> -	filterPacket = (struct rndis_filter_packet *)pkt->extension;
> +	filter_pkt = (struct rndis_filter_packet *)pkt->extension;
>  
> -	memset(filterPacket, 0, sizeof(struct rndis_filter_packet));
> +	memset(filter_pkt, 0, sizeof(struct rndis_filter_packet));
>  
> -	rndisMessage = &filterPacket->msg;
> -	rndisMessageSize = RNDIS_MESSAGE_SIZE(struct rndis_packet);
> +	rndis_msg = &filter_pkt->msg;
> +	rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet);
>  
> -	rndisMessage->ndis_msg_type = REMOTE_NDIS_PACKET_MSG;
> -	rndisMessage->msg_len = pkt->total_data_buflen +
> -				      rndisMessageSize;
> +	rndis_msg->ndis_msg_type = REMOTE_NDIS_PACKET_MSG;
> +	rndis_msg->msg_len = pkt->total_data_buflen +
> +				      rndis_msg_size;
>  
> -	rndisPacket = &rndisMessage->msg.pkt;
> -	rndisPacket->data_offset = sizeof(struct rndis_packet);
> -	rndisPacket->data_len = pkt->total_data_buflen;
> +	rndis_pkt = &rndis_msg->msg.pkt;
> +	rndis_pkt->data_offset = sizeof(struct rndis_packet);
> +	rndis_pkt->data_len = pkt->total_data_buflen;
>  
>  	pkt->is_data_pkt = true;
> -	pkt->page_buf[0].pfn = virt_to_phys(rndisMessage) >> PAGE_SHIFT;
> +	pkt->page_buf[0].pfn = virt_to_phys(rndis_msg) >> PAGE_SHIFT;
>  	pkt->page_buf[0].offset =
> -			(unsigned long)rndisMessage & (PAGE_SIZE-1);
> -	pkt->page_buf[0].len = rndisMessageSize;
> +			(unsigned long)rndis_msg & (PAGE_SIZE-1);
> +	pkt->page_buf[0].len = rndis_msg_size;
>  
>  	/* Add one page_buf if the rndis msg goes beyond page boundary */
> -	if (pkt->page_buf[0].offset + rndisMessageSize > PAGE_SIZE) {
> +	if (pkt->page_buf[0].offset + rndis_msg_size > PAGE_SIZE) {
>  		int i;
>  		for (i = pkt->page_buf_cnt; i > 1; i--)
>  			pkt->page_buf[i] = pkt->page_buf[i-1];
>  		pkt->page_buf_cnt++;
>  		pkt->page_buf[0].len = PAGE_SIZE - pkt->page_buf[0].offset;
>  		pkt->page_buf[1].pfn = virt_to_phys((void *)((ulong)
> -			rndisMessage + pkt->page_buf[0].len)) >> PAGE_SHIFT;
> +			rndis_msg + pkt->page_buf[0].len)) >> PAGE_SHIFT;
>  		pkt->page_buf[1].offset = 0;
> -		pkt->page_buf[1].len = rndisMessageSize - pkt->page_buf[0].len;
> +		pkt->page_buf[1].len = rndis_msg_size - pkt->page_buf[0].len;
>  	}
>  
>  	/* Save the packet send completion and context */
> -	filterPacket->completion = pkt->completion.send.send_completion;
> -	filterPacket->completion_ctx =
> +	filter_pkt->completion = pkt->completion.send.send_completion;
> +	filter_pkt->completion_ctx =
>  				pkt->completion.send.send_completion_ctx;
>  
>  	/* Use ours */
>  	pkt->completion.send.send_completion = rndis_filter_send_completion;
> -	pkt->completion.send.send_completion_ctx = filterPacket;
> +	pkt->completion.send.send_completion_ctx = filter_pkt;
>  
>  	ret = netvsc_send(dev, pkt);
>  	if (ret != 0) {
> @@ -826,9 +826,9 @@ int rndis_filter_send(struct hv_device *dev,
>  		 * above
>  		 */
>  		pkt->completion.send.send_completion =
> -				filterPacket->completion;
> +				filter_pkt->completion;
>  		pkt->completion.send.send_completion_ctx =
> -				filterPacket->completion_ctx;
> +				filter_pkt->completion_ctx;
>  	}
>  
>  	return ret;
> @@ -836,10 +836,10 @@ int rndis_filter_send(struct hv_device *dev,
>  
>  static void rndis_filter_send_completion(void *ctx)
>  {
> -	struct rndis_filter_packet *filterPacket = ctx;
> +	struct rndis_filter_packet *filter_pkt = ctx;
>  
>  	/* Pass it back to the original handler */
> -	filterPacket->completion(filterPacket->completion_ctx);
> +	filter_pkt->completion(filter_pkt->completion_ctx);
>  }
>  
>  
> 

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


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

* Re: [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases
  2012-02-05 22:13 [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases Haiyang Zhang
                   ` (2 preceding siblings ...)
  2012-02-05 22:13 ` [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases Jesper Juhl
@ 2012-02-05 22:45 ` David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2012-02-05 22:45 UTC (permalink / raw)
  To: haiyangz; +Cc: kys, netdev, linux-kernel

From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Sun,  5 Feb 2012 14:13:08 -0800

> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>

Applied.

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

* Re: [PATCH 2/3] net/hyperv: Correct the assignment in netvsc_recv_callback()
  2012-02-05 22:13 ` [PATCH 2/3] net/hyperv: Correct the assignment in netvsc_recv_callback() Haiyang Zhang
@ 2012-02-05 22:45   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2012-02-05 22:45 UTC (permalink / raw)
  To: haiyangz; +Cc: kys, netdev, linux-kernel

From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Sun,  5 Feb 2012 14:13:09 -0800

> The first assignment to variable "net" is wrong, but overridden by the
> latter assignments. So the bug isn't manifested.
> 
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>

Applied.

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

* Re: [PATCH 3/3] net/hyperv: Remove the unnecessary memset in rndis_filter_send()
  2012-02-05 22:13 ` [PATCH 3/3] net/hyperv: Remove the unnecessary memset in rndis_filter_send() Haiyang Zhang
@ 2012-02-05 22:46   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2012-02-05 22:46 UTC (permalink / raw)
  To: haiyangz; +Cc: kys, netdev, linux-kernel

From: Haiyang Zhang <haiyangz@microsoft.com>
Date: Sun,  5 Feb 2012 14:13:10 -0800

> The memory has been allocated by kzalloc, so it's unnecessary to memset
> again.
> 
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>

Applied.

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

end of thread, other threads:[~2012-02-05 22:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-05 22:13 [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases Haiyang Zhang
2012-02-05 22:13 ` [PATCH 2/3] net/hyperv: Correct the assignment in netvsc_recv_callback() Haiyang Zhang
2012-02-05 22:45   ` David Miller
2012-02-05 22:13 ` [PATCH 3/3] net/hyperv: Remove the unnecessary memset in rndis_filter_send() Haiyang Zhang
2012-02-05 22:46   ` David Miller
2012-02-05 22:13 ` [PATCH 1/3] net/hyperv: Convert camel cased variables in rndis_filter.c to lower cases Jesper Juhl
2012-02-05 22:45 ` David Miller

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).