diff options
author | Tejun Heo <tj@kernel.org> | 2014-03-07 10:24:48 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-03-07 10:24:48 -0500 |
commit | 77fa83cf7478202fac1520ca082ab8f9658d63b4 (patch) | |
tree | 13c4b03a5f416f78ef95396600ec09f30622a7c0 | |
parent | 75ddb38f0901d12831264cd74224598e4d8f528b (diff) |
usb: don't use PREPARE_DELAYED_WORK
PREPARE_[DELAYED_]WORK() are being phased out. They have few users
and a nasty surprise in terms of reentrancy guarantee as workqueue
considers work items to be different if they don't have the same work
function.
usb_hub->init_work is multiplexed with multiple work functions;
however, the work item is never queued while in-flight, so we can
simply use INIT_DELAYED_WORK() before each queueing.
It would probably be best to route this with other related updates
through the workqueue tree.
Lightly tested.
v2: Greg and Alan confirm that the work item is never queued while
in-flight. Simply use INIT_DELAYED_WORK().
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org
-rw-r--r-- | drivers/usb/core/hub.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 64ea21971be2..5cbf78d0be25 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1040,7 +1040,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
1040 | */ | 1040 | */ |
1041 | if (type == HUB_INIT) { | 1041 | if (type == HUB_INIT) { |
1042 | delay = hub_power_on(hub, false); | 1042 | delay = hub_power_on(hub, false); |
1043 | PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2); | 1043 | INIT_DELAYED_WORK(&hub->init_work, hub_init_func2); |
1044 | schedule_delayed_work(&hub->init_work, | 1044 | schedule_delayed_work(&hub->init_work, |
1045 | msecs_to_jiffies(delay)); | 1045 | msecs_to_jiffies(delay)); |
1046 | 1046 | ||
@@ -1194,7 +1194,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
1194 | 1194 | ||
1195 | /* Don't do a long sleep inside a workqueue routine */ | 1195 | /* Don't do a long sleep inside a workqueue routine */ |
1196 | if (type == HUB_INIT2) { | 1196 | if (type == HUB_INIT2) { |
1197 | PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func3); | 1197 | INIT_DELAYED_WORK(&hub->init_work, hub_init_func3); |
1198 | schedule_delayed_work(&hub->init_work, | 1198 | schedule_delayed_work(&hub->init_work, |
1199 | msecs_to_jiffies(delay)); | 1199 | msecs_to_jiffies(delay)); |
1200 | return; /* Continues at init3: below */ | 1200 | return; /* Continues at init3: below */ |