diff mbox

[RFC,v2,part,2,12/18] PCI, ACPI: use hotplug-safe iterators to walk PCI buses

Message ID 1368550322-1045-12-git-send-email-jiang.liu@huawei.com (mailing list archive)
State RFC, archived
Headers show

Commit Message

Jiang Liu May 14, 2013, 4:51 p.m. UTC
Enhance ACPI reset drvier to use hotplug-safe iterators to walk PCI buses.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Len Brown <lenb@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: linux-acpi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/acpi/reboot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Rafael Wysocki May 14, 2013, 8:28 p.m. UTC | #1
On Wednesday, May 15, 2013 12:51:56 AM Jiang Liu wrote:
> Enhance ACPI reset drvier to use hotplug-safe iterators to walk PCI buses.
> 
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
> Cc: Len Brown <lenb@kernel.org>
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> Cc: linux-acpi@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  drivers/acpi/reboot.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c
> index a6c77e8b..532dd6d 100644
> --- a/drivers/acpi/reboot.c
> +++ b/drivers/acpi/reboot.c
> @@ -33,7 +33,7 @@ void acpi_reboot(void)
>  	switch (rr->space_id) {
>  	case ACPI_ADR_SPACE_PCI_CONFIG:
>  		/* The reset register can only live on bus 0. */
> -		bus0 = pci_find_bus(0, 0);
> +		bus0 = pci_get_bus(0, 0);
>  		if (!bus0)
>  			return;
>  		/* Form PCI device/function pair. */
> @@ -43,6 +43,7 @@ void acpi_reboot(void)
>  		/* Write the value that resets us. */
>  		pci_bus_write_config_byte(bus0, devfn,
>  				(rr->address & 0xffff), reset_value);
> +		pci_bus_put(bus0);
>  		break;
>  
>  	case ACPI_ADR_SPACE_SYSTEM_MEMORY:
>
diff mbox

Patch

diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c
index a6c77e8b..532dd6d 100644
--- a/drivers/acpi/reboot.c
+++ b/drivers/acpi/reboot.c
@@ -33,7 +33,7 @@  void acpi_reboot(void)
 	switch (rr->space_id) {
 	case ACPI_ADR_SPACE_PCI_CONFIG:
 		/* The reset register can only live on bus 0. */
-		bus0 = pci_find_bus(0, 0);
+		bus0 = pci_get_bus(0, 0);
 		if (!bus0)
 			return;
 		/* Form PCI device/function pair. */
@@ -43,6 +43,7 @@  void acpi_reboot(void)
 		/* Write the value that resets us. */
 		pci_bus_write_config_byte(bus0, devfn,
 				(rr->address & 0xffff), reset_value);
+		pci_bus_put(bus0);
 		break;
 
 	case ACPI_ADR_SPACE_SYSTEM_MEMORY: