Skip to content

Commit 8ab63e0

Browse files
rfvirgilLucas Tanure
authored andcommitted
mfd: clsic: Make clsic_maintenance() a delayed_work
Change clsic_maintenance() to be run as a delayed_work instead of a plain work_struct so that it can be requeued with a delay. Change-Id: I4266fef979e376d0fa91ebbe242151f92a8cf3e7 Signed-off-by: Richard Fitzgerald <[email protected]>
1 parent 8a21a16 commit 8ab63e0

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

drivers/mfd/clsic/clsic-bootsrv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static int clsic_bootsrv_service_update_begin(struct clsic *clsic)
303303
/*
304304
* The bootloader request will be progressed in the maintenance thread
305305
*/
306-
schedule_work(&clsic->maintenance_handler);
306+
schedule_delayed_work(&clsic->maintenance_handler, 0);
307307

308308
return 0;
309309
}
@@ -504,7 +504,7 @@ static int clsic_bootsrv_msghandler(struct clsic *clsic,
504504
* runs.
505505
*/
506506
clsic_purge_message_queues(clsic);
507-
schedule_work(&clsic->maintenance_handler);
507+
schedule_delayed_work(&clsic->maintenance_handler, 0);
508508
}
509509
return ret;
510510
}
@@ -572,7 +572,7 @@ int clsic_bootsrv_state_handler(struct clsic *clsic)
572572
* As this is called from the maintenance_handler
573573
* context this will cause it to re-run
574574
*/
575-
schedule_work(&clsic->maintenance_handler);
575+
schedule_delayed_work(&clsic->maintenance_handler, 0);
576576

577577
}
578578
break;

drivers/mfd/clsic/clsic-core.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static void clsic_boot_nowait(struct clsic *clsic)
342342
{
343343
unsigned int val;
344344

345-
cancel_work_sync(&clsic->maintenance_handler);
345+
cancel_delayed_work_sync(&clsic->maintenance_handler);
346346
reinit_completion(&clsic->pm_completion);
347347

348348
if (clsic->volatile_memory) {
@@ -354,7 +354,7 @@ static void clsic_boot_nowait(struct clsic *clsic)
354354
CLSIC_BOOT_PROGRESS_TIMEOUT_MICROSECONDS);
355355
clsic_fwupdate_reset(clsic);
356356
} else
357-
schedule_work(&clsic->maintenance_handler);
357+
schedule_delayed_work(&clsic->maintenance_handler, 0);
358358

359359
/* Unmask the IRQ used for messaging */
360360
clsic_irq_messaging_enable(clsic);
@@ -406,7 +406,7 @@ int clsic_dev_init(struct clsic *clsic)
406406
clsic->volatile_memory = of_property_read_bool(clsic->dev->of_node,
407407
"volatile_memory");
408408

409-
INIT_WORK(&clsic->maintenance_handler, clsic_maintenance);
409+
INIT_DELAYED_WORK(&clsic->maintenance_handler, clsic_maintenance);
410410

411411
clsic_init_sysfs(clsic);
412412

@@ -557,7 +557,8 @@ void clsic_dev_panic(struct clsic *clsic, struct clsic_message *msg)
557557
*/
558558
void clsic_maintenance(struct work_struct *data)
559559
{
560-
struct clsic *clsic = container_of(data, struct clsic,
560+
struct delayed_work *dw = to_delayed_work(data);
561+
struct clsic *clsic = container_of(dw, struct clsic,
561562
maintenance_handler);
562563

563564
trace_clsic_maintenance(clsic->state, clsic->blrequest,
@@ -666,7 +667,7 @@ int clsic_dev_exit(struct clsic *clsic)
666667
pm_runtime_mark_last_busy(clsic->dev);
667668
pm_runtime_put_autosuspend(clsic->dev);
668669

669-
cancel_work_sync(&clsic->maintenance_handler);
670+
cancel_delayed_work_sync(&clsic->maintenance_handler);
670671

671672
/*
672673
* If any of the services registered child devices this will call their

include/linux/mfd/clsic/core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ struct clsic {
205205
*
206206
* It has a brief lifespan and uses the shared workqueue
207207
*/
208-
struct work_struct maintenance_handler;
208+
struct delayed_work maintenance_handler;
209209

210210
/* The message layer has it's own workqueue as it is long lived */
211211
struct workqueue_struct *message_worker_queue;

0 commit comments

Comments
 (0)