diff mbox series

[v7,07/16] ACPI: scan: switch to flags for acpi_scan_check_and_detach()

Message ID 20240418135412.14730-8-Jonathan.Cameron@huawei.com (mailing list archive)
State New, archived
Headers show
Series ACPI/arm64: add support for virtual cpu hotplug | expand

Commit Message

Jonathan Cameron April 18, 2024, 1:54 p.m. UTC
Precursor patch adds the ability to pass a uintptr_t of flags into
acpi_scan_check_and detach() so that additional flags can be
added to indicate whether to defer portions of the eject flow.
The new flag follows in the next patch.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

---
v7: No change
v6: Based on internal feedback switch to less invasive change
    to using flags rather than a struct.
---
 drivers/acpi/scan.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Comments

Rafael J. Wysocki April 22, 2024, 7:05 p.m. UTC | #1
On Thu, Apr 18, 2024 at 3:57 PM Jonathan Cameron
<Jonathan.Cameron@huawei.com> wrote:
>
> Precursor patch adds the ability to pass a uintptr_t of flags into
> acpi_scan_check_and detach() so that additional flags can be
> added to indicate whether to defer portions of the eject flow.
> The new flag follows in the next patch.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

I have no specific heartburn related to this, so

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

> ---
> v7: No change
> v6: Based on internal feedback switch to less invasive change
>     to using flags rather than a struct.
> ---
>  drivers/acpi/scan.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index d1464324de95..1ec9677e6c2d 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -244,13 +244,16 @@ static int acpi_scan_try_to_offline(struct acpi_device *device)
>         return 0;
>  }
>
> -static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check)
> +#define ACPI_SCAN_CHECK_FLAG_STATUS    BIT(0)
> +
> +static int acpi_scan_check_and_detach(struct acpi_device *adev, void *p)
>  {
>         struct acpi_scan_handler *handler = adev->handler;
> +       uintptr_t flags = (uintptr_t)p;
>
> -       acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, check);
> +       acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, p);
>
> -       if (check) {
> +       if (flags & ACPI_SCAN_CHECK_FLAG_STATUS) {
>                 acpi_bus_get_status(adev);
>                 /*
>                  * Skip devices that are still there and take the enabled
> @@ -288,7 +291,9 @@ static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check)
>
>  static void acpi_scan_check_subtree(struct acpi_device *adev)
>  {
> -       acpi_scan_check_and_detach(adev, (void *)true);
> +       uintptr_t flags = ACPI_SCAN_CHECK_FLAG_STATUS;
> +
> +       acpi_scan_check_and_detach(adev, (void *)flags);
>  }
>
>  static int acpi_scan_hot_remove(struct acpi_device *device)
> @@ -2601,7 +2606,9 @@ EXPORT_SYMBOL(acpi_bus_scan);
>   */
>  void acpi_bus_trim(struct acpi_device *adev)
>  {
> -       acpi_scan_check_and_detach(adev, NULL);
> +       uintptr_t flags = 0;
> +
> +       acpi_scan_check_and_detach(adev, (void *)flags);
>  }
>  EXPORT_SYMBOL_GPL(acpi_bus_trim);
>
> --
Hanjun Guo April 23, 2024, 12:02 p.m. UTC | #2
On 2024/4/18 21:54, Jonathan Cameron wrote:
> Precursor patch adds the ability to pass a uintptr_t of flags into
> acpi_scan_check_and detach() so that additional flags can be
> added to indicate whether to defer portions of the eject flow.
> The new flag follows in the next patch.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> ---
> v7: No change
> v6: Based on internal feedback switch to less invasive change
>      to using flags rather than a struct.
> ---
>   drivers/acpi/scan.c | 17 ++++++++++++-----
>   1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index d1464324de95..1ec9677e6c2d 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -244,13 +244,16 @@ static int acpi_scan_try_to_offline(struct acpi_device *device)
>   	return 0;
>   }
>   
> -static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check)
> +#define ACPI_SCAN_CHECK_FLAG_STATUS	BIT(0)
> +
> +static int acpi_scan_check_and_detach(struct acpi_device *adev, void *p)
>   {
>   	struct acpi_scan_handler *handler = adev->handler;
> +	uintptr_t flags = (uintptr_t)p;
>   
> -	acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, check);
> +	acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, p);
>   
> -	if (check) {
> +	if (flags & ACPI_SCAN_CHECK_FLAG_STATUS) {
>   		acpi_bus_get_status(adev);
>   		/*
>   		 * Skip devices that are still there and take the enabled
> @@ -288,7 +291,9 @@ static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check)
>   
>   static void acpi_scan_check_subtree(struct acpi_device *adev)
>   {
> -	acpi_scan_check_and_detach(adev, (void *)true);
> +	uintptr_t flags = ACPI_SCAN_CHECK_FLAG_STATUS;
> +
> +	acpi_scan_check_and_detach(adev, (void *)flags);
>   }
>   
>   static int acpi_scan_hot_remove(struct acpi_device *device)
> @@ -2601,7 +2606,9 @@ EXPORT_SYMBOL(acpi_bus_scan);
>    */
>   void acpi_bus_trim(struct acpi_device *adev)
>   {
> -	acpi_scan_check_and_detach(adev, NULL);
> +	uintptr_t flags = 0;
> +
> +	acpi_scan_check_and_detach(adev, (void *)flags);
>   }
>   EXPORT_SYMBOL_GPL(acpi_bus_trim);

Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Gavin Shan April 26, 2024, 9:25 a.m. UTC | #3
On 4/18/24 23:54, Jonathan Cameron wrote:
> Precursor patch adds the ability to pass a uintptr_t of flags into
> acpi_scan_check_and detach() so that additional flags can be
> added to indicate whether to defer portions of the eject flow.
> The new flag follows in the next patch.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> ---
> v7: No change
> v6: Based on internal feedback switch to less invasive change
>      to using flags rather than a struct.
> ---
>   drivers/acpi/scan.c | 17 ++++++++++++-----
>   1 file changed, 12 insertions(+), 5 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>
diff mbox series

Patch

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index d1464324de95..1ec9677e6c2d 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -244,13 +244,16 @@  static int acpi_scan_try_to_offline(struct acpi_device *device)
 	return 0;
 }
 
-static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check)
+#define ACPI_SCAN_CHECK_FLAG_STATUS	BIT(0)
+
+static int acpi_scan_check_and_detach(struct acpi_device *adev, void *p)
 {
 	struct acpi_scan_handler *handler = adev->handler;
+	uintptr_t flags = (uintptr_t)p;
 
-	acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, check);
+	acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, p);
 
-	if (check) {
+	if (flags & ACPI_SCAN_CHECK_FLAG_STATUS) {
 		acpi_bus_get_status(adev);
 		/*
 		 * Skip devices that are still there and take the enabled
@@ -288,7 +291,9 @@  static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check)
 
 static void acpi_scan_check_subtree(struct acpi_device *adev)
 {
-	acpi_scan_check_and_detach(adev, (void *)true);
+	uintptr_t flags = ACPI_SCAN_CHECK_FLAG_STATUS;
+
+	acpi_scan_check_and_detach(adev, (void *)flags);
 }
 
 static int acpi_scan_hot_remove(struct acpi_device *device)
@@ -2601,7 +2606,9 @@  EXPORT_SYMBOL(acpi_bus_scan);
  */
 void acpi_bus_trim(struct acpi_device *adev)
 {
-	acpi_scan_check_and_detach(adev, NULL);
+	uintptr_t flags = 0;
+
+	acpi_scan_check_and_detach(adev, (void *)flags);
 }
 EXPORT_SYMBOL_GPL(acpi_bus_trim);