From: joeyli <jlee@suse.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Lee, Chun-Yi" <joeyli.kernel@gmail.com>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Len Brown <lenb@kernel.org>
Subject: Re: [PATCH] acpi: handle the acpi hotplug schedule error
Date: Wed, 7 Jun 2017 18:18:32 +0800 [thread overview]
Message-ID: <20170607101832.GW30622@linux-l9pv.suse> (raw)
In-Reply-To: <CAHp75Vdeagae37PHoD4yw4dncFQJ2tmuxRu0zzbH_b+SnY4pEQ@mail.gmail.com>
Hi Andy,
Thanks for your help to review my patch.
On Wed, Jun 07, 2017 at 11:36:55AM +0300, Andy Shevchenko wrote:
> On Wed, Jun 7, 2017 at 9:05 AM, Lee, Chun-Yi <joeyli.kernel@gmail.com> wrote:
> > Kernel should decrements the reference count of acpi device
> > when scheduling acpi hotplug work is failed, and also evaluates
> > _OST to notify BIOS the failure.
>
> > - if (hotplug_event && ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
> > - return;
A note here...
When the acpi hotplug job is scheduled success, the adev device can not
be put because acpi_device_hotplug() will put it until hotplug routine
finished.
drivers/acpi/bus.c acpi_bus_notify()
acpi_bus_get_acpi_device(handle) //get here
drivers/acpi/osl.c acpi_hotplug_schedule()
drivers/acpi/osl.c acpi_hotplug_work_fn()
drivers/acpi/scan.c acpi_device_hotplug()
acpi_bus_put_acpi_device(adev) //put here
> > + if (hotplug_event) {
> > + if (ACPI_FAILURE(acpi_hotplug_schedule(adev, type))) {
> > + acpi_bus_put_acpi_device(adev);
> > + goto err;
> > + } else {
> > + return;
> > + }
> > + }
>
> Wouldn't be simpler to
>
> - return;
> + goto err_put_device;
>
> + err_put_device:
> + acpi_bus_put_acpi_device(adev);
> err:
>
So, do you mean like this?
- if (hotplug_event && ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
- return;
+ if (hotplug_event) {
+ if (ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
+ return;
+ else
+ goto err_put_device;
+ }
acpi_bus_put_acpi_device(adev);
return;
+err_put_device:
+ acpi_bus_put_acpi_device(adev);
err:
acpi_evaluate_ost(handle, type, ost_code, NULL);
}
Thanks for your suggestion, it looks simpler.
Joey Lee
next prev parent reply other threads:[~2017-06-07 10:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 6:05 [PATCH] acpi: handle the acpi hotplug schedule error Lee, Chun-Yi
2017-06-07 8:36 ` Andy Shevchenko
2017-06-07 10:18 ` joeyli [this message]
2017-06-07 10:46 ` Andy Shevchenko
2017-06-07 15:39 ` joeyli
2017-06-07 16:55 ` Andy Shevchenko
-- strict thread matches above, loose matches on Subject: below --
2017-06-03 7:38 Lee, Chun-Yi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170607101832.GW30622@linux-l9pv.suse \
--to=jlee@suse.com \
--cc=andy.shevchenko@gmail.com \
--cc=joeyli.kernel@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).