diff mbox

[v8,07/22] ACPI: Separate acpi_bus_trim to support two steps.

Message ID 1357944049-29620-8-git-send-email-yinghai@kernel.org (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Yinghai Lu Jan. 11, 2013, 10:40 p.m. UTC
Current all acpi_bus_trim callers have rmdevice to 1.
that means it will remove all acpi devices.

When 0, is passed, it will keep the parent.

For root bus hotremove support, we need to have pci device to be
removed before acpi devices.

So try to keep all acpi devices, and only stop drivers with them.

This change should be safe because all current callers all have 1 passed.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
---
 drivers/acpi/scan.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Rafael Wysocki Jan. 12, 2013, 10:40 p.m. UTC | #1
On Friday, January 11, 2013 02:40:34 PM Yinghai Lu wrote:
> Current all acpi_bus_trim callers have rmdevice to 1.
> that means it will remove all acpi devices.
> 
> When 0, is passed, it will keep the parent.
> 
> For root bus hotremove support, we need to have pci device to be
> removed before acpi devices.
> 
> So try to keep all acpi devices, and only stop drivers with them.
> 
> This change should be safe because all current callers all have 1 passed.

I'm not sure how the chanelog is related to the patch itself.

The patch modifies the behavior of acpi_bus_trim() to avoid removing all
devices (not just the start point) for rmdevice==0, which doesn't really change
the functionality, because all callers pass rmdevice=1 anyway.

Yes, we can make this change, but why is it necessary?

And why don't we remove the rmdevice argument from acpi_bus_trim() altogether?

Rafael


> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: Len Brown <lenb@kernel.org>
> Cc: linux-acpi@vger.kernel.org
> ---
>  drivers/acpi/scan.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index e380345..db7664e 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -1669,10 +1669,7 @@ int acpi_bus_trim(struct acpi_device *start, int rmdevice)
>  			child = parent;
>  			parent = parent->parent;
>  
> -			if (level == 0)
> -				err = acpi_bus_remove(child, rmdevice);
> -			else
> -				err = acpi_bus_remove(child, 1);
> +			err = acpi_bus_remove(child, rmdevice);
>  
>  			continue;
>  		}
>
Yinghai Lu Jan. 15, 2013, 6:31 a.m. UTC | #2
On Sat, Jan 12, 2013 at 2:40 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Friday, January 11, 2013 02:40:34 PM Yinghai Lu wrote:
>> Current all acpi_bus_trim callers have rmdevice to 1.
>> that means it will remove all acpi devices.
>>
>> When 0, is passed, it will keep the parent.
>>
>> For root bus hotremove support, we need to have pci device to be
>> removed before acpi devices.
>>
>> So try to keep all acpi devices, and only stop drivers with them.
>>
>> This change should be safe because all current callers all have 1 passed.
>
> I'm not sure how the chanelog is related to the patch itself.
>
> The patch modifies the behavior of acpi_bus_trim() to avoid removing all
> devices (not just the start point) for rmdevice==0, which doesn't really change
> the functionality, because all callers pass rmdevice=1 anyway.
>
> Yes, we can make this change, but why is it necessary?
>
> And why don't we remove the rmdevice argument from acpi_bus_trim() altogether?

this patch is not needed after your changes with acpi_bus_trim.

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael Wysocki Jan. 15, 2013, 11:22 a.m. UTC | #3
On Monday, January 14, 2013 10:31:35 PM Yinghai Lu wrote:
> On Sat, Jan 12, 2013 at 2:40 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > On Friday, January 11, 2013 02:40:34 PM Yinghai Lu wrote:
> >> Current all acpi_bus_trim callers have rmdevice to 1.
> >> that means it will remove all acpi devices.
> >>
> >> When 0, is passed, it will keep the parent.
> >>
> >> For root bus hotremove support, we need to have pci device to be
> >> removed before acpi devices.
> >>
> >> So try to keep all acpi devices, and only stop drivers with them.
> >>
> >> This change should be safe because all current callers all have 1 passed.
> >
> > I'm not sure how the chanelog is related to the patch itself.
> >
> > The patch modifies the behavior of acpi_bus_trim() to avoid removing all
> > devices (not just the start point) for rmdevice==0, which doesn't really change
> > the functionality, because all callers pass rmdevice=1 anyway.
> >
> > Yes, we can make this change, but why is it necessary?
> >
> > And why don't we remove the rmdevice argument from acpi_bus_trim() altogether?
> 
> this patch is not needed after your changes with acpi_bus_trim.

OK, cool. :-)

Thanks,
Rafael
diff mbox

Patch

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index e380345..db7664e 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1669,10 +1669,7 @@  int acpi_bus_trim(struct acpi_device *start, int rmdevice)
 			child = parent;
 			parent = parent->parent;
 
-			if (level == 0)
-				err = acpi_bus_remove(child, rmdevice);
-			else
-				err = acpi_bus_remove(child, 1);
+			err = acpi_bus_remove(child, rmdevice);
 
 			continue;
 		}