From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Miles J Penner <miles.j.penner@intel.com>,
John Ronciak <john.ronciak@intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Tushar N Dave <tushar.n.dave@intel.com>,
"Kirill A. Shutemov" <kirill@shutemov.name>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Yinghai Lu <yinghai@kernel.org>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Amos Kong <kongjianjun@gmail.com>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] PCI Hotplug: convert acpiphp_hp_work to use delayed work
Date: Thu, 13 Dec 2012 17:31:47 +0200 [thread overview]
Message-ID: <1355412708-20046-3-git-send-email-kirill.shutemov@linux.intel.com> (raw)
In-Reply-To: <1355412708-20046-1-git-send-email-kirill.shutemov@linux.intel.com>
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Some broken ACPI PCI Hotplug implementations notify OS about hotplug
before devices ready to be enumerated.
Let's convert acpiphp_hp_work to delayed work. It will allow to delay
enumeration on broken hardware to workaround the issue.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
drivers/pci/hotplug/acpiphp_glue.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 3d6d4fd..1a2b3ca 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -1191,7 +1191,7 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
}
struct acpiphp_hp_work {
- struct work_struct work;
+ struct delayed_work work;
acpi_handle handle;
u32 type;
void *context;
@@ -1199,7 +1199,8 @@ struct acpiphp_hp_work {
static void alloc_acpiphp_hp_work(acpi_handle handle, u32 type,
void *context,
- void (*func)(struct work_struct *work))
+ void (*func)(struct work_struct *work),
+ unsigned long delay)
{
struct acpiphp_hp_work *hp_work;
int ret;
@@ -1212,8 +1213,8 @@ static void alloc_acpiphp_hp_work(acpi_handle handle, u32 type,
hp_work->type = type;
hp_work->context = context;
- INIT_WORK(&hp_work->work, func);
- ret = queue_work(kacpi_hotplug_wq, &hp_work->work);
+ INIT_DELAYED_WORK(&hp_work->work, func);
+ ret = queue_delayed_work(kacpi_hotplug_wq, &hp_work->work, delay);
if (!ret)
kfree(hp_work);
}
@@ -1230,7 +1231,8 @@ static void _handle_hotplug_event_bridge(struct work_struct *work)
acpi_handle handle;
u32 type;
- hp_work = container_of(work, struct acpiphp_hp_work, work);
+ hp_work = container_of(to_delayed_work(work),
+ struct acpiphp_hp_work, work);
handle = hp_work->handle;
type = hp_work->type;
@@ -1334,7 +1336,7 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type,
* don't deadlock on hotplug actions.
*/
alloc_acpiphp_hp_work(handle, type, context,
- _handle_hotplug_event_bridge);
+ _handle_hotplug_event_bridge, 0);
}
static void _handle_hotplug_event_func(struct work_struct *work)
@@ -1348,7 +1350,8 @@ static void _handle_hotplug_event_func(struct work_struct *work)
u32 type;
void *context;
- hp_work = container_of(work, struct acpiphp_hp_work, work);
+ hp_work = container_of(to_delayed_work(work),
+ struct acpiphp_hp_work, work);
handle = hp_work->handle;
type = hp_work->type;
context = hp_work->context;
@@ -1410,7 +1413,7 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type,
* don't deadlock on hotplug actions.
*/
alloc_acpiphp_hp_work(handle, type, context,
- _handle_hotplug_event_func);
+ _handle_hotplug_event_func, 0);
}
static acpi_status
--
1.7.10.4
next prev parent reply other threads:[~2012-12-13 15:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-13 19:25 [PATCH 0/3] Thunderbolt workarounds Kirill A. Shutemov
2012-12-13 15:31 ` [PATCH 1/3] PCI Hotplug: workaround for Thunderbolt on Acer Aspire S5 Kirill A. Shutemov
2012-12-13 18:44 ` Greg KH
2012-12-13 19:35 ` Kirill A. Shutemov
2012-12-14 0:22 ` Bjorn Helgaas
2012-12-14 10:46 ` Kirill A. Shutemov
2012-12-13 15:31 ` Kirill A. Shutemov [this message]
2012-12-13 15:31 ` [PATCH 3/3] PCI Hotplug: workaround for Thunderbolt on Intel DZ77RE-75K motherboard Kirill A. Shutemov
2012-12-13 18:48 ` Greg KH
2012-12-13 20:08 ` Kirill A. Shutemov
2012-12-13 20:25 ` Yinghai Lu
2012-12-13 20:30 ` Linus Torvalds
2012-12-13 20:49 ` Kirill A. Shutemov
2012-12-13 20:54 ` Linus Torvalds
2012-12-13 22:06 ` Rafael J. Wysocki
2012-12-14 10:34 ` Kirill A. Shutemov
2012-12-27 0:50 ` [PATCH 0/3] Thunderbolt workarounds Bjorn Helgaas
2012-12-27 9:33 ` Mika Westerberg
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=1355412708-20046-3-git-send-email-kirill.shutemov@linux.intel.com \
--to=kirill.shutemov@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jbarnes@virtuousgeek.org \
--cc=john.ronciak@intel.com \
--cc=kirill@shutemov.name \
--cc=kongjianjun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=miles.j.penner@intel.com \
--cc=rjw@sisk.pl \
--cc=tushar.n.dave@intel.com \
--cc=yinghai@kernel.org \
/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).