All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Staging: hv: Use list_entry for msg_info and remove associated comment
  2011-02-14 18:35 ` Hank Janssen
  (?)
@ 2011-02-14 18:33 ` Greg KH
  -1 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2011-02-14 18:33 UTC (permalink / raw)
  To: Hank Janssen
  Cc: haiyangz, linux-kernel, devel, virtualization, Abhishek Kane,
	K.Y. Srinivasan

On Mon, Feb 14, 2011 at 10:35:37AM -0800, Hank Janssen wrote:
> Change code to use list_entry api. And removed comment
> suggesting that change.
> 
> Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> Signed-off-by: K.Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> 
> ---
>  drivers/staging/hv/channel_mgmt.c |   17 +++++++++--------
>  1 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
> index a9c9d49..6c497e9 100644
> --- a/drivers/staging/hv/channel_mgmt.c
> +++ b/drivers/staging/hv/channel_mgmt.c
> @@ -580,8 +580,9 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr)
>  	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
>  
>  	list_for_each(curr, &vmbus_connection.chn_msg_list) {
> -/* FIXME: this should probably use list_entry() instead */
> -		msginfo = (struct vmbus_channel_msginfo *)curr;
> +		msginfo = list_entry(curr, struct vmbus_channel_msginfo,
> +				msglistentry);

How about using list_for_each_entry() instead?  That's the "preferred"
way to do things these days, and it saves you an extra line of code :)

thanks,

greg k-h

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

* [PATCH] Staging: hv: Use list_entry for msg_info and remove associated comment
@ 2011-02-14 18:35 ` Hank Janssen
  0 siblings, 0 replies; 3+ messages in thread
From: Hank Janssen @ 2011-02-14 18:35 UTC (permalink / raw)
  To: hjanssen, haiyangz, gregkh, linux-kernel, devel, virtualization
  Cc: Abhishek Kane, K.Y. Srinivasan

Change code to use list_entry api. And removed comment
suggesting that change.

Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: K.Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>

---
 drivers/staging/hv/channel_mgmt.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index a9c9d49..6c497e9 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -580,8 +580,9 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr)
 	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
 
 	list_for_each(curr, &vmbus_connection.chn_msg_list) {
-/* FIXME: this should probably use list_entry() instead */
-		msginfo = (struct vmbus_channel_msginfo *)curr;
+		msginfo = list_entry(curr, struct vmbus_channel_msginfo,
+				msglistentry);
+
 		requestheader =
 			(struct vmbus_channel_message_header *)msginfo->msg;
 
@@ -628,8 +629,8 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr)
 	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
 
 	list_for_each(curr, &vmbus_connection.chn_msg_list) {
-/* FIXME: this should probably use list_entry() instead */
-		msginfo = (struct vmbus_channel_msginfo *)curr;
+		msginfo = list_entry(curr, struct vmbus_channel_msginfo,
+				msglistentry);
 		requestheader =
 			(struct vmbus_channel_message_header *)msginfo->msg;
 
@@ -676,8 +677,8 @@ static void vmbus_ongpadl_torndown(
 	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
 
 	list_for_each(curr, &vmbus_connection.chn_msg_list) {
-/* FIXME: this should probably use list_entry() instead */
-		msginfo = (struct vmbus_channel_msginfo *)curr;
+		msginfo = list_entry(curr, struct vmbus_channel_msginfo,
+				msglistentry);
 		requestheader =
 			(struct vmbus_channel_message_header *)msginfo->msg;
 
@@ -718,8 +719,8 @@ static void vmbus_onversion_response(
 	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
 
 	list_for_each(curr, &vmbus_connection.chn_msg_list) {
-/* FIXME: this should probably use list_entry() instead */
-		msginfo = (struct vmbus_channel_msginfo *)curr;
+		msginfo = list_entry(curr, struct vmbus_channel_msginfo,
+				msglistentry);
 		requestheader =
 			(struct vmbus_channel_message_header *)msginfo->msg;
 
-- 
1.6.0.2


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

* [PATCH] Staging: hv: Use list_entry for msg_info and remove associated comment
@ 2011-02-14 18:35 ` Hank Janssen
  0 siblings, 0 replies; 3+ messages in thread
From: Hank Janssen @ 2011-02-14 18:35 UTC (permalink / raw)
  To: hjanssen, haiyangz, gregkh, linux-kernel, devel, virtualization
  Cc: Abhishek Kane

Change code to use list_entry api. And removed comment
suggesting that change.

Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: K.Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>

---
 drivers/staging/hv/channel_mgmt.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index a9c9d49..6c497e9 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -580,8 +580,9 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr)
 	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
 
 	list_for_each(curr, &vmbus_connection.chn_msg_list) {
-/* FIXME: this should probably use list_entry() instead */
-		msginfo = (struct vmbus_channel_msginfo *)curr;
+		msginfo = list_entry(curr, struct vmbus_channel_msginfo,
+				msglistentry);
+
 		requestheader =
 			(struct vmbus_channel_message_header *)msginfo->msg;
 
@@ -628,8 +629,8 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr)
 	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
 
 	list_for_each(curr, &vmbus_connection.chn_msg_list) {
-/* FIXME: this should probably use list_entry() instead */
-		msginfo = (struct vmbus_channel_msginfo *)curr;
+		msginfo = list_entry(curr, struct vmbus_channel_msginfo,
+				msglistentry);
 		requestheader =
 			(struct vmbus_channel_message_header *)msginfo->msg;
 
@@ -676,8 +677,8 @@ static void vmbus_ongpadl_torndown(
 	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
 
 	list_for_each(curr, &vmbus_connection.chn_msg_list) {
-/* FIXME: this should probably use list_entry() instead */
-		msginfo = (struct vmbus_channel_msginfo *)curr;
+		msginfo = list_entry(curr, struct vmbus_channel_msginfo,
+				msglistentry);
 		requestheader =
 			(struct vmbus_channel_message_header *)msginfo->msg;
 
@@ -718,8 +719,8 @@ static void vmbus_onversion_response(
 	spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
 
 	list_for_each(curr, &vmbus_connection.chn_msg_list) {
-/* FIXME: this should probably use list_entry() instead */
-		msginfo = (struct vmbus_channel_msginfo *)curr;
+		msginfo = list_entry(curr, struct vmbus_channel_msginfo,
+				msglistentry);
 		requestheader =
 			(struct vmbus_channel_message_header *)msginfo->msg;
 
-- 
1.6.0.2

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

end of thread, other threads:[~2011-02-14 18:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 18:35 [PATCH] Staging: hv: Use list_entry for msg_info and remove associated comment Hank Janssen
2011-02-14 18:35 ` Hank Janssen
2011-02-14 18:33 ` Greg KH

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.