@@ -309,17 +309,13 @@ static void init_bridge_misc(struct acpiphp_bridge *bridge)
309309/* find acpiphp_func from acpiphp_bridge */
310310static struct acpiphp_func * acpiphp_bridge_handle_to_function (acpi_handle handle )
311311{
312- struct list_head * node , * l ;
313312 struct acpiphp_bridge * bridge ;
314313 struct acpiphp_slot * slot ;
315314 struct acpiphp_func * func ;
316315
317- list_for_each (node , & bridge_list ) {
318- bridge = list_entry (node , struct acpiphp_bridge , list );
316+ list_for_each_entry (bridge , & bridge_list , list ) {
319317 for (slot = bridge -> slots ; slot ; slot = slot -> next ) {
320- list_for_each (l , & slot -> funcs ) {
321- func = list_entry (l , struct acpiphp_func ,
322- sibling );
318+ list_for_each_entry (func , & slot -> funcs , sibling ) {
323319 if (func -> handle == handle )
324320 return func ;
325321 }
@@ -493,21 +489,19 @@ static int add_bridge(acpi_handle handle)
493489
494490static struct acpiphp_bridge * acpiphp_handle_to_bridge (acpi_handle handle )
495491{
496- struct list_head * head ;
497- list_for_each (head , & bridge_list ) {
498- struct acpiphp_bridge * bridge = list_entry (head ,
499- struct acpiphp_bridge , list );
492+ struct acpiphp_bridge * bridge ;
493+
494+ list_for_each_entry (bridge , & bridge_list , list )
500495 if (bridge -> handle == handle )
501496 return bridge ;
502- }
503497
504498 return NULL ;
505499}
506500
507501static void cleanup_bridge (struct acpiphp_bridge * bridge )
508502{
509- struct list_head * list , * tmp ;
510- struct acpiphp_slot * slot ;
503+ struct acpiphp_slot * slot , * next ;
504+ struct acpiphp_func * func , * tmp ;
511505 acpi_status status ;
512506 acpi_handle handle = bridge -> handle ;
513507
@@ -528,10 +522,8 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
528522
529523 slot = bridge -> slots ;
530524 while (slot ) {
531- struct acpiphp_slot * next = slot -> next ;
532- list_for_each_safe (list , tmp , & slot -> funcs ) {
533- struct acpiphp_func * func ;
534- func = list_entry (list , struct acpiphp_func , sibling );
525+ next = slot -> next ;
526+ list_for_each_entry_safe (func , tmp , & slot -> funcs , sibling ) {
535527 if (is_dock_device (func -> handle )) {
536528 unregister_hotplug_dock_device (func -> handle );
537529 unregister_dock_notifier (& func -> nb );
@@ -543,7 +535,7 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge)
543535 if (ACPI_FAILURE (status ))
544536 err ("failed to remove notify handler\n" );
545537 }
546- list_del (list );
538+ list_del (& func -> sibling );
547539 kfree (func );
548540 }
549541 acpiphp_unregister_hotplug_slot (slot );
@@ -608,16 +600,13 @@ static int power_on_slot(struct acpiphp_slot *slot)
608600{
609601 acpi_status status ;
610602 struct acpiphp_func * func ;
611- struct list_head * l ;
612603 int retval = 0 ;
613604
614605 /* if already enabled, just skip */
615606 if (slot -> flags & SLOT_POWEREDON )
616607 goto err_exit ;
617608
618- list_for_each (l , & slot -> funcs ) {
619- func = list_entry (l , struct acpiphp_func , sibling );
620-
609+ list_for_each_entry (func , & slot -> funcs , sibling ) {
621610 if (func -> flags & FUNC_HAS_PS0 ) {
622611 dbg ("%s: executing _PS0\n" , __func__ );
623612 status = acpi_evaluate_object (func -> handle , "_PS0" , NULL , NULL );
@@ -643,17 +632,14 @@ static int power_off_slot(struct acpiphp_slot *slot)
643632{
644633 acpi_status status ;
645634 struct acpiphp_func * func ;
646- struct list_head * l ;
647635
648636 int retval = 0 ;
649637
650638 /* if already disabled, just skip */
651639 if ((slot -> flags & SLOT_POWEREDON ) == 0 )
652640 goto err_exit ;
653641
654- list_for_each (l , & slot -> funcs ) {
655- func = list_entry (l , struct acpiphp_func , sibling );
656-
642+ list_for_each_entry (func , & slot -> funcs , sibling ) {
657643 if (func -> flags & FUNC_HAS_PS3 ) {
658644 status = acpi_evaluate_object (func -> handle , "_PS3" , NULL , NULL );
659645 if (ACPI_FAILURE (status )) {
@@ -780,7 +766,6 @@ static int __ref enable_device(struct acpiphp_slot *slot)
780766{
781767 struct pci_dev * dev ;
782768 struct pci_bus * bus = slot -> bridge -> pci_bus ;
783- struct list_head * l ;
784769 struct acpiphp_func * func ;
785770 int retval = 0 ;
786771 int num , max , pass ;
@@ -820,19 +805,16 @@ static int __ref enable_device(struct acpiphp_slot *slot)
820805 }
821806 }
822807
823- list_for_each (l , & slot -> funcs ) {
824- func = list_entry (l , struct acpiphp_func , sibling );
808+ list_for_each_entry (func , & slot -> funcs , sibling )
825809 acpiphp_bus_add (func );
826- }
827810
828811 pci_bus_assign_resources (bus );
829812 acpiphp_sanitize_bus (bus );
830813 acpiphp_set_hpp_values (bus );
831814 pci_enable_bridges (bus );
832815 pci_bus_add_devices (bus );
833816
834- list_for_each (l , & slot -> funcs ) {
835- func = list_entry (l , struct acpiphp_func , sibling );
817+ list_for_each_entry (func , & slot -> funcs , sibling ) {
836818 dev = pci_get_slot (bus , PCI_DEVFN (slot -> device ,
837819 func -> function ));
838820 if (!dev )
@@ -930,12 +912,9 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
930912 acpi_status status ;
931913 unsigned long long sta = 0 ;
932914 u32 dvid ;
933- struct list_head * l ;
934915 struct acpiphp_func * func ;
935916
936- list_for_each (l , & slot -> funcs ) {
937- func = list_entry (l , struct acpiphp_func , sibling );
938-
917+ list_for_each_entry (func , & slot -> funcs , sibling ) {
939918 if (func -> flags & FUNC_HAS_STA ) {
940919 status = acpi_evaluate_integer (func -> handle , "_STA" , NULL , & sta );
941920 if (ACPI_SUCCESS (status ) && sta )
@@ -963,13 +942,10 @@ int acpiphp_eject_slot(struct acpiphp_slot *slot)
963942{
964943 acpi_status status ;
965944 struct acpiphp_func * func ;
966- struct list_head * l ;
967945 struct acpi_object_list arg_list ;
968946 union acpi_object arg ;
969947
970- list_for_each (l , & slot -> funcs ) {
971- func = list_entry (l , struct acpiphp_func , sibling );
972-
948+ list_for_each_entry (func , & slot -> funcs , sibling ) {
973949 /* We don't want to call _EJ0 on non-existing functions. */
974950 if ((func -> flags & FUNC_HAS_EJ0 )) {
975951 /* _EJ0 method take one argument */
@@ -1352,7 +1328,7 @@ int __init acpiphp_get_num_slots(void)
13521328 struct acpiphp_bridge * bridge ;
13531329 int num_slots = 0 ;
13541330
1355- list_for_each_entry (bridge , & bridge_list , list ) {
1331+ list_for_each_entry (bridge , & bridge_list , list ) {
13561332 dbg ("Bus %04x:%02x has %d slot%s\n" ,
13571333 pci_domain_nr (bridge -> pci_bus ),
13581334 bridge -> pci_bus -> number , bridge -> nr_slots ,
0 commit comments