power: Remove deprecated create_singlethread_workqueue
v2 cover power: Remove deprecated create_singlethread_workqueue
This patch set removes the instances of deprecated create_singlethread_workqueues in drivers/power by making the appropriate conversions.
Bhaktipriya Shridhar (8):
power: abx500_chargalg: Remove deprecated
create_singlethread_workqueue
power: ab8500_btemp: Remove deprecated create_singlethread_workqueue
power: pm2301_charger: Remove deprecated create_singlethread_workqueue
power: intel_mid_battery: Remove deprecated
create_singlethread_workqueue
power: ab8500_charger: Remove deprecated create_singlethread_workqueue
power: ipaq_micro_battery: Remove deprecated
create_singlethread_workqueue
power: ab8500_fg: Remove deprecated create_singlethread_workqueue
power: ds2760_battery: Remove deprecated create_singlethread_workqueue
drivers/power/ab8500_btemp.c | 2 +- drivers/power/ab8500_charger.c | 4 ++-- drivers/power/ab8500_fg.c | 2 +- drivers/power/abx500_chargalg.c | 4 ++-- drivers/power/ds2760_battery.c | 3 ++- drivers/power/intel_mid_battery.c | 3 +-- drivers/power/ipaq_micro_battery.c | 2 +- drivers/power/pm2301_charger.c | 3 ++- 8 files changed, 12 insertions(+), 11 deletions(-)
--
2.1.4
PATCH v2 1/8 power: abx500_chargalg: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces deprecated create_singlethread_workqueue(). This is the identity conversion.
The workqueue "chargalg_wq" is used for running the charging algorithm. It has multiple workitems viz &di->chargalg_periodic_work, &di->chargalg_wd_work, &di->chargalg_work per abx500_chargalg, which require ordering. It has been identity converted.
Also, WQ_MEM_RECLAIM has been set to ensure forward progress under memory pressure.
--- drivers/power/abx500_chargalg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/abx500_chargalg.c +2 -2
@@ -2091,8 +2091,8 @@ static int abx500_chargalg_probe(struct platform_device *pdev) abx500_chargalg_maintenance_timer_expired;/* Create a work queue for the chargalg */ - di->chargalg_wq = -create_singlethread_workqueue ("abx500_chargalg_wq" ); + di->chargalg_wq =alloc_ordered_workqueue ("abx500_chargalg_wq" , +WQ_MEM_RECLAIM );if (di->chargalg_wq ==NULL ) {dev_err (di->dev,"failed to create work queue\n" );return -ENOMEM ;
--
2.1.4
PATCH v2 2/8 power: ab8500_btemp: Remove deprecated create_singlethread_workqueue
In reply to Bhaktipriya ShridharThe workqueue "btemp_wq" is used for measuring the temperature periodically. It queues a single workitem (btemp_periodic_work) and hence doesn't require ordering. Thus, the deprecated create_singlethread_workqueue() instance has been replaced with alloc_workqueue().
The WQ_MEM_RECLAIM flag has been set to ensure forward progress under memory pressure.
Since there is a single work item, explicit concurrency limit is unnecessary here.
--- drivers/power/ab8500_btemp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/ab8500_btemp.c +1 -1
@@ -1095,7 +1095,7 @@ static int ab8500_btemp_probe(struct platform_device *pdev)/* Create a work queue for the btemp */ di->btemp_wq = -create_singlethread_workqueue ("ab8500_btemp_wq" ); +alloc_workqueue ("ab8500_btemp_wq" ,WQ_MEM_RECLAIM ,0 );if (di->btemp_wq ==NULL ) {dev_err (di->dev,"failed to create work queue\n" );return -ENOMEM ;
--
2.1.4
PATCH v2 3/8 power: pm2301_charger: Remove deprecated create_singlethread_workqueue
In reply to Bhaktipriya Shridharalloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces deprecated create_singlethread_workqueue(). This is the identity conversion.
The workqueue "charger_wq" is used for running all the charger related tasks. This involves charger detection, checking for HW failure and HW status. This workqueue has been identity converted.
It queues multiple workitems viz &pm2->check_main_thermal_prot_work, &pm2->check_hw_failure_work, &pm2->ac_work. Hence, the deprecated create_singlethread_workqueue() instance has been replaced with a dedicated ordered workqueue.
The WQ_MEM_RECLAIM flag has been set to ensure forward progress under memory pressure.
--- drivers/power/pm2301_charger.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/pm2301_charger.c +2 -1
@@ -1054,7 +1054,8 @@ static int pm2xxx_wall_charger_probe(struct i2c_client *i2c_client, pm2->ac_chg.external = true;/* Create a work queue for the charger */ - pm2->charger_wq =create_singlethread_workqueue ("pm2xxx_charger_wq" ); + pm2->charger_wq =alloc_ordered_workqueue ("pm2xxx_charger_wq" , +WQ_MEM_RECLAIM );if (pm2->charger_wq ==NULL ) { ret = -ENOMEM ;dev_err (pm2->dev,"failed to create work queue\n" );
--
2.1.4
PATCH v2 4/8 power: intel_mid_battery: Remove deprecated create_singlethread_workqueue
In reply to Bhaktipriya ShridharThe workqueue "monitor_wqueue" is used to monitor the PMIC battery status. It queues a single work item (pbi->monitor_battery) and hence doesn't require ordering. Hence, alloc_workqueue has been used to replace the deprecated create_singlethread_workqueue instance.
Since PMIC battery status needs to be monitored for any change, the WQ_MEM_RECLAIM flag has been set to ensure forward progress under memory pressure.
Since there is a single work item, explicit concurrency limit is unnecessary here.
--- drivers/power/intel_mid_battery.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/power/intel_mid_battery.c +1 -2
@@ -689,8 +689,7 @@ static int probe(int irq, struct device *dev)/* initialize all required framework before enabling interrupts */ INIT_WORK (&pbi->handler, pmic_battery_handle_intrpt);INIT_DELAYED_WORK (&pbi->monitor_battery, pmic_battery_monitor); - pbi->monitor_wqueue = -create_singlethread_workqueue (dev_name (dev)); + pbi->monitor_wqueue =alloc_workqueue (dev_name (dev),WQ_MEM_RECLAIM ,0 );if (!pbi->monitor_wqueue) {dev_err (dev,"%s(): wqueue init failed\n" , __func__); retval = -ESRCH ;
--
2.1.4
PATCH v2 5/8 power: ab8500_charger: Remove deprecated create_singlethread_workqueue
In reply to Bhaktipriya Shridharalloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces deprecated create_singlethread_workqueue(). This is the identity conversion.
The workqueue "charger_wq" is used for the IRQs and checking HW state of the charger. It has been identity converted.
It has multiple work items viz usb_charger_attached_work, kick_wd_work, check_vbat_work, check_hw_failure_work, usb_charger_attached_work, ac_work, ac_charger_attached_work, attach_work and check_usbchgnotok_work, which require execution ordering. Hence, a dedicated ordered workqueue has been used here.
The WQ_MEM_RECLAIM flag has also been set to ensure forward progress under memory pressure.
--- drivers/power/ab8500_charger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/ab8500_charger.c +2 -2
@@ -3540,8 +3540,8 @@ static int ab8500_charger_probe(struct platform_device *pdev) di->usb_state.usb_current =-1 ;/* Create a work queue for the charger */ - di->charger_wq = -create_singlethread_workqueue ("ab8500_charger_wq" ); + di->charger_wq =alloc_ordered_workqueue ("ab8500_charger_wq" , +WQ_MEM_RECLAIM );if (di->charger_wq ==NULL ) {dev_err (di->dev,"failed to create work queue\n" );return -ENOMEM ;
--
2.1.4
PATCH v2 6/8 power: ipaq_micro_battery: Remove deprecated create_singlethread_workqueue
In reply to Bhaktipriya ShridharThe workqueue "wq" is used for handling battery related tasks.
It has a single work item viz &mb->update and hence it doesn't require execution ordering. Hence, alloc_workqueue has been used to replace the deprecated create_singlethread_workqueue instance.
The WQ_MEM_RECLAIM flag has been set to ensure forward progress under memory pressure.
Since there is a single work item, explicit concurrency limit is unnecessary here.
--- drivers/power/ipaq_micro_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/ipaq_micro_battery.c +1 -1
@@ -235,7 +235,7 @@ static int micro_batt_probe(struct platform_device *pdev)return -ENOMEM ; mb->micro =dev_get_drvdata (pdev->dev.parent); - mb->wq =create_singlethread_workqueue ("ipaq-battery-wq" ); + mb->wq =alloc_workqueue ("ipaq-battery-wq" ,WQ_MEM_RECLAIM ,0 );if (!mb->wq)return -ENOMEM ;
--
2.1.4
PATCH v2 7/8 power: ab8500_fg: Remove deprecated create_singlethread_workqueue
In reply to Bhaktipriya Shridharalloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces deprecated create_singlethread_workqueue(). This is the identity conversion.
The workqueue "fg_wq" is used for running the FG algorithm periodically. It has been identity converted.
It has multiple work items viz fg_periodic_work, fg_low_bat_work, fg_reinit_work, fg_work, fg_acc_cur_work and fg_check_hw_failure_work, which require execution ordering. Hence, a dedicated ordered workqueue has been used here.
The WQ_MEM_RECLAIM flag has been set to guarantee forward progress under memory pressure.
--- drivers/power/ab8500_fg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/ab8500_fg.c +1 -1
@@ -3096,7 +3096,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)ab8500_fg_discharge_state_to (di,AB8500_FG_DISCHARGE_INIT );/* Create a work queue for running the FG algorithm */ - di->fg_wq =create_singlethread_workqueue ("ab8500_fg_wq" ); + di->fg_wq =alloc_ordered_workqueue ("ab8500_fg_wq" ,WQ_MEM_RECLAIM );if (di->fg_wq ==NULL ) {dev_err (di->dev,"failed to create work queue\n" );return -ENOMEM ;
--
2.1.4
PATCH v2 8/8 power: ds2760_battery: Remove deprecated create_singlethread_workqueue
In reply to Bhaktipriya Shridharalloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces deprecated create_singlethread_workqueue(). This is the identity conversion.
The workqueue "monitor_wqueue" is used to monitor the battery status. It has been identity converted.
It queues multiple work items viz &di->monitor_work, &di->set_charged_work, which require execution ordering. Hence, alloc_workqueue has been used to replace the deprecated create_singlethread_workqueue instance.
WQ_MEM_RECLAIM flag has been set to ensure forward progress under memory pressure.
--- drivers/power/ds2760_battery.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/power/ds2760_battery.c +2 -1
@@ -566,7 +566,8 @@ static int ds2760_battery_probe(struct platform_device *pdev)INIT_DELAYED_WORK (&di->monitor_work, ds2760_battery_work);INIT_DELAYED_WORK (&di->set_charged_work, ds2760_battery_set_charged_work); - di->monitor_wqueue =create_singlethread_workqueue (dev_name (&pdev->dev)); + di->monitor_wqueue =alloc_ordered_workqueue (dev_name (&pdev->dev), +WQ_MEM_RECLAIM );if (!di->monitor_wqueue) { retval = -ESRCH ; goto workqueue_failed;
--
2.1.4
Hi Bhaktipriya,
Quoted 3 lines · Bhaktipriya Shridhar
This patch set removes the instances of deprecated
create_singlethread_workqueuesindrivers/powerby making the appropriate conversions.
Sorry, I was unclear in my mail: I already queued the last revision, there was no need to resend it. The tip regarding the subsystem prefix and broken thread was for any new patchsets written by you. Actually I have one more request now: If you send new versions of a patchset, please add a changelog. E.g. for this one:
Changes since v1:
* add "power:" prefix to PATCH0 subject
Anyways your patches are already in linux-next.
-- Sebastian