Re: [PATCH] Install Notify() handler before getting NFIT table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 19, 2023 at 2:57 PM chenxiang <chenxiang66@xxxxxxxxxxxxx> wrote:
>
> From: Xiang Chen <chenxiang66@xxxxxxxxxxxxx>
>
> If there is no NFIT at startup, it will return 0 immediately in function
> acpi_nfit_add() and will not install Notify() handler. If hotplugging
> a nvdimm device later, it will not be identified as there is no Notify()
> handler.

Yes, this is a change in behavior that shouldn't have been made.

> So move handler installing before getting NFI table in function
> acpi_nfit_add() to avoid above issue.

And the fix is correct if I'm not mistaken.

I can still queue it up for 6.6 if that's fine with everyone.  Dan?

> Fixes: dcca12ab62a2 ("ACPI: NFIT: Install Notify() handler directly")
> Signed-off-by: Xiang Chen <chenxiang66@xxxxxxxxxxxxx>
> ---
>  drivers/acpi/nfit/core.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index 3826f49..9923855 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -3339,6 +3339,16 @@ static int acpi_nfit_add(struct acpi_device *adev)
>         acpi_size sz;
>         int rc = 0;
>
> +       rc = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
> +                                            acpi_nfit_notify, adev);
> +       if (rc)
> +               return rc;
> +
> +       rc = devm_add_action_or_reset(dev, acpi_nfit_remove_notify_handler,
> +                                       adev);
> +       if (rc)
> +               return rc;
> +
>         status = acpi_get_table(ACPI_SIG_NFIT, 0, &tbl);
>         if (ACPI_FAILURE(status)) {
>                 /* The NVDIMM root device allows OS to trigger enumeration of
> @@ -3386,17 +3396,7 @@ static int acpi_nfit_add(struct acpi_device *adev)
>         if (rc)
>                 return rc;
>
> -       rc = devm_add_action_or_reset(dev, acpi_nfit_shutdown, acpi_desc);
> -       if (rc)
> -               return rc;
> -
> -       rc = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
> -                                            acpi_nfit_notify, adev);
> -       if (rc)
> -               return rc;
> -
> -       return devm_add_action_or_reset(dev, acpi_nfit_remove_notify_handler,
> -                                       adev);
> +       return devm_add_action_or_reset(dev, acpi_nfit_shutdown, acpi_desc);
>  }
>
>  static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle)
> --





[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux