public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpiphp: fix use of list_for_each macro
@ 2006-10-28 18:39 Akinobu Mita
  2006-10-30 19:37 ` Kristen Carlson Accardi
  0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2006-10-28 18:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Kristen Carlson Accardi

This patch fixes invalid usage of list_for_each()

list_for_each (node, &bridge_list) {
	bridge = (struct acpiphp_bridge *)node;
	...
}

This code works while the member of list node is located at the
head of struct acpiphp_bridge.

Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

 drivers/pci/hotplug/acpiphp_glue.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Index: work-fault-inject/drivers/pci/hotplug/acpiphp_glue.c
===================================================================
--- work-fault-inject.orig/drivers/pci/hotplug/acpiphp_glue.c
+++ work-fault-inject/drivers/pci/hotplug/acpiphp_glue.c
@@ -1693,14 +1693,10 @@ void __exit acpiphp_glue_exit(void)
  */
 int __init acpiphp_get_num_slots(void)
 {
-	struct list_head *node;
 	struct acpiphp_bridge *bridge;
-	int num_slots;
-
-	num_slots = 0;
+	int num_slots = 0;
 
-	list_for_each (node, &bridge_list) {
-		bridge = (struct acpiphp_bridge *)node;
+	list_for_each_entry (bridge, &bridge_list, list) {
 		dbg("Bus %04x:%02x has %d slot%s\n",
 				pci_domain_nr(bridge->pci_bus),
 				bridge->pci_bus->number, bridge->nr_slots,

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

* Re: [PATCH] acpiphp: fix use of list_for_each macro
  2006-10-28 18:39 [PATCH] acpiphp: fix use of list_for_each macro Akinobu Mita
@ 2006-10-30 19:37 ` Kristen Carlson Accardi
  0 siblings, 0 replies; 2+ messages in thread
From: Kristen Carlson Accardi @ 2006-10-30 19:37 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-kernel, Greg Kroah-Hartman

On Sun, 29 Oct 2006 03:39:43 +0900
Akinobu Mita <akinobu.mita@gmail.com> wrote:

> This patch fixes invalid usage of list_for_each()
> 
> list_for_each (node, &bridge_list) {
> 	bridge = (struct acpiphp_bridge *)node;
> 	...
> }
> 
> This code works while the member of list node is located at the
> head of struct acpiphp_bridge.
> 
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

Acked-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>

> 
>  drivers/pci/hotplug/acpiphp_glue.c |    8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> Index: work-fault-inject/drivers/pci/hotplug/acpiphp_glue.c
> ===================================================================
> --- work-fault-inject.orig/drivers/pci/hotplug/acpiphp_glue.c
> +++ work-fault-inject/drivers/pci/hotplug/acpiphp_glue.c
> @@ -1693,14 +1693,10 @@ void __exit acpiphp_glue_exit(void)
>   */
>  int __init acpiphp_get_num_slots(void)
>  {
> -	struct list_head *node;
>  	struct acpiphp_bridge *bridge;
> -	int num_slots;
> -
> -	num_slots = 0;
> +	int num_slots = 0;
>  
> -	list_for_each (node, &bridge_list) {
> -		bridge = (struct acpiphp_bridge *)node;
> +	list_for_each_entry (bridge, &bridge_list, list) {
>  		dbg("Bus %04x:%02x has %d slot%s\n",
>  				pci_domain_nr(bridge->pci_bus),
>  				bridge->pci_bus->number, bridge->nr_slots,

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

end of thread, other threads:[~2006-10-30 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-28 18:39 [PATCH] acpiphp: fix use of list_for_each macro Akinobu Mita
2006-10-30 19:37 ` Kristen Carlson Accardi

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